[LLVMdev] Mutating the elements of a ConstantArray
Chris Lattner
clattner at apple.com
Tue Mar 31 16:49:13 PDT 2009
On Mar 31, 2009, at 4:42 PM, Nick Johnson wrote:
> Hello,
>
> I need to append something to the global "llvm.global_ctors". This
> variable may or may not already be declared within the current module.
>
> If I lookup the global variable, I see that it supports a
> getOperand(i) and setOperand(i,c), but does not support any way that I
> can enlarge that array to add a new record.
Hi Nick,
You actually have to create a new ConstantArray with the desired
elements, then remove the existing llvm.global_ctors constand and
create a new one to replace it.
Take a look at the GlobalOpt pass for examples of how to do this sort
of thing.
-Chris
More information about the llvm-dev
mailing list