similar to: [LLVMdev] insertions with inst_iterators?

Displaying 20 results from an estimated 9000 matches similar to: "[LLVMdev] insertions with inst_iterators?"

2011 Aug 29
0
[LLVMdev] insertions with inst_iterators?
On Mon, Aug 29, 2011 at 12:38 PM, ret val <retval386 at gmail.com> wrote: > I am looping through all instructions in a Function and depending on > what I found I 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
2011 Aug 29
0
[LLVMdev] insertions with inst_iterators?
On Aug 29, 2011, at 12:38 PM, ret val wrote: > I am looping through all instructions in a Function and depending on > what I found I 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
2011 Aug 29
2
[LLVMdev] insertions with inst_iterators?
When I'm iterating through I only directly add BitCastInsts and a single CallInst(Im assuming the functions I also created are elsewhere). Unfortunately it doesnt look like theres is a good way to convert between the the iterator I and a CallInst *. Am I missing something? Thanks On Mon, Aug 29, 2011 at 3:59 PM, David Blaikie <dblaikie at gmail.com> wrote: > > > On Mon, Aug
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
Chris Lattner wrote: > On Fri, 23 Apr 2004, Vladimir Prus wrote: > > and since result of *it is considered to be rvalue it can't be accepted > > by this operator. The complete discussion is in > > > > http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm > > > > I'd suggest to apply the following patch which makes operator* return >
2004 Apr 23
0
[LLVMdev] subtle problem with inst_iterator
On Fri, 23 Apr 2004, Vladimir Prus wrote: > Yea, I've noticed that. However, it looks like inst_iterator is iterator over > pointers. Oh, wait a minite, that's the current code: > > inline IIty operator*() const { return BI; } > inline IIty operator->() const { return operator*(); } > > So operator* works as if value_type is Instruction*, but operator->
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
Hello, I think there's a rather subtle problem with the inst_iterator. It declares its iterator category as std::bidirectional_iterator_tag but C++ standard requirements for forward iterator (which are included in requirements for bidirection iterator), say that the type of expression *r; should be T&, where 'r' is the iterator and T is its value type. The inst_iterator,
2004 Apr 23
0
[LLVMdev] subtle problem with inst_iterator
On Fri, 23 Apr 2004, Vladimir Prus wrote: > and since result of *it is considered to be rvalue it can't be accepted by > this operator. The complete discussion is in > > http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm > > I'd suggest to apply the following patch which makes operator* return > reference to pointer. It makes my code compile and the rest
2010 Apr 21
2
[LLVMdev] How to delete a instruction?
I did a simple test 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;
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>
2018 Aug 08
3
Error Calling eraseFromParent()
LLVM is built in Release mode. The version is 6.0.0. I think that a similar code worked on verison 3.9.0. It is probably a null pointer dereference occurring in eraseFromParent(). I checked and reconfirmed that the instruction had no uses. Perhaps I should rebuild LLVM. Thanks. On Wed, Aug 8, 2018 at 9:03 PM, mayuyu.io <admin at mayuyu.io> wrote: > Hmmmm that’s strange. Do you get an
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);
2018 Aug 07
2
Error Calling eraseFromParent()
Thanks Bjorn! But The problem is still there. On Wed, Aug 8, 2018 at 2:04 AM, Björn Pettersson A < bjorn.a.pettersson at ericsson.com> wrote: > It looks quite dangerous to erase the instruction I inside the loop when > iterating over all instructions in the function. > I guess it depends on how the range based iterator is implemented if that > works or not. > > I think
2010 Apr 21
0
[LLVMdev] How to delete a instruction?
lucefe wrote: > I did a simple test 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 !=
2011 Oct 12
2
[LLVMdev] insert ICmpInst/BranchIns in Pass?
In a pass I would like to insert a ICmpInst/BranchInst pair to check if 2 GlobalVariables are equal or not. If they are not I would like to call a function. I've tried splitting the current block and then inserting before the existing instructions, but for some reason this seems to ruin the iterator(i). What is the correct way todo something like this? void checkShadowPtr(Module &M,
2009 Jun 25
0
[LLVMdev] Replacing instruction in LLVM IR by an intrinsics
On Thu, Jun 25, 2009 at 12:32 AM, ihusar<ihusar at fit.vutbr.cz> wrote: >                //now i need to create an instruction that represents a call to a intrinsic >                Function* FIntr = Intrinsic::getDeclaration(&M, Intrinsic::regread_i32); > >                // here it fails: void llvm::CallInst::init(llvm::Value*): >                //Assertion
2009 Jun 24
3
[LLVMdev] Replacing instruction in LLVM IR by an intrinsics
Hi everyone, I am trying to write a pass, that finds some instructions and replaces them with my intrinsics, but I am having problem understanding, how this should be done. Let's say I have this instruction: %tmp14 = load i32* getelementptr ([32 x i32]* @gpregs, i32 0, i64 28) and i need to read the load's operands and replace it by let's say: %tmp14 = call i32
2009 Sep 06
2
[LLVMdev] Graphviz and LLVM-TV
On 2009-09-06 17:30, Ioannis Nousias wrote: > I've tried to write a DFGPrinter based on the CFGPrinter, as you > suggested, but encountered problems. > > The GraphWriter expects > GraphTraits<GraphType>::nodes_begin()/nodes_end(). The way this is > implemented in CFG.h, a function is a graph of basic blocks. A > GraphTraits<Function*> inherits from
2009 Sep 06
3
[LLVMdev] Graphviz and LLVM-TV
On 2009-09-06 19:57, Ioannis Nousias wrote: > Edwin, > > thank you for your effort, but I'm not sure I understand. > Are you describing a graph traversal problem? Is the data model stored > in a predecessor/successor fashion, which requires you to 'walk' the > graph in order to visit all nodes? (and what happens when you have > disjointed DFGs?). Sorry for the
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:
2007 Nov 23
1
[LLVMdev] how to dump a Instruction in gdb?
On Nov 23, 2007 5:29 PM, Duncan Sands <baldrick at free.fr> wrote: > Hi, > > > I want to know how to dump the a instruction in gdb. I can dump a > Module > > use M.dump(), also is there any such print function which can be used in > gdb > > for a single instruction and its operand? > > you can dump most things in LLVM the same way as for a module: if I