[LLVMdev] Global variable-length array
Talin
viridia at gmail.com
Sat Apr 19 19:45:28 PDT 2008
Question about "Pascal-style" arrays as mentioned in the reference guide.
Suppose I have a global variable which points to a constant, variable
length array.
The question is, how can I assign an array of type "{ i32, [5 x float]}"
to a global of type "{ i32, [0 x float]}"? From my experimentation, it
appears you can't bitcast or call GEP on a constant aggregate - the only
I know of to get the address of a constant is to create a global, but I
need the address to create the global.
The only way that I can think of to do it is to have two globals - an
anonymous global which is of the same type as the actual array constant,
and a second global which is assigned the bitcast of the GEP of the
first global. However, this seems overly complicated - is there an
easier way to do it?
-- Talin
More information about the llvm-dev
mailing list