John,
Thanks, this would work. But we are interested in obtaining the instruction
that defines/allocates the value of interest. Once we obtain that we can use
LoopInfo pass to check whether the basic block containing that definition
instruction belongs to the loop in question. Is there a method that returns
the defining instruction?
Thanks,
Adarsh
On Mon, Apr 19, 2010 at 10:05 AM, John Criswell <criswell at uiuc.edu>
wrote:
> Rohith Goparaju wrote:
> > Hi ,
> >
> > I'm working on a project in which i need to find out all free
> > variables in a loop. I need to find all variables used inside a loop
> > and that are not declared(allocated) in the loop. I'm confused
about
> > what symbol tables to use to get hold of such variables.
>
> When you say "variables," are you talking about LLVM virtual
registers
> or memory allocated by the alloca instruction?
>
> Assuming the former, LLVM virtual registers are in SSA form, meaning
> that they are defined only once and that the virtual register
> representing the value and the instruction that generates that value are
> synonymous. If you want to see if an SSA value is defined within a
> loop, you would use the LoopInfo pass to determine if the basic block
> containing the instruction defining the value of interest belongs to
> the loop that interests you.
>
> Information on LoopInfo can be found at
> http://llvm.org/doxygen/classllvm_1_1LoopInfo.html.
>
> -- John T.
>
> >
> > Thanks,
> > Rohith.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Adarsh Yoga
Graduate Student, Computer Science
Indiana University, Bloomington
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20100419/0fb25b8a/attachment.html>