Displaying 2 results from an estimated 2 matches for "arr_dataptr_addr".
2008 Jul 17
3
[LLVMdev] allocating an array
> 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.
2008 Jul 22
0
[LLVMdev] allocating an array
...* %size
%x = alloca { i32, i32* } ; <{ i32, i32* }*> [#uses=6]
load i32* %size ; <i32>:1 [#uses=1]
getelementptr { i32, i32* }* %x, i32 0, i32 0 ; <i32*>:2 [#uses=1]
store i32 %1, i32* %2
%arr_storage = alloca i32, i32 %1 ; <i32*> [#uses=1]
%arr_dataptr_addr = getelementptr { i32, i32* }* %x, i32 0, i32 1 ;
<i32**> [#uses=1]
store i32* %arr_storage, i32** %arr_dataptr_addr
(did some manual optimizations on this code, as my front end generates
really dumb code)
So I need two allocas now, one for the structure and one for the
storage of the eleme...