Displaying 20 results from an estimated 137 matches for "use_end".
2007 Jul 12
2
[LLVMdev] BasicCallGraph patch
...e "llvm/Support/CallSite.h"
@@ -150,6 +151,19 @@
->addCalledFunction(CS, Node);
else
isUsedExternally = true;
+ } else if (ConstantExpr* CE = dyn_cast<ConstantExpr>(*I)) {
+ for (Value::use_iterator I = CE->use_begin(), E = CE->use_end();
+ I != E; ++I)
+ if (Instruction* Inst = dyn_cast<Instruction>(*I)) {
+ CallSite CS = CallSite::get(Inst);
+ if (isOnlyADirectCall(F, CS))
+ getOrInsertFunction(Inst->getParent()->getParent())
+ ->addCalledFunc...
2005 May 11
3
[LLVMdev] Computing live values
Say I want to find all LLVM Value*-es that a live on exit from a basic block.
What's the best way?
- The 'LiveRange', 'LiveVariables' and 'LiveIntervals' classes seem to be tied
to register allocation.
- The ./lib/Target/SparcV9/LiveVar/FunctionLiveVarInfo.h file seem to provide
what I need, but it's no a public header.
- Volodya
2011 Dec 09
1
[LLVMdev] Finding the uses of a global variable
...o
find the uses of strings, and strings are defined as global variables). So,
I can iterate over global vars by
for(Module::global_iterator gi = M.global_begin(), gend = M.global_end();
gi != gend; ++gi) ......
But if I use its def-use chain
for(Value::use_iterator i = gi->use_begin(), e = F->use_end; i!=e; ++i)
it is not actually able to find its uses, as it gives <null> instructions!
I have even tried to iterate over instructions in the module, then find the
use-def of each instruction
for(User::op_iterator I = theInstruction->op_begin(),
E=theInstruction->op_end(); I!=E; ++I)
Aft...
2013 Jan 08
4
[LLVMdev] get ref to parent instruction
Hi all,
How can I get a reference to an instruction if I have a reference to
an operand? For example, let suppose I have a reference to the
ConstantExpr "getelementptr inbounds" in the following instruction:
%4 = getelementptr i32* getelementptr inbounds ([8 x i32]*
@__mem_grid_MOD_nnyp, i32 0, i32 0), i32 %3
then, how can I get a reference to the GetElementPtrInst object?
The
2005 May 11
1
[LLVMdev] Computing live values
...nLiveVarInfo.h file seem to provide
>>> what I need, but it's no a public header.
>>
>> This is overkill. I would suggest something like this:
>>
>> bool LiveOutsideOfBlock(Instruction *I) {
>> for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI)
>> if (cast<Instruction>(*UI))->getParent() != I->getParent()) return true;
>> return false;
>> }
>
> Is this really going to work? What if the value is used in a loop and it
> is used by a phi-node in the same block it is defined?
G...
2007 Jul 17
0
[LLVMdev] BasicCallGraph patch
...e.h"
> @@ -150,6 +151,19 @@
> -> addCalledFunction(CS, Node);
> else
> isUsedExternally = true;
> + } else if (ConstantExpr* CE = dyn_cast<ConstantExpr>(*I)) {
> + for (Value::use_iterator I = CE->use_begin(), E = CE->use_end();
> + I != E; ++I)
> + if (Instruction* Inst = dyn_cast<Instruction>(*I)) {
> + CallSite CS = CallSite::get(Inst);
> + if (isOnlyADirectCall(F, CS))
> + getOrInsertFunction(Inst->getParent()->getParent())
> +...
2010 Mar 01
2
[LLVMdev] Possible SelectionDAG Bug
...k the same thing the added asserts check?
What I'm seeing is a problem in ReplaceAllUsesOf itself. It recurses
down and eventually replaces the node under the iterator in this use
loop:
SDNode::use_iterator UI = From.getNode()->use_begin(),
UE = From.getNode()->use_end();
while (UI != UE) {
SDNode *User = *UI;
bool UserRemovedFromCSEMaps = false;
UI goes bad and we blow up after returning from a deeply recursed call.
It's simply not safe to iterate over a set that may change. Unfortunately,
any of the nodes under the iterators may change so I do...
2012 Jun 15
0
[LLVMdev] Post-RA Def/Use Information
...ve missed? If not,
> is there a better way to find all uses of a defined value post register
> allocation? Writing a def/use chain pass would not be hard but if the
> information is already there I'd rather avoid that cost. :)
Do the MachineRegisterInfo::def_begin/def_end/use_begin/use_end iterators not work on physical registers?
--Owen
2013 Jan 08
0
[LLVMdev] get ref to parent instruction
...above the
> __mem_grid_MOD_nnyp variable). The problem is that for the example I
> showed the actual user of the variable is a ConstantExpr object and
> not the GetElementPtrInst object.
You can traverse the User's of a Value with the iterators returned by
Value::use_begin and Value::use_end methods.
2013 Jan 09
1
[LLVMdev] get ref to parent instruction
Hi Oscar:
In instructions like the one I showed can I expect that Value::use_begin
and Value::use_end will return only the getelementptr or there is a chance
I will get other users of that constant?
Thanks a lot,
Eduardo
On Jan 8, 2013 9:39 PM, "Óscar Fuentes" <ofv at wanadoo.es> wrote:
> Eduardo <erocha.ssa at gmail.com> writes:
>
> > How can I get a reference to...
2010 Jan 25
3
[LLVMdev] Deterministic iteration over llvm iterators
...as Values
reordered each time I analyze a particular piece of code(which doesn't
change) with the LLVM opt tool and my LLVM pass.
void Anders::id_gep_ce(Value *G){
assert(G);
//Check all GEP and bitcast ConstantExpr's using G.
for(Value::use_iterator it= G->use_begin(), ie= G->use_end(); it != ie;
++it){
ConstantExpr *E= dyn_cast<ConstantExpr>(*it);
do_something_with(E);
}
i.e. use_begin() and use_end() still works correctly such that iterates
through all the uses of G but the uses themselves are reordered. My question
is whether I can deterministically iterate t...
2010 Mar 01
0
[LLVMdev] Possible SelectionDAG Bug
...memory.
>
> What I'm seeing is a problem in ReplaceAllUsesOf itself. It recurses
> down and eventually replaces the node under the iterator in this use
> loop:
>
> SDNode::use_iterator UI = From.getNode()->use_begin(),
> UE = From.getNode()->use_end();
> while (UI != UE) {
> SDNode *User = *UI;
> bool UserRemovedFromCSEMaps = false;
>
>
> UI goes bad and we blow up after returning from a deeply recursed call.
>
> It's simply not safe to iterate over a set that may change. Unfortunately,
> any of the no...
2007 Jul 17
2
[LLVMdev] BasicCallGraph patch
...19 @@
> > -> addCalledFunction(CS, Node);
> > else
> > isUsedExternally = true;
> > + } else if (ConstantExpr* CE = dyn_cast<ConstantExpr>(*I)) {
> > + for (Value::use_iterator I = CE->use_begin(), E =
> CE->use_end();
> > + I != E; ++I)
> > + if (Instruction* Inst = dyn_cast<Instruction>(*I)) {
> > + CallSite CS = CallSite::get(Inst);
> > + if (isOnlyADirectCall(F, CS))
> > + getOrInsertFunction(Inst->getParent()-&g...
2009 Jul 17
2
[LLVMdev] Bug in LiveIntervals? Please Examine
In LiveIntervals::processImplicitDefs() we have this:
for (MachineRegisterInfo::use_iterator UI = mri_->use_begin(Reg),
UE = mri_->use_end(); UI != UE; ) {
MachineOperand &RMO = UI.getOperand();
MachineInstr *RMI = &*UI;
++UI;
MachineBasicBlock *RMBB = RMI->getParent();
if (RMBB == MBB)
continue;
const TargetRegisterClass* RC = mri_->getRegClass(Reg);
unsi...
2008 Dec 05
1
[LLVMdev] replacing a global variable by a constant
Thanks a lot for your help Matthijs! :)
basically this does the job quite nicely I think:
for (llvm::GlobalVariable::use_iterator U = gv->use_begin(); U !=
gv->use_end(); ++U) {
llvm::Instruction *I = llvm::cast<llvm::Instruction>(U);
I->replaceAllUsesWith(constPtr);
I->eraseFromParent();
}
Cheers,
Ralf
Matthijs Kooijman wrote:
> Hi Ralf,
>
>
>> I am trying to replace a global variable with a constant.
>>
>...
2009 Apr 21
4
[LLVMdev] Iterating over all uses of a Function
Hi,
I try to iterate over all uses of a Function with the following
code (simplified):
for (Value::use_iterator UI = F->use_begin(), UE = F->use_end();
UI != UE; ++UI) {
if (CallInst* I = dyn_cast<CallInst>(*UI)) {
// do something interesting
}
}
This works on Linux, but on Windows the dyn_cast fails, even
though the only use of F in that module is a 'call'. However,
dyn_cast<Instruction&...
2012 Jun 15
3
[LLVMdev] Post-RA Def/Use Information
Looking through TOT sources, I don't see anything that would provide
def/use chains (or equivalent information) post register allocation. I
would like to write some peeps to clean up various target-specific
things but for safety I will need such information.
Is such an analysis pass available somewhere that I've missed? If not,
is there a better way to find all uses of a defined value
2013 Jan 11
3
[LLVMdev] llvm get Value* iterators
...quot;\n";
//printed : %3 = load i32* %c, align 4
Printed as expected. But I want to use %c. Do you know how I can get %c ? I
need to use the value %c in some computations.
First, I tried
for (llvm::Value::use_iterator VI=(*I1->getOperand(0)).use_begin(),
VE=(*I1->getOperand(0)).use_end(); VI != VE ; ++VI)
{
errs()<<"\n "<<**VI<<" \n";
//printed : %cmp3 = icmp ne i32 %3, 0
}
But it is not getting Value* fields. Also, it is printing only one VI per
for, so VI cannot increment.
Second, it is a solution of taking the...
2014 Mar 10
2
[LLVMdev] GlobalValues appear in their own use lists?
...====================
--- lib/IR/Verifier.cpp (revision 203468)
+++ lib/IR/Verifier.cpp (working copy)
@@ -360,6 +360,11 @@
"Global is external, but doesn't have external or weak linkage!",
&GV);
+ for (Value::const_use_iterator UI = GV.use_begin(), UE = GV.use_end();
+ UI != UE; ++UI) {
+ Assert1(*UI != &GV, "Global values cannot be their own uses!", &GV);
+ }
+
Assert1(!GV.hasAppendingLinkage() || isa<GlobalVariable>(GV),
"Only global variables can have appending linkage!", &GV);
–
Is it ever rea...
2005 May 12
0
[LLVMdev] Computing live values
...to provide
>>>> what I need, but it's no a public header.
>>>
>>> This is overkill. I would suggest something like this:
>>>
>>> bool LiveOutsideOfBlock(Instruction *I) {
>>> for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
>>> UI != E; ++UI)
>>> if (cast<Instruction>(*UI))->getParent() != I->getParent())
>>> return true;
>>> return false;
>>> }
>>
>> Is this really going to work? What if the value is used in a loop and
>> it
>...