[LLVMdev] Making Constants from GenericValues
Patrick Meredith
pmeredit at uiuc.edu
Mon Mar 7 19:17:24 PST 2005
I'm trying to turn some GenericValues into Constants in the interpreter
using code like this, in a switch statement:
case Type::IntTyID:
SI = ConstantSInt::get(FB->getType(), ArgVals[i].IntVal);
params.push_back(UI);
UI->dump(); //for testing
break;
FB is a Function::ArgumentListType::iterator
ArgVals is a std::vector<GenericValue>
the switch is on FB->getType()->getTypeID()
so basically what I am doing is iterating through the formal argument list
and using that to know how to convert the GenericValues
(on a side note I can't get it to create iterators for ArgVals, hence the
often n time operator[])
The dump() call causes a segfault and I can't figure out why. I looked at
the implementation of get and it is supposed to create the constant if it
does not already exist in the module, so I'm at a complete loss.
More information about the llvm-dev
mailing list