[LLVMdev] how to get and modify a global variable inside a module

Duncan Sands baldrick at free.fr
Wed Dec 5 05:15:57 PST 2012

On 05/12/12 12:07, Dong Chen wrote:
> recently, i use LLVM API to write a program to read *.ll and excute it
> automatically.
> Further more, i want to change some global variables inside a module.
> i tried some functions provided by Module.h and ExecutionEngine.h but none
> were seemed to match my need.
> did someone have the experience or some advices?
> thank you ;)

You can get hold of the global variable by passing it's name to
Module::getNamedValue.  For modification it depends on what kind of modification
you have in mind, so please clarify.

Ciao, Duncan.

More information about the llvm-dev mailing list