llvm's getelementptr instruction with array types

Posted by vava on Stack Overflow See other posts from Stack Overflow or by vava
Published on 2010-04-13T05:18:56Z Indexed on 2010/04/13 5:22 UTC
Read the original article Hit count: 531

Filed under:
|
|

I'm trying to use array type in llvm and can't get a hold of it yet. As far as I can understand from documentation, array should grow all by itself. But how does it happen, should I just getelementptr with whatever index I have and it'll grow so that index will still be in bounds? That's not what happens, I get all sorts of funny problems which hide away the moment I create array big enough to accommodate all my data.

So, should the following code work by itself or I have to call something else for array to increase it's size?

%stack = alloca [0 x i32]                       ; <[0 x i32]*>
%"stack[idx]" = getelementptr [0 x i32]* %stack, i32 0, i32 1 ; <i32*>

© Stack Overflow or respective owner

Related posts about llvm

Related posts about arrays