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
On Fri, Dec 4, 2009 at 1:26 PM, Duncan Sands <baldrick at free.fr>
wrote:> 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.
>
--
Arvind Sudarsanam
Utah State University
Phone: (435) 512-7769
E-mail: theonemorpheus at gmail.com
Web-site: http://cc.usu.edu/~asudarsanam