aboutsummaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r--lib/AsmParser/LLParser.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index b9b66ba7b2b..565b1a27daf 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -6074,7 +6074,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
/// ParseAlloc
/// ::= 'alloca' 'inalloca'? 'swifterror'? Type (',' TypeAndValue)?
-/// (',' 'align' i32)?
+/// (',' 'align' i32)? (',', 'addrspace(n))?
int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
Value *Size = nullptr;
LocTy SizeLoc, TyLoc, ASLoc;
@@ -6104,11 +6104,22 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
} else if (Lex.getKind() == lltok::MetadataVar) {
AteExtraComma = true;
} else {
- if (ParseTypeAndValue(Size, SizeLoc, PFS) ||
- ParseOptionalCommaAlign(Alignment, AteExtraComma) ||
- (!AteExtraComma &&
- ParseOptionalCommaAddrSpace(AddrSpace, ASLoc, AteExtraComma)))
+ if (ParseTypeAndValue(Size, SizeLoc, PFS))
return true;
+ if (EatIfPresent(lltok::comma)) {
+ if (Lex.getKind() == lltok::kw_align) {
+ if (ParseOptionalAlignment(Alignment))
+ return true;
+ if (ParseOptionalCommaAddrSpace(AddrSpace, ASLoc, AteExtraComma))
+ return true;
+ } else if (Lex.getKind() == lltok::kw_addrspace) {
+ ASLoc = Lex.getLoc();
+ if (ParseOptionalAddrSpace(AddrSpace))
+ return true;
+ } else if (Lex.getKind() == lltok::MetadataVar) {
+ AteExtraComma = true;
+ }
+ }
}
}