diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp index 517f2355be0d548a92e9b7bed8298838da634029..7c79c613cf8fc3b6566686d6cddab00385914994 100644 --- a/llvm/lib/AsmParser/LLLexer.cpp +++ b/llvm/lib/AsmParser/LLLexer.cpp @@ -598,6 +598,7 @@ int LLLexer::LexIdentifier() { INSTKEYWORD("extractelement", OtherOpVal, ExtractElement, EXTRACTELEMENT); INSTKEYWORD("insertelement", OtherOpVal, InsertElement, INSERTELEMENT); INSTKEYWORD("shufflevector", OtherOpVal, ShuffleVector, SHUFFLEVECTOR); + INSTKEYWORD("getresult", OtherOpVal, GetResult, GETRESULT); #undef INSTKEYWORD // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 2848945648eeb0e41d0c266b0b682a5e0bafafb0..5a3f17c1470a313515763edd60e15302de08c1f9 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -1093,6 +1093,7 @@ Module *llvm::RunVMAsmParser(llvm::MemoryBuffer *MB) { // Other Operators %token PHI_TOK SELECT VAARG %token EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR +%token GETRESULT // Function Attributes %token SIGNEXT ZEROEXT NORETURN INREG SRET NOUNWIND NOALIAS BYVAL NEST @@ -1733,7 +1734,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); const PointerType *Ty = dyn_cast($1->get()); if (Ty == 0) - GEN_ERROR("Global const reference must be a pointer type"); + GEN_ERROR("Global const reference must be a pointer type " + (*$1)->getDescription()); // ConstExprs can exist in the body of a function, thus creating // GlobalValues whenever they refer to a variable. Because we are in @@ -3130,6 +3131,14 @@ MemoryInst : MALLOC Types OptCAlign { $$ = new StoreInst($3, tmpVal, $1, $7); delete $5; } +| GETRESULT Types LocalName ',' ConstVal { + ValID TmpVID = ValID::createLocalName(*$3); + Value *TmpVal = getVal($2->get(), TmpVID); + if (!GetResultInst::isValidOperands(TmpVal, $5)) + GEN_ERROR("Invalid getresult operands"); + $$ = new GetResultInst(TmpVal, $5); + CHECK_FOR_ERROR + } | GETELEMENTPTR Types ValueRef IndexList { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());