[LLVMdev] how to get and modify a local variable's value through executionEngine?

Óscar Fuentes ofv at wanadoo.es
Mon Dec 10 04:23:31 PST 2012


Dong Chen <jameschennerd at gmail.com> writes:

> hello Óscar Fuentes,
> thanks for your reply, if i use the API provided by parser.h and the program
> *.ll i parsed contains local variable, i can get a module have local
> variable without defines it first.
> i think that module is a structure like AST(i am not sure whether i was
> right), this must be a traversal method. am i right or do i misunderstand
> something?

Yes, you can traverse the functions and the basic blocks inside those
functions, but how do you detect a local variable? LLVM IR is in SSA
form plus memory loads/stores. A local variable, as you see it in the
original source code (C, C++ or other language) might not clearly map to
a local variable in LLVM IR, depending on how you generate the IR and/or
the passes you run on it.




More information about the llvm-dev mailing list