[LLVMdev] Global variable-length array

Chris Lattner sabre at nondot.org
Sat Apr 19 21:34:08 PDT 2008


On Apr 19, 2008, at 9:29 PM, Talin wrote:
> So in other words, we need the declared type of the TIB to be  
> different
> than the type of it's initializer. Since you can't put a bitcast
> in-between the global and its initializer, the only way that I can  
> think
> of to do this is to declare two globals, one for the externally  
> visible
> type, and one for the initializer type.

As Gordon mentioned, you should define and initialize the global  
variable with its actual type, and any use of it should use the global  
variable bitcast to the pointer you want.

This is what my example was showing.  The initializer for the G global  
is a bitcast version of F's address.

-Chris



More information about the llvm-dev mailing list