[LLVMdev] Get the value of a GlobalVariable
varun729 at gmail.com
Sun Jan 20 11:52:04 PST 2013
I am executing a C program using JIT. When the program exits, the control
comes back to my program which initiates the JIT. Now, I want to read
the value(not the LLVM nomenclature) of a global variable (not the LLVM
nomenclature). I am able to get the global variable, using the following
GlobalVariable *my_global = Mod->getNamedGlobal("MY_GLOBAL");
I want to know the value which was stored in this variable, I use the
following command, but it gives error:
APInt value = my_global->getValue();
*llvm::Constant::getSplatValue() const: Assertion
`this->getType()->isVectorTy() && "Only valid for vectors!"' failed.
I am new to LLVM, so a lot of nomenclature is still not very familiar to me
and I am trying to understand it as I go forward.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev