[LLVMdev] Statically Initialized Arrays

Evan Jones ejones at uwaterloo.ca
Wed Nov 2 14:02:07 PST 2005


On Nov 2, 2005, at 16:39, Chris Lattner wrote:
> 4. Replace the old GV with the new GV using code that looks like this:
>
>    OldGV->replaceAllUsesWith(ConstantExpr::getCast(NewGV, 
> OldGV->getType());
>    OldGV->eraseFromParent();
>
> At the end of this, any instructions or other globals that referenced 
> the temporary global will now reference the new one.

Ah ha! I was looking for something like this. Why didn't I see that 
there? I must be blind.

In a vaguely related node, why does Module::getGlobalVariable *not* 
return types with internal linkage? There must be some logic behind 
that choice that I can't figure out. It is easy to copy the code out of 
Module.cpp if you need to find variables with internal linkage, but it 
seems unnecessary to me.

Thanks,

Evan

--
Evan Jones
http://evanjones.ca/




More information about the llvm-dev mailing list