[LLVMdev] Getting the memory address of all operands on an expression

Duncan Sands baldrick at free.fr
Tue Jun 11 07:10:38 PDT 2013


Hi Abhinash,

On 10/06/13 23:05, Abhinash Jain wrote:
> How to get memory address of all operands which constitutes an expression ?

in LLVM IR, the operands of most expression are registers, so don't have a
memory address.  In short, you can't always succeed.  However in cases where
the operands do come from memory in a fairly direct way, you can find out what
the memory is using the GetUnderlyingObject or GetUnderlyingObjects methods.

Ciao, Duncan.

>
> eg. a=b+c; (want to know the memory address of b and c)...... Since I want
> this at run time, So at assembly level this expression will become something
> like as follows:-
>
> Load r1, M[b]
>
> Load r2, M[c]
>
> r3=r1+r2
>
> store M[a],r3
>
> Now what i want to do is that, at every store instruction, I should get the
> memory address of all the operands which have constituted that expression.
> i.e. when am about to store at M[a], so with the help of r3, I should get
> the memory address of b & c.
>
> Have already gone through some basics of "use-def" thing but being novice to
> LLVM, am not been able to write the pass for it. Hence need help on writing
> the pass for it.
>
>
>
>
> --
> View this message in context: http://llvm.1065342.n5.nabble.com/Getting-the-memory-address-of-all-operands-on-an-expression-tp58435.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
> _______________________________________________
> 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