[LLVMdev] How to get the exact integer from a Value

weixuegong weixuegong at gmail.com
Thu Sep 5 19:32:18 PDT 2013


Hi,all
I have a Value* type named indexValue, and the type is i32.
I think "indexValue" must hold a number which type is int.
Now I want to use the exact number which pointed by indexValue , so I do
like this:

ConstantInt* CI = llvm::cast<llvm::ConstantInt>(indexValue); //This is
wrong, so is dyn_cast.
uint64_t index = indexValue->getZExtValue();
uint64_t size = index + 1;


I don't know if it is the right way.
So, could anybody tell the way to get the integer content from a Value*
which type is i32?

I'll be very very grateful if there is any answer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130906/84ad0bf0/attachment.html>


More information about the llvm-dev mailing list