Parse shufflevector

llvm-svn: 27511
This commit is contained in:
Chris Lattner 2006-04-08 01:18:35 +00:00
parent 14b19acd56
commit 97a47d4c9c
2 changed files with 7 additions and 1 deletions

View File

@ -277,6 +277,7 @@ getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
extractelement { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
insertelement { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
shufflevector { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
{VarID} {

View File

@ -998,7 +998,7 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
// Other Operators
%type <OtherOpVal> ShiftOps
%token <OtherOpVal> PHI_TOK CAST SELECT SHL SHR VAARG
%token <OtherOpVal> EXTRACTELEMENT INSERTELEMENT
%token <OtherOpVal> EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR
%token VAARG_old VANEXT_old //OBSOLETE
@ -2260,6 +2260,11 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
ThrowException("Third operand of insertelement must be uint!");
$$ = new InsertElementInst($2, $4, $6);
}
| SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal {
if (!ShuffleVectorInst::isValidOperands($2, $4, $6))
ThrowException("Invalid shufflevector operands!");
$$ = new ShuffleVectorInst($2, $4, $6);
}
| PHI_TOK PHIList {
const Type *Ty = $2->front().first->getType();
if (!Ty->isFirstClassType())