Reputation: 1324
Pointer type can be deduced through:
Value* v= i->getOperand(0);
.......
if(PointerType* pt=dyn_cast<PointerType>(v->getType())){
pt->getElementType()->getTypeID();
How can I read the value that this pointer points to?
I is a CallInst.
Upvotes: 0
Views: 697
Reputation: 26898
Given a CallInst
, you can get an argument via getArgOperand()
or iterate over all of them with arg_operands()
. The arguments you get this way are just Value
s, and you can do anything you can do with other Value
s on them.
In particular, if those Value
s are constants, you can get the actual values used in the compiler - see this related stackoverflow question: LLVM get constant integer back from Value*
Upvotes: 1