[LLVMdev] need help understanding getelementptr assembler instruction

Ram Bhamidipaty rambham at gmail.com
Sun Nov 12 11:13:00 PST 2006


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



More information about the llvm-dev mailing list