Value *ValueVal;
list<MethodArgument*> *MethodArgList;
- list<Value*> *ValueList;
+ vector<Value*> *ValueList;
list<PATypeHolder<Type> > *TypeList;
list<pair<Value*, BasicBlock*> > *PHIList; // Represent the RHS of PHI node
list<pair<ConstPoolVal*, BasicBlock*> > *JumpTable;
%type <TermInstVal> BBTerminatorInst
%type <InstVal> Inst InstVal MemoryInst
%type <ConstVal> ConstVal
-%type <ConstVector> ConstVector UByteList
+%type <ConstVector> ConstVector
%type <MethodArgList> ArgList ArgListH
%type <MethArgVal> ArgVal
%type <PHIList> PHIList
%type <ValueList> ValueRefList ValueRefListE // For call param lists
+%type <ValueList> IndexList // For GEP derived indices
%type <TypeList> TypeListI ArgTypeListI
%type <JumpTable> JumpTable
%type <BoolVal> GlobalType // GLOBAL or CONSTANT?
// Pull out the types of all of the arguments...
vector<const Type*> ParamTypes;
if ($5) {
- for (list<Value*>::iterator I = $5->begin(), E = $5->end(); I != E; ++I)
+ for (vector<Value*>::iterator I = $5->begin(), E = $5->end(); I!=E; ++I)
ParamTypes.push_back((*I)->getType());
}
//
MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
MethodType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
- list<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
+ vector<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
if ((*ArgI)->getType() != *I)
if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
ThrowException("Invalid number of parameters detected!");
- $$ = new InvokeInst(V, Normal, Except,
- vector<Value*>($5->begin(), $5->end()));
+ $$ = new InvokeInst(V, Normal, Except, *$5);
}
delete $5;
}
ValueRefList : ResolvedVal { // Used for call statements, and memory insts...
- $$ = new list<Value*>();
+ $$ = new vector<Value*>();
$$->push_back($1);
}
| ValueRefList ',' ResolvedVal {
// Pull out the types of all of the arguments...
vector<const Type*> ParamTypes;
if ($5) {
- for (list<Value*>::iterator I = $5->begin(), E = $5->end(); I != E; ++I)
+ for (vector<Value*>::iterator I = $5->begin(), E = $5->end(); I!=E; ++I)
ParamTypes.push_back((*I)->getType());
}
//
MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin();
MethodType::ParamTypes::const_iterator E = Ty->getParamTypes().end();
- list<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
+ vector<Value*>::iterator ArgI = $5->begin(), ArgE = $5->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
if ((*ArgI)->getType() != *I)
if (I != E || (ArgI != ArgE && !Ty->isVarArg()))
ThrowException("Invalid number of parameters detected!");
- $$ = new CallInst(V, vector<Value*>($5->begin(), $5->end()));
+ $$ = new CallInst(V, *$5);
}
delete $5;
}
$$ = $1;
}
-// UByteList - List of ubyte values for load and store instructions
-UByteList : ',' ConstVector {
+
+// IndexList - List of indices for GEP based instructions...
+IndexList : ',' ValueRefList {
$$ = $2;
} | /* empty */ {
- $$ = new vector<ConstPoolVal*>();
+ $$ = new vector<Value*>();
}
MemoryInst : MALLOC Types {
$$ = new FreeInst($2);
}
- | LOAD Types ValueRef UByteList {
+ | LOAD Types ValueRef IndexList {
if (!(*$2)->isPointerType())
ThrowException("Can't load from nonpointer type: " +
(*$2)->getDescription());
delete $4; // Free the vector...
delete $2;
}
- | STORE ResolvedVal ',' Types ValueRef UByteList {
+ | STORE ResolvedVal ',' Types ValueRef IndexList {
if (!(*$4)->isPointerType())
ThrowException("Can't store to a nonpointer type: " + (*$4)->getName());
const Type *ElTy = StoreInst::getIndexedType(*$4, *$6);
$$ = new StoreInst($2, getVal(*$4, $5), *$6);
delete $4; delete $6;
}
- | GETELEMENTPTR Types ValueRef UByteList {
+ | GETELEMENTPTR Types ValueRef IndexList {
if (!(*$2)->isPointerType())
ThrowException("getelementptr insn requires pointer operand!");
if (!GetElementPtrInst::getIndexedType(*$2, *$4, true))