Parse shufflevector

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27511 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-04-08 01:18:35 +00:00
parent 00f1023cf8
commit 4c94908b64
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())