search for: inst_end

Displaying 20 results from an estimated 69 matches for "inst_end".

2004 Apr 23
0
[LLVMdev] subtle problem with inst_iterator
...be too disturbing > for other code. I think it's the most correct and consistent want to do it. > > The reason why we have it return pointers right now is to populate > > worklists, which allows us to do: > > > > std::set<Instruction*> WorkList(inst_begin(F), inst_end(F)); > > Maybe this can be rewritten like; > > std::set<Instruction*> WorkList; > std::transform(insn_begin(F), insn_end(F), > inserter(WorkList, WorkList.begin(), take_address); > > given proper definition of take_addres. Or maybe manual initialization will &...
2015 Jun 10
3
[LLVMdev] The use iterator not working...
...with the use iterator. Each "use" that I see, when using the use_iterator, is the same as the "def". Meaning, in the code below the pDef is always equal to pUse pointer for every instruction in all basic blocks (except terminators). for (auto i = inst_begin(f), ie = inst_end(f); i != ie; ++i) Instruction* pDef = &(*i); errs() << "Def: " << *pDef << "\n"; for (auto ui = pDef->use_begin(), uie = pDef->use_end(); ui != uie; ++ui) { Instruct...
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
...as standard ilist iterators. Yes, I though about this appoach as well but decided it can be too disturbing for other code. > The reason why we have it return pointers right now is to populate > worklists, which allows us to do: > > std::set<Instruction*> WorkList(inst_begin(F), inst_end(F)); Maybe this can be rewritten like; std::set<Instruction*> WorkList; std::transform(insn_begin(F), insn_end(F), inserter(WorkList, WorkList.begin(), take_address); given proper definition of take_addres. Or maybe manual initialization will okay. So, if you think making inst...
2011 Aug 29
4
[LLVMdev] insertions with inst_iterators?
...may or may not insert code. Despite the fact that I'm only actually inserting *before* instruction I have a infinite loop when I do something like below. For awhile it was simple enough to just increment i enough times but now I need something better. for(inst_iterator i = inst_begin(F); i != inst_end(F); ++i) {         ...        // possible insertions of unknown size         ... } I tried storing the storing the initial iterator and reverting back to it(along with storing the next element) and I am still left with a infinite loop. I see some discussion online about weather insertions with it...
2011 Aug 29
0
[LLVMdev] insertions with inst_iterators?
...de. Despite the fact that I'm > only actually inserting *before* instruction I have a infinite loop > when I do something like below. For awhile it was simple enough to > just increment i enough times but now I need something better. > > for(inst_iterator i = inst_begin(F); i != inst_end(F); ++i) { > ... > // possible insertions of unknown size > ... > } > > I tried storing the storing the initial iterator and reverting back to > it(along with storing the next element) and I am still left with a > infinite loop. I see some discussion...
2015 Jun 10
4
[LLVMdev] The use iterator not working...
...hat I see, when >> using the use_iterator, is the same as the "def". Meaning, in the code >> below the pDef is always equal to pUse pointer for every instruction in >> all basic blocks (except terminators). >> >> for (auto i = inst_begin(f), ie = inst_end(f); i != ie; ++i) >> Instruction* pDef = &(*i); >> errs() << "Def: " << *pDef << "\n"; >> >> for (auto ui = pDef->use_begin(), uie = >> pDef->use_end(); ui != uie; ++ui)...
2018 Aug 08
2
Error Calling eraseFromParent()
Hi. Thanks. I changed the code but the problem exists. This is my new code which is again very simple: ... bool runOnFunction(Function &F) override { vector<Instruction *> dels; dels.clear(); for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) { Instruction *I = &*(It++); if (auto* op = dyn_cast<BinaryOperator>(I)) { IRBuilder<NoFolder> builder(op); Value* lhs = op->getOperand(0); Value* rhs = op->getOperand(1); Value* mul = builder.CreateMul(lhs, rhs); for (auto& U : op->uses()) { Us...
2011 Aug 23
2
[LLVMdev] write IR on file
hi how can i write IRinstruction on a file.txt? when i use  {for(inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I,count++)  IRcodefile << std::basic_ostream(*I) <<"\n" } i get  error. is there any way that i can write it on file? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110823...
2013 Sep 24
2
[LLVMdev] get the address in memory where an instruction lives
Hi, i want to get the address in memory of an instruction pointer and use it as a key in my tables. i iterate over the instructions in LLVM IR like this: for (Module::iterator fi = Mod->begin(), fi_end = Mod->end(); fi != fi_end; ++fi) { for (inst_iterator I = inst_begin(fi), E = inst_end(fi); I != E; ++I) { Instruction *ii = dyn_cast<Instruction>(&*I); errs() << &ii << "\n"; } but i get the same address for every instruction, eg 0xbfc979fc Why is this happening and how can i get the rigth address? Thanks, Eirini ----...
2018 Aug 08
3
Error Calling eraseFromParent()
...gt; > Hi. Thanks. I changed the code but the problem exists. This is my new code > which is again very simple: > ... > bool runOnFunction(Function &F) override { > > vector<Instruction *> dels; > dels.clear(); > > for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) { > Instruction *I = &*(It++); > > if (auto* op = dyn_cast<BinaryOperator>(I)) { > IRBuilder<NoFolder> builder(op); > > Value* lhs = op->getOperand(0); > Value* rhs = op->getOperand(1); > Value* mul = builder.CreateMul(lhs, rhs); &gt...
2015 Jun 10
2
[LLVMdev] The use iterator not working...
...se_iterator, is the same as the "def". Meaning, in the code > >>> below the pDef is always equal to pUse pointer for every instruction in > >>> all basic blocks (except terminators). > >>> > >>> for (auto i = inst_begin(f), ie = inst_end(f); i != ie; > ++i) > >>> Instruction* pDef = &(*i); > >>> errs() << "Def: " << *pDef << "\n"; > >>> > >>> for (auto ui = pDef->use_begin(), uie = >...
2010 Apr 21
2
[LLVMdev] How to delete a instruction?
...est just now, but I alse failed. I delete several ordered instructions from end to begin, but after deleting the first instruction(the last instruction of F), the program crashed. My test code is below (F is a function only containing several sequential instructions): for (inst_iterator inst == --inst_end(F); inst != inst_begin(F); --inst) { Instruction * i = &*inst; i->eraseFromParent(); } Best Regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100421/14ae2a33/attachment.html>
2018 Aug 07
2
Error Calling eraseFromParent()
...s on how the range based iterator is implemented if that > works or not. > > I think that you, for example, can change the range based iteration > > for (auto &I : instructions(F)) > > into something like this > > for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) { > Instruction *I = &*(It++); > ... > } > > That will make sure that you step the iterator before modifying the data > structure you iterate over. > > Regards, > Björn > ________________________________________ > From: llvm-d...
2013 Apr 12
3
[LLVMdev] The line number range of a function in source code level
...stored at the subprogram metadata: DISubprogram::getLineNumber(). However, there is no API (or the metadata in the first place) to know the end of the function. I have to visit all the instructions of the function and maintain the *max*line number of the instructions. I use the inst_begin(func): inst_end(func) as the iterator. But I don't think it's effective to iterate all the instructions from the beginning. It's supposed that we can iterate the instructions reversely and the first one who has attached metadata should be treated as the end of the function. Unfortunately, there is no r...
2004 Apr 27
2
[LLVMdev] subtle problem with inst_iterator
...e. > > I think it's the most correct and consistent want to do it. Great. > > > The reason why we have it return pointers right now is to populate > > > worklists, which allows us to do: > > > > > > std::set<Instruction*> WorkList(inst_begin(F), inst_end(F)); > > > > Maybe this can be rewritten like; > > > > std::set<Instruction*> WorkList; > > std::transform(insn_begin(F), insn_end(F), > > inserter(WorkList, WorkList.begin(), take_address); > > > > given proper definition of take_addre...
2016 Mar 15
7
RFC: DenseMap grow() slowness
...ve to do the whole reinsertion routine. 3. Pre-calculate an estimate as to the map size we need. For example, in EarlyCSE, this is possibly gross overestimate of size needed: unsigned InstCount = 0; unsigned LoadCount = 0; unsigned CallCount = 0; for (inst_iterator FI = inst_begin(F), FE = inst_end(F); FI != FE; ++FI) { if (FI->mayReadOrWriteMemory()) ++LoadCount; else if (isa<CallInst>(*FI)) ++CallCount; else ++InstCount; } AvailableValues.resize(InstCount); AvailableLoads.resize(LoadCount); AvailableCalls.resize(CallCount); But it does the job...
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
...ator and T is its value type. The inst_iterator, though, returns pointer to Instruction, not a reference to a pointer to instruction. The above might sound like I've gone crazy reading C++ standard, but my real reason is that with the current code the following: for_each(inst_begin(f), inst_end(f), boost::bind( apply_phi_semantics, result, _1, instruction2vertex)); does not compile, where 'apply_phi_semantics' is my function and boost::bind is a tool for binding function arguments described in http://www.boost.org/libs/bind/bind.html The reason it does not compil...
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
Hi, I want to extract all instruction of the form "alloca %struct.S", where $struct.S is defined as a struct %struct.S = type { i32, i32 } I'm using the following loop: for(inst_iterator i = inst_begin(F), e = inst_end(F); i!= e; i++) { AllocaInst* ai; if( (ai = dyn_cast<AllocaInst>(&*i))){ if(ai->getOperand(0)->getType()->getTypeID() == Type::StructTyID) allocs.push_back(ai); } } However, I had the impression that the type comparison can be done by a pointer...
2009 Sep 06
2
[LLVMdev] Graphviz and LLVM-TV
...lready. Perhaps something like: SmallValueSet PrintedSet; for (Function::arg_iterator I=F.arg_begin(), E=F.arg_end(); I != E; ++I) { if (!PrintedSet.count(*I)) { ... print graph rooted at V, add each node printed to PrintedSet } } for (inst_iterator I=inst_begin(F), E=inst_end(F); I != E; ++I) { if (!PrintedSet.count(*I)) { ... print graph rooted at V, add each node printed to PrintedSet } } Best regards, --Edwin
2009 Sep 06
3
[LLVMdev] Graphviz and LLVM-TV
...<> struct GraphTraits<DFG<Function*> > : public GraphTraits<Value*> { typedef inst_iterator nodes_iterator; static nodes_iterator nodes_begin(DFG<Function *> F) { return inst_begin(*F); } static nodes_iterator nodes_end(DFG<Function *> F) { return inst_end(*F); } }; ... ViewGraph(DFG<Function*>(F), "test"); Then you could implement a DOTGraphTraits for DFG<Function*>. > > inline comments follow... > > Török Edwin wrote: >> On 2009-09-06 17:30, Ioannis Nousias wrote: >> >>> I've tried...