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.
Anubham Suresh
Measurement and Instrumentation
Electrical Department
IIT Roorkee
Current location:Darmstadt, Germany
mobile: +49-1762-3924878
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
Andrew is right. Here are some more details:
http://llvm.cs.uiuc.edu/docs/ProgrammersManual.html#iterate_chains
The programmer's manual has a lot of good information: it's worth a skim for anyone working with LLVM that hasn't done so yet.
-Chris