[LLVMdev] need help understanding getelementptr assembler instruction

Eric van Riet Paap eric at vanrietpaap.nl
Mon Nov 13 00:51:45 PST 2006


On Nov 13, 2006, at 9:01 AM, Reid Spencer wrote:

> On Mon, 2006-11-13 at 01:10 -0800, Chris Lattner wrote:
>> On Mon, 13 Nov 2006, Eric van Riet Paap wrote:
>>> I must say I also was in need of this document but never knew it
>>> existed. It seems to be linked from the faq page only. I only read
>>> that the first day I came to LLVM. Maybe linking it from the
>>> GetElementPtr instruction in LangRef.html would make sense.
>>
>> That makes a tremendous amount of sense to me!
>
> It's already there. Go to the bottom of the GEP instruction definition
> in LangRef.html and you will find it.  I'm going to add it to the  
> index
> page too.

You are right, sorry, I must have missed it a million times then. :-)  
or maybe it was added in the last year or so?

Eric

>
> Reid.
>
>>
>> -Chris
>>
>>> On Nov 12, 2006, at 8:47 PM, Reid Spencer wrote:
>>>
>>>> Ram,
>>>>
>>>> Please read and understand the GetElementPtr FAQ available here:
>>>>
>>>> http://llvm.org/docs/GetElementPtr.html
>>>>
>>>> That will help you understand how it works. We wrote that document
>>>> specifically because this question comes up all the time.
>>>>
>>>> Reid.
>>>>
>>>> On Sun, 2006-11-12 at 11:13 -0800, Ram Bhamidipaty wrote:
>>>>> I am trying to understand the hello word assember example. This is
>>>>> my version:
>>>>>
>>>>> %str1 = internal constant [13 x sbyte] c"Hello World\0a\00"
>>>>>
>>>>> declare int %printf(sbyte*, ...)
>>>>>
>>>>> implementation   ; Functions:
>>>>>
>>>>> int %main() {
>>>>>   %str2 = getelementptr [13 x sbyte]* %str1, long 0, long 0
>>>>>   call int(sbyte*, ...) *%printf(sbyte* %str2)
>>>>>   ret int 0
>>>>> }
>>>>>
>>>>> Why is getelementptr being given two "long 0" indices?
>>>>>
>>>>> Thanks for any help.
>>>>> -Ram
>>>>> _______________________________________________
>>>>> LLVM Developers mailing list
>>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>
>> -Chris
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list