llvm.org GIT mirror llvm / ab39afa
[tsan/msan] adding thread_safety and uninitialized_checks attributes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174864 91177308-0d34-0410-b5e6-96231b3b80d8 Kostya Serebryany 6 years ago
12 changed file(s) with 42 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
908908 If a function that has an ``sspstrong`` attribute is inlined into a
909909 function that doesn't have an ``sspstrong`` attribute, then the
910910 resulting function will have an ``sspstrong`` attribute.
911 ``thread_safety``
912 This attribute indicates that the thread safety analysis is enabled
913 for this function.
914 ``uninitialized_checks``
915 This attribute indicates that the checks for uses of uninitialized
916 memory are enabled.
911917 ``uwtable``
912918 This attribute indicates that the ABI being targeted requires that
913919 an unwind table entry be produce for this function even if we can
9494 StackProtectReq, ///< Stack protection required.
9595 StackProtectStrong, ///< Strong Stack protection.
9696 StructRet, ///< Hidden pointer to structure to return
97 ThreadSafety, ///< Thread safety checking is on.
98 UninitializedChecks, ///< Checking for uses of uninitialized memory is on.
9799 UWTable, ///< Function must be in a unwind table
98100 ZExt, ///< Zero extended before/after call
99101
506508 .removeAttribute(Attribute::NonLazyBind)
507509 .removeAttribute(Attribute::ReturnsTwice)
508510 .removeAttribute(Attribute::AddressSafety)
511 .removeAttribute(Attribute::ThreadSafety)
512 .removeAttribute(Attribute::UninitializedChecks)
509513 .removeAttribute(Attribute::MinSize)
510514 .removeAttribute(Attribute::NoDuplicate);
511515 }
577577 KEYWORD(ssp);
578578 KEYWORD(sspreq);
579579 KEYWORD(sspstrong);
580 KEYWORD(thread_safety);
581 KEYWORD(uninitialized_checks);
580582 KEYWORD(uwtable);
581583 KEYWORD(zeroext);
582584
921921 case lltok::kw_ssp: B.addAttribute(Attribute::StackProtect); break;
922922 case lltok::kw_sspreq: B.addAttribute(Attribute::StackProtectReq); break;
923923 case lltok::kw_sspstrong: B.addAttribute(Attribute::StackProtectStrong); break;
924 case lltok::kw_thread_safety: B.addAttribute(Attribute::ThreadSafety); break;
925 case lltok::kw_uninitialized_checks: B.addAttribute(Attribute::UninitializedChecks); break;
924926 case lltok::kw_uwtable: B.addAttribute(Attribute::UWTable); break;
925927
926928 // Error handling.
11601162 case lltok::kw_noredzone: case lltok::kw_noimplicitfloat:
11611163 case lltok::kw_naked: case lltok::kw_nonlazybind:
11621164 case lltok::kw_address_safety: case lltok::kw_minsize:
1163 case lltok::kw_alignstack:
1165 case lltok::kw_alignstack: case lltok::kw_thread_safety:
1166 case lltok::kw_uninitialized_checks:
11641167 HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute");
11651168 break;
11661169 }
12021205 case lltok::kw_nonlazybind: case lltok::kw_address_safety:
12031206 case lltok::kw_minsize: case lltok::kw_alignstack:
12041207 case lltok::kw_align: case lltok::kw_noduplicate:
1208 case lltok::kw_thread_safety: case lltok::kw_uninitialized_checks:
12051209 HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute");
12061210 break;
12071211 }
118118 kw_sspreq,
119119 kw_sspstrong,
120120 kw_sret,
121 kw_thread_safety,
122 kw_uninitialized_checks,
121123 kw_uwtable,
122124 kw_zeroext,
123125
443443
444444 if (Alignment)
445445 B.addAlignmentAttr(Alignment);
446 B.addRawValue(((EncodedAttrs & (0xffffULL << 32)) >> 11) |
446 B.addRawValue(((EncodedAttrs & (0xfffffULL << 32)) >> 11) |
447447 (EncodedAttrs & 0xffff));
448448 }
449449
180180 uint64_t EncodedAttrs = Attrs.Raw(Index) & 0xffff;
181181 if (Attrs.hasAttribute(Index, Attribute::Alignment))
182182 EncodedAttrs |= Attrs.getParamAlignment(Index) << 16;
183 EncodedAttrs |= (Attrs.Raw(Index) & (0xffffULL << 21)) << 11;
183 EncodedAttrs |= (Attrs.Raw(Index) & (0xfffffULL << 21)) << 11;
184184 return EncodedAttrs;
185185 }
186186
204204 return "sspstrong";
205205 if (hasAttribute(Attribute::StructRet))
206206 return "sret";
207 if (hasAttribute(Attribute::ThreadSafety))
208 return "thread_safety";
209 if (hasAttribute(Attribute::UninitializedChecks))
210 return "uninitialized_checks";
207211 if (hasAttribute(Attribute::UWTable))
208212 return "uwtable";
209213 if (hasAttribute(Attribute::ZExt))
381385 case Attribute::MinSize: return 1ULL << 33;
382386 case Attribute::NoDuplicate: return 1ULL << 34;
383387 case Attribute::StackProtectStrong: return 1ULL << 35;
388 case Attribute::ThreadSafety: return 1ULL << 36;
389 case Attribute::UninitializedChecks: return 1ULL << 37;
384390 }
385391 llvm_unreachable("Unsupported attribute type");
386392 }
650650 !Attrs.hasAttribute(Idx, Attribute::NonLazyBind) &&
651651 !Attrs.hasAttribute(Idx, Attribute::ReturnsTwice) &&
652652 !Attrs.hasAttribute(Idx, Attribute::AddressSafety) &&
653 !Attrs.hasAttribute(Idx, Attribute::ThreadSafety) &&
654 !Attrs.hasAttribute(Idx, Attribute::UninitializedChecks) &&
653655 !Attrs.hasAttribute(Idx, Attribute::MinSize),
654656 "Some attributes in '" + Attrs.getAsString(Idx) +
655657 "' only apply to functions!", V);
161161 {
162162 ret void;
163163 }
164 define void @f28() thread_safety
165 ; CHECK: define void @f28() thread_safety
166 {
167 ret void;
168 }
169 define void @f29() uninitialized_checks
170 ; CHECK: define void @f29() uninitialized_checks
171 {
172 ret void;
173 }
174174 | returns_twice
175175 | nonlazybind
176176 | address_safety
177 | thread_safety
178 | uninitialized_checks
177179 ;
178180
179181 OptFuncAttrs ::= + _ | OptFuncAttrs FuncAttr ;
5454 syn keyword llvmKeyword sspstrong tail target thread_local to triple
5555 syn keyword llvmKeyword unnamed_addr unordered uwtable volatile weak weak_odr
5656 syn keyword llvmKeyword x86_fastcallcc x86_stdcallcc x86_thiscallcc zeroext
57 syn keyword llvmKeyword thread_safety uninitialized_checks
5758
5859 " Obsolete keywords.
5960 syn keyword llvmError getresult begin end