diff options
Diffstat (limited to 'llvm/lib/AsmParser/llvmAsmParser.y')
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 67d20fed804..01d43347b8a 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -984,7 +984,8 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { // Other Operators %type <OtherOpVal> ShiftOps -%token <OtherOpVal> PHI_TOK CAST SELECT SHL SHR VAARG EXTRACTELEMENT +%token <OtherOpVal> PHI_TOK CAST SELECT SHL SHR VAARG +%token <OtherOpVal> EXTRACTELEMENT INSERTELEMENT %token VAARG_old VANEXT_old //OBSOLETE @@ -2195,12 +2196,24 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { } | EXTRACTELEMENT ResolvedVal ',' ResolvedVal { if (!isa<PackedType>($2->getType())) - ThrowException("First operand of extractelement must be a " - "packed type val!"); + ThrowException("First operand of extractelement must be " + "packed type!"); if ($4->getType() != Type::UIntTy) - ThrowException("Second operand of extractelement must be a uint!"); + ThrowException("Second operand of extractelement must be uint!"); $$ = new ExtractElementInst($2, $4); } + | INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal { + if (!isa<PackedType>($2->getType())) + ThrowException("First operand of insertelement must be " + "packed type!"); + if ($4->getType() != + cast<PackedType>($2->getType())->getElementType()) + ThrowException("Second operand of insertelement must be " + "packed element type!"); + if ($6->getType() != Type::UIntTy) + ThrowException("Third operand of insertelement must be uint!"); + $$ = new InsertElementInst($2, $4, $6); + } | PHI_TOK PHIList { const Type *Ty = $2->front().first->getType(); if (!Ty->isFirstClassType()) |

