Hi,
I have been working towards generating my own IR code from llvm IR. I
have hit a stumbling block with respect to "getelementptr" used inside
another llvm instruction.
Example: %arrayidx = getelementptr inbounds i32* getelementptr
inbounds ([10 x i32]* @k, i32 0, i32 0), i32 %tmp2 ; <i32*> [#uses=1]
I am unable to get a handle on the second "getelementptr" in this instruction.
Can anyone plee let me know if I am missing something here?
Thanks
Arvind
Hi Arvind,
I have been working towards generating my own IR code from llvm IR. I
have hit a stumbling block with respect to "getelementptr" used inside
another llvm instruction.
Example: %arrayidx = getelementptr inbounds i32* getelementptr
inbounds ([10 x i32]* @k, i32 0, i32 0), i32 %tmp2 ; <i32*> [#uses=1]
I am unable to get a handle on the second "getelementptr" in this instruction.
I'm not sure what you are asking, but the inner getelementptr is a constant
(ConstantExpr), only constants turn up nested like this.
Ciao,
Duncan.
Hi,
I got the "getelementptr" issue solved...John Criswell helped
me...Thanks, Duncan, for your reply.
I have another query though. When I try to pass a structure into a
function in my C program, if there are less than four scalars in the
structure, the clang tool creates llvm code where the structure is
passed as sequence of scalars. If there are more than (or equal to)
four scalars, the clang tool creates llvm code that passes the
structure as it is.
Is there a way to force clang to generate code such that the structure
is always passed as it is?
I am looking into this as well...
Thanks a lot for all the help.
Sincerely
Arvind
Hi Arvind,
I have another query though. When I try to pass a structure into a
function in my C program, if there are less than four scalars in the
structure, the clang tool creates llvm code where the structure is
passed as sequence of scalars. If there are more than (or equal to)
four scalars, the clang tool creates llvm code that passes the
structure as it is.
Is there a way to force clang to generate code such that the structure
is always passed as it is?
most likely this is because the platform ABI requires this.
Ciao,
Duncan.
Hello
I have another query though. When I try to pass a structure into a
function in my C program, if there are less than four scalars in the
structure, the clang tool creates llvm code where the structure is
passed as sequence of scalars. If there are more than (or equal to)
four scalars, the clang tool creates llvm code that passes the
structure as it is.
Most probably this is due to ABI requirement.