search for: use_iterator

Displaying 20 results from an estimated 173 matches for "use_iterator".

2014 Sep 25
2
[LLVMdev] MachineRegisterInfo use_iterator/reg_iterator?
Hi folks, I would like to find out the machine instructions that use some given registers in the reverse order, and I came across these iterators (use_iterator/reg_iterator). However, there are two things I noticed: 1) These iterators seem to traverse the machine function a bit differently from what I get from the machine function dump. In other words, the use_iterator list is not constructed in the same order as the machine function? Maybe from the orde...
2014 Sep 25
2
[LLVMdev] MachineRegisterInfo use_iterator/reg_iterator?
Thanks Quentin. I'm trying to examine from the operands of the return instruction, and then to get the last assignment of those. I thought use_iterator/reg_iterator may suit better than just loop through the machine basicblock in the reverse order. Cheng-Chih On Thu, Sep 25, 2014 at 1:51 PM, Quentin Colombet <qcolombet at apple.com> wrote: > Hi Cheng-Chih, > > On Sep 25, 2014, at 9:14 AM, Yang, Cheng-Chih <Cheng-Chih.Yang at a...
2012 Apr 19
3
[LLVMdev] def-use chains and use-def chains
...to implement reaching definitions(def-use chains). When I searched for its implementation I found Iterating over def-use & use-def chains <http://llvm.org/docs/ProgrammersManual.html#iterate_chains>. will this work for finding the places where a variable is reaching? I tried to use "use_iterator", but couldn't make it out. Is it a must to write LLVM Pass to use op_iterator and use_iterator? please give me any references or examples to understand more about use_iterator. Best Regards, Srikanth Vaindam -------------- next part -------------- An HTML attachment was scrubbed... URL:...
2014 Aug 09
3
[LLVMdev] difference between replaceAllUsesWith and replaceUsesOfWith?
...loop, "*ui" is an llvm::Use object. It's owned by a > User, but isn't a subclass of one. To match the first loop, you either > need to call Value::user_begin instead of use_begin, or do the cast on > "ui->getUser()". > I think this is incorrect since the use_iterator is defined as: `typedef value_use_iterator<User> use_iterator;` and indeed `ui->getUser();` is not a callable function on a User. What am I missing? -Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachme...
2012 Apr 20
0
[LLVMdev] def-use chains and use-def chains
...efinitions(def-use chains). > When I searched for its implementation I found Iterating over def-use & > use-def chains<http://llvm.org/docs/ProgrammersManual.html#iterate_chains>. > will this work for finding the places where a variable is reaching? > > I tried to use "use_iterator", but couldn't make it out. Is it a must to > write LLVM Pass to use op_iterator and use_iterator? > please give me any references or examples to understand more about > use_iterator. > > > Best Regards, > Srikanth Vaindam > > > -------------- next part ------...
2007 Jul 12
2
[LLVMdev] BasicCallGraph patch
...include "llvm/Instructions.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()->getPa...
2009 Apr 14
0
[LLVMdev] InstVisitor Example
...ficient pass, which inherits from ModulePass, currently iterates through the Module, Functions, and BasicBlocks multiple times (once to find strcpy, another to find strcat, and so on for various other functions). If I only care about the direct calls, would I benefit more from switching to multiple use_iterators or the InstVisitor template? - Brice On Tue, Apr 14, 2009 at 1:13 PM, Luke Dalessandro <luked at cs.rochester.edu> wrote: > > On Apr 14, 2009, at 1:49 PM, Luke Dalessandro wrote: > > I guess I should note that the "use iteration" will only work for > direct calls....
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
2009 Apr 14
3
[LLVMdev] InstVisitor Example
...such thing. There are lots of ways to deal with this. Also, you might need to be smarter about the Instruction check if you expect ConstantExpr casts or any other such use of the declaration. Luke > > > Function* const strcpy = m.getFunction("strcpy"); > for (Value::use_iterator i = strcpy->use_begin(), e = strcpy- >> use_end(); i != e; ++i) > if (Instruction* const use = dyn_cast<Instruction>(i)) { > // Do what you need here > CallSite call(use); > ... > } > > If you want to know how to use InstVisitor for othe...
2015 Aug 17
4
Aggregate load/stores
Even if I turn to -O0 [in other words, no optimisation passes at all], it takes the same amount of time. The time is spent in 12.94% lacsap lacsap [.] llvm::SDNode::use_iterator::operator== 7.68% lacsap lacsap [.] llvm::SDNode::use_iterator::operator* 7.53% lacsap lacsap [.] llvm::SelectionDAG::ReplaceAllUsesOfValueWith 7.28% lacsap lacsap [.] llvm::SDNode::use_iterator::operator++ 5.59% lacsap lacsap...
2009 Oct 11
3
[LLVMdev] Some additions to the C bindings
...ribute had a bug in it. Here's the revised version of the > patch Hi Kenneth, Thanks for working on this. I have some additional comments: +/** See the llvm::Use class. */ +typedef struct LLVMOpaqueUse *LLVMUseRef; My understanding is that this actually conceptually corresponds to use_iterator, not Use. Please name this something like LLVMUseIterator. Also, please document this, not just referring to llvm::Use. +int LLVMHasInitializer(LLVMValueRef GlobalVar); LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar); Isn't LLVMHasInitializer just LLVMGetInitializer(x) != 0?...
2005 May 11
1
[LLVMdev] Computing live values
...> - The ./lib/Target/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 ph...
2007 Jul 17
0
[LLVMdev] BasicCallGraph patch
..." > # 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-...
2014 Aug 09
2
[LLVMdev] difference between replaceAllUsesWith and replaceUsesOfWith?
...i; Constant *GEP = ConstantExpr::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-...
2014 Aug 09
1
[LLVMdev] difference between replaceAllUsesWith and replaceUsesOfWith?
> I think this is incorrect since the use_iterator is defined as: > > `typedef value_use_iterator<User> use_iterator;` > > and indeed `ui->getUser();` is not a callable function on a User. What am I > missing? Ah, looks like this has changed this year. What I said applies to trunk; you may be right there about 3.4 or earlie...
2010 Jan 25
3
[LLVMdev] Deterministic iteration over llvm iterators
...more clearer, here is a 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...
2007 Jul 17
2
[LLVMdev] BasicCallGraph patch
...vm/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)) > > +...
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...
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...
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 'c...