diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/LLLexer.cpp | 2 | ||||
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 6 | ||||
-rw-r--r-- | lib/AsmParser/LLToken.h | 2 | ||||
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 2 | ||||
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 2 | ||||
-rw-r--r-- | lib/IR/Attributes.cpp | 6 | ||||
-rw-r--r-- | lib/IR/Verifier.cpp | 2 |
7 files changed, 19 insertions, 3 deletions
diff --git a/lib/AsmParser/LLLexer.cpp b/lib/AsmParser/LLLexer.cpp index 2256124043..3b8b0337e5 100644 --- a/lib/AsmParser/LLLexer.cpp +++ b/lib/AsmParser/LLLexer.cpp @@ -578,6 +578,8 @@ lltok::Kind LLLexer::LexIdentifier() { KEYWORD(ssp); KEYWORD(sspreq); KEYWORD(sspstrong); + KEYWORD(thread_safety); + KEYWORD(uninitialized_checks); KEYWORD(uwtable); KEYWORD(zeroext); diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index e2f42d8231..e4f8d1fec4 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -922,6 +922,8 @@ bool LLParser::ParseFnAttributeValuePairs(AttrBuilder &B, case lltok::kw_ssp: B.addAttribute(Attribute::StackProtect); break; case lltok::kw_sspreq: B.addAttribute(Attribute::StackProtectReq); break; case lltok::kw_sspstrong: B.addAttribute(Attribute::StackProtectStrong); break; + case lltok::kw_thread_safety: B.addAttribute(Attribute::ThreadSafety); break; + case lltok::kw_uninitialized_checks: B.addAttribute(Attribute::UninitializedChecks); break; case lltok::kw_uwtable: B.addAttribute(Attribute::UWTable); break; // Error handling. @@ -1161,7 +1163,8 @@ bool LLParser::ParseOptionalParamAttrs(AttrBuilder &B) { case lltok::kw_noredzone: case lltok::kw_noimplicitfloat: case lltok::kw_naked: case lltok::kw_nonlazybind: case lltok::kw_address_safety: case lltok::kw_minsize: - case lltok::kw_alignstack: + case lltok::kw_alignstack: case lltok::kw_thread_safety: + case lltok::kw_uninitialized_checks: HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute"); break; } @@ -1203,6 +1206,7 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) { case lltok::kw_nonlazybind: case lltok::kw_address_safety: case lltok::kw_minsize: case lltok::kw_alignstack: case lltok::kw_align: case lltok::kw_noduplicate: + case lltok::kw_thread_safety: case lltok::kw_uninitialized_checks: HaveError |= Error(Lex.getLoc(), "invalid use of function-only attribute"); break; } diff --git a/lib/AsmParser/LLToken.h b/lib/AsmParser/LLToken.h index 8c18a3be60..97429b8ce5 100644 --- a/lib/AsmParser/LLToken.h +++ b/lib/AsmParser/LLToken.h @@ -119,6 +119,8 @@ namespace lltok { kw_sspreq, kw_sspstrong, kw_sret, + kw_thread_safety, + kw_uninitialized_checks, kw_uwtable, kw_zeroext, diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 110f47c7d8..30ba85eca6 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -444,7 +444,7 @@ static void decodeLLVMAttributesForBitcode(AttrBuilder &B, if (Alignment) B.addAlignmentAttr(Alignment); - B.addRawValue(((EncodedAttrs & (0xffffULL << 32)) >> 11) | + B.addRawValue(((EncodedAttrs & (0xfffffULL << 32)) >> 11) | (EncodedAttrs & 0xffff)); } diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 37dcb461e3..65c3f7329d 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -181,7 +181,7 @@ static uint64_t encodeLLVMAttributesForBitcode(AttributeSet Attrs, uint64_t EncodedAttrs = Attrs.Raw(Index) & 0xffff; if (Attrs.hasAttribute(Index, Attribute::Alignment)) EncodedAttrs |= Attrs.getParamAlignment(Index) << 16; - EncodedAttrs |= (Attrs.Raw(Index) & (0xffffULL << 21)) << 11; + EncodedAttrs |= (Attrs.Raw(Index) & (0xfffffULL << 21)) << 11; return EncodedAttrs; } diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index 343f569a11..267c1aa893 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -205,6 +205,10 @@ std::string Attribute::getAsString() const { return "sspstrong"; if (hasAttribute(Attribute::StructRet)) return "sret"; + if (hasAttribute(Attribute::ThreadSafety)) + return "thread_safety"; + if (hasAttribute(Attribute::UninitializedChecks)) + return "uninitialized_checks"; if (hasAttribute(Attribute::UWTable)) return "uwtable"; if (hasAttribute(Attribute::ZExt)) @@ -382,6 +386,8 @@ uint64_t AttributeImpl::getAttrMask(Attribute::AttrKind Val) { case Attribute::MinSize: return 1ULL << 33; case Attribute::NoDuplicate: return 1ULL << 34; case Attribute::StackProtectStrong: return 1ULL << 35; + case Attribute::ThreadSafety: return 1ULL << 36; + case Attribute::UninitializedChecks: return 1ULL << 37; } llvm_unreachable("Unsupported attribute type"); } diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index 31312dc1c4..02c209660b 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -651,6 +651,8 @@ void Verifier::VerifyParameterAttrs(AttributeSet Attrs, uint64_t Idx, Type *Ty, !Attrs.hasAttribute(Idx, Attribute::NonLazyBind) && !Attrs.hasAttribute(Idx, Attribute::ReturnsTwice) && !Attrs.hasAttribute(Idx, Attribute::AddressSafety) && + !Attrs.hasAttribute(Idx, Attribute::ThreadSafety) && + !Attrs.hasAttribute(Idx, Attribute::UninitializedChecks) && !Attrs.hasAttribute(Idx, Attribute::MinSize), "Some attributes in '" + Attrs.getAsString(Idx) + "' only apply to functions!", V); |