[LLVMdev] question-TUD, germany

Andrew Lenharth alenhar2 at uiuc.edu
Wed Feb 15 08:55:02 PST 2006


On Wed, 2006-02-15 at 04:29, anubham suresh wrote:
> hi everyone,
> here i have a question:
> is there any chance in llvm intermediate
> representation to compare whether a operand (ie a
> value) is used as a user  without iterating over all
> the instructions in a basic block.
> i will explain this with an example:
> i=p+4;
> j=i+p;
> 
> in the above example i mean p,4,i,p which are on the
> RHS are operands and the terms i,j which are on the
> LHS are users.
> 
> so what i mean is:
> is there any chance to find whether a value is used as
> an user whithin the instructions of a basic block
> without iterating over all the instructions and
> (variables in instructions) in that block.

You can iterate over the uses of a value by using the iterator returned
by Value::use_begin.  Then you simply check whether the use is an
instruction and if so if the instruction's parent is the same parent as
the value you are interested in.

Andrew

> 
> 
> 
> Anubham Suresh 
> Measurement and Instrumentation
> Electrical Department
> IIT Roorkee
> Current location:Darmstadt, Germany
> mobile: +49-1762-3924878
> 
> 
> 		
> __________________________________________________________ 
> Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.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