[LLVMdev] print the memory address computed by getelementptr

Jimborean Alexandra xinfinity_a at yahoo.com
Wed Jul 20 08:02:04 PDT 2011


I want to print the memory locations computed by getelementptr. As I understood, 
getelementptr does not access the memory, but it contains the address it 
computes. I want to print these addresses at runtime (or process them).  So, I 
try to build a function that takes as argument a pointer and prints its value. 
And to call this function, by sending the gep instruction as a parameter. 

Surely, I obtain an error for a type mismatch. Can I declare the function as 
taking an int64 as parameter and then (somehow) sending the value computed by 

declare void @myFunction ( i64 )

%tmp22 = getelementptr inbounds %struct.linked* %tmp21, i32 0, i32 1

%tmp = convert_tmp22_to_i64_to_get_the_value_of_the_pointer

call void @myFunction(i64 %tmp)

Or could you suggest a better method to get the value computed by getelementptr 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110720/e2f43389/attachment.html>

More information about the llvm-dev mailing list