Displaying 20 results from an estimated 159 matches for "use_begin".
2007 Jul 12
2
[LLVMdev] BasicCallGraph patch
...uctions.h"
#include "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())
+...
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
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
2016 Sep 24
4
RFC: ConstantData should not have use-lists
...the change).
See the WIP patch below (0003).
3. (Optional) Remove use-lists from other non-GlobalValue Constants
that do not reference any GlobalValues. This would require some
sort of magic in, e.g., ConstantVector to conditionally have a
use-list. Call sites of API like Value::use_begin would have to
check for Value::hasUseList.
4. (Optional) Remove the ref-count from ConstantData (and, potentially,
other use-list-free Constants). This would eliminate ref-count
traffic, but would also require checking at call sites before using
any use-list-related API.
Feedbac...
2005 May 11
1
[LLVMdev] Computing live values
...SparcV9/LiveVar/FunctionLiveVarInfo.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 bl...
2007 Jul 17
0
[LLVMdev] BasicCallGraph patch
...uot;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()->g...
2014 Mar 11
3
[LLVMdev] GlobalValues appear in their own use lists?
...=========================================
--- lib/IR/Verifier.cpp (revision 203523)
+++ 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...
2012 Jun 15
0
[LLVMdev] Post-RA Def/Use Information
...hat I'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
...ables (in the example 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...
2014 Aug 09
2
[LLVMdev] difference between replaceAllUsesWith and replaceUsesOfWith?
...stantExpr::getGetElementPtr(...);
GV->replaceAllUsesWith(GEP);
}
===========================
for (GlobalVariable **i = Globals.begin(), **e = Globals.end(); i != e;
++i) {
GlobalVariable *GV = *i;
Constant *GEP = ConstantExpr::getGetElementPtr(...);
for (Value::use_iterator ui = GV->use_begin(); ui != GV->use_end(); ++ui) {
if(User *u = dyn_cast < User > (*ui)) {
u->replaceUsesOfWith(GV, GEP);
}
}
===========================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/201408...
2010 Jan 25
3
[LLVMdev] Deterministic iteration over llvm iterators
...snippet of code that has 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 determ...
2007 Jul 17
2
[LLVMdev] BasicCallGraph patch
...ot;
> > @@ -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))
> > + getOrInsertFunct...
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...
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 cons...
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,
dy...
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
...t;<<*I1->getOperand(0)<<"\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.
S...
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...
2005 May 12
0
[LLVMdev] Computing live values
...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...