[LLVMdev] Passing String to an external function in llvm

Abhinash Jain omnia at mailinator.com
Thu Jul 25 11:07:09 PDT 2013


Thanx for the response.

 %x = alloca i32, align 4
 %y = alloca i32, align 4
 %a = alloca i32, align 4
 %t = alloca i32, align 4

1. %10 = load i32* %x, align 4
2. %11 = load i32* %y, align 4
3. %div = sdiv i32 %10, %11
4. %12 = load i32* %a, align 4
5. %mul4 = mul nsw i32 %div, %12

6. store i32 %mul4, i32* %t, align 4
a.		  %mul4 = mul nsw i32 %div, %12
b.		  %div = sdiv i32 %10, %11
c.		  %10 = load i32* %x, align 4
d.		  %11 = load i32* %y, align 4
e.		  %12 = load i32* %a, align 4

This is a IR of       " t = x/y*a " 
The address of the "%x, %y, %a" are "0xbe4ab94, 0xbe4abd4, 0xbe4ac54" 
respectively.
and the opcode of "*, /" are "12, 15" respectively.

Point (6.a to 6.e)  are the result of use-def chain, with the help of which
I managed to make a string as -

"12_15_0xbe4ab94_0xbe4abd4_0xbe4ac54" (by converting getOpcode() and
getOperand() to string and than concatenating it)

Now I want to pass this whole string to some other external function, How
can I do this? 

If you want I can show you the full code.



--
View this message in context: http://llvm.1065342.n5.nabble.com/Passing-String-to-an-external-function-in-llvm-tp59798p59807.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list