Hi,
I need to find out all the places where the value of a variable is being used. For this I have to implement reaching definitions(def-use chains).
When I searched for its implementation I found Iterating over def-use & use-def chains. will this work for finding the places where a variable is reaching?
I tried to use “use_iterator”, but couldn’t make it out. Is it a must to write LLVM Pass to use op_iterator and use_iterator?
please give me any references or examples to understand more about use_iterator.
Best Regards,Srikanth Vaindam
Hi,
I need to find out all the places where the value of a variable is being used.
you didn't define what you mean by a variable. LLVM has virtual registers which
are always in SSA form, and memory (such as created by an AllocaInst). By a
"variable" do you mean an SSA register, or do you mean a chunk of memory?
Ciao, Duncan.
Hi Duncan Sands,
I frankly don’t know what a variable gets converted to (SSA register or memory chunk). What I meant is, for example
I1: int i, j=10; I2: scanf(“%d”, &j); I3: i = j + 1;
Here I want to know whether the value of j in I1 reaches I3 or not.
Best Regards,Srikanth Vaindam
you didn’t define what you mean by a variable. LLVM has virtual registers which
are always in SSA form, and memory (such as created by an AllocaInst). By a
“variable” do you mean an SSA register, or do you mean a chunk of memory?
Ciao, Duncan.
Hi Srikanth Vaindam,
I frankly don't know what a variable gets converted to (SSA register or memory
chunk).
this is pretty important, so you would do well to know.
What I meant is, for example
I1: int i, j=10; I2: scanf("%d", &j); I3: i = j + 1;
Here I want to know whether the value of j in I1 reaches I3 or not.
In this case you are talking about a chunk of memory. Probably you are looking
for something like memdep (MemoryDependenceAnalysis.cpp).
Ciao, Duncan.