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 <http://llvm.org/docs/ProgrammersManual.html#iterate_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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120419/a5ee85ed/attachment.html>
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.> 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 <http://llvm.org/docs/ProgrammersManual.html#iterate_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 > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
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. On Thu, Apr 19, 2012 at 11:35 AM, srikanth vaindam < srikanth.vaindam at gmail.com> wrote:> 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<http://llvm.org/docs/ProgrammersManual.html#iterate_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 > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120420/7907ea95/attachment.html>
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.> > > 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. > > > On Thu, Apr 19, 2012 at 11:35 AM, srikanth vaindam <srikanth.vaindam at gmail.com > <mailto:srikanth.vaindam at gmail.com>> wrote: > > 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 <http://llvm.org/docs/ProgrammersManual.html#iterate_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 > > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev