[LLVMdev] allocating an array

Duncan Sands baldrick at free.fr
Wed Jul 16 18:01:19 PDT 2008


> if the length is %n, you can alloca %n i8's:
>   %x = alloca i8, i32 %n

If the array element type is i32 (like the size
field), then you may as well use an alloca i32;
if you use an alloca i8 then you would have to
use 4*%n rather than %n in order to get the right
amount of memory.

Ciao,

Duncan.



More information about the llvm-dev mailing list