Global Variable Recall

Hi All,

I need to call global variable by its name from the following code

for(Function::iterator i=F->begin();i!=F->end();++i)
BasicBlock*Bb =&i;
GV = new GlobalVariable(type,false, F->getLinkage(),0, “F$”+Bb->getName());
GV->setInitializer(Constant::getNullValue (typ));

Could I solve that by mapping the global variables in Stringmap?

I need to identify the global variable with its name in the IR to be able to load and store its values.


If you know the name of the GlobalVariable that you want to find, you can use the Module::getGlobalVariable() method to get a pointer to it: – John T.