aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 0372da19df55..d69ac7289fe4 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1736,6 +1736,13 @@ bool LLParser::parseOptionalParamAttrs(AttrBuilder &B) {
B.addPreallocatedAttr(Ty);
continue;
}
+ case lltok::kw_inalloca: {
+ Type *Ty;
+ if (parseInalloca(Ty))
+ return true;
+ B.addInAllocaAttr(Ty);
+ continue;
+ }
case lltok::kw_dereferenceable: {
uint64_t Bytes;
if (parseOptionalDerefAttrBytes(lltok::kw_dereferenceable, Bytes))
@@ -1757,7 +1764,6 @@ bool LLParser::parseOptionalParamAttrs(AttrBuilder &B) {
B.addByRefAttr(Ty);
continue;
}
- case lltok::kw_inalloca: B.addAttribute(Attribute::InAlloca); break;
case lltok::kw_inreg: B.addAttribute(Attribute::InReg); break;
case lltok::kw_nest: B.addAttribute(Attribute::Nest); break;
case lltok::kw_noundef:
@@ -2694,6 +2700,12 @@ bool LLParser::parsePreallocated(Type *&Result) {
return parseRequiredTypeAttr(Result, lltok::kw_preallocated);
}
+/// parseInalloca
+/// ::= inalloca(<ty>)
+bool LLParser::parseInalloca(Type *&Result) {
+ return parseRequiredTypeAttr(Result, lltok::kw_inalloca);
+}
+
/// parseByRef
/// ::= byref(<type>)
bool LLParser::parseByRef(Type *&Result) {
@@ -4704,11 +4716,6 @@ bool LLParser::parseDISubrange(MDNode *&Result, bool IsDistinct) {
Metadata *LowerBound = nullptr;
Metadata *UpperBound = nullptr;
Metadata *Stride = nullptr;
- if (count.isMDSignedField())
- Count = ConstantAsMetadata::get(ConstantInt::getSigned(
- Type::getInt64Ty(Context), count.getMDSignedValue()));
- else if (count.isMDField())
- Count = count.getMDFieldValue();
auto convToMetadata = [&](MDSignedOrMDField Bound) -> Metadata * {
if (Bound.isMDSignedField())
@@ -4719,6 +4726,7 @@ bool LLParser::parseDISubrange(MDNode *&Result, bool IsDistinct) {
return nullptr;
};
+ Count = convToMetadata(count);
LowerBound = convToMetadata(lowerBound);
UpperBound = convToMetadata(upperBound);
Stride = convToMetadata(stride);