search for: getprevnod

Displaying 20 results from an estimated 24 matches for "getprevnod".

Did you mean: getprevnode
2014 Jul 10
2
[LLVMdev] bug in ilist_node::getPrevNode() ?
Hi all, I stumbled over a problem in ilist_node::getPrevNode(). It crashes when invoked for the first element in a list. It's because the Prev pointer of a first list element does not point to the sentinel but is just null. First question: Is this really a bug or am I doing something wrong? Second question: If it is a bug, what should be the correct b...
2012 Dec 20
3
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
...ne element. for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii) { BasicBlock* BB=II; if (BB->getTerminator()) { Instruction* current = BB->getTerminator(); Instruction* previous; errs()<<"AAA\n"; if(*current->getPrevNode()*) { errs()<<"BBB\n"; previous = current->getPrevNode(); ok=1; } if (ok){ errs()<<"CCC\n"; ........ It does print AAA, but then I have the segfault. So when I am evaluating t...
2011 Nov 14
0
[LLVMdev] ilist::getPrevNode asserts on list head
Hi all, I am finding a SEGFAULT in one of my passes when using getPrevNode on an instruction that is the only one in a BasicBlock. I was expecting getPrevNode to return 0 in that case (as per docs), but it breaks. I guess the code in in ilist_node.h: NodeTy *getPrevNode() { NodeTy *Prev = this->getPrev(); // Check for sentinel. if (!Prev->getNext()) r...
2012 Dec 20
0
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
I may be mistaken as I just took a quick look, but in ilist_node the function "getPrevNode()" actually calls a method on the previous node: NodeTy *getPrevNode() { NodeTy *Prev = this->getPrev(); // Check for sentinel. if (!Prev->getNext()) return 0; return Prev; } http://llvm.org/docs/doxygen/html/ilist__node_8h_source.html#l00058 Try checking if current-&gt...
2012 Dec 19
3
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
...ction::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii) { ....... // not relevant code ; BasicBlock* BB=(dyn_cast<BasicBlock>(II)); if (BB->getTerminator()) { Instruction* current = BB->getTerminator(); Instruction* previous = current->getPrevNode(); if (current->getOpcode()==Instruction::Br) { BBterminators[ii]=current; ...// not relevant code where Instruction** BBterminators = new Instruction*[100]; Thank you a lot ! Alex -- Best regards, Alexandru Ionut Diaconescu -------------- next part ----------...
2012 Dec 20
0
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
...one elements. for (Function::iterator II = F.begin(), EE = F.end(); II != EE; ++II, ++ii) { BasicBlock* BB=II; if (BB->getTerminator()) { Instruction* current = BB->getTerminator(); Instruction* previous; errs()<<"AAA\n"; if(current->getPrevNode()) { errs()<<"BBB\n"; previous = current->getPrevNode(); ok=1; } if (ok) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121220...
2013 Jan 10
2
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
Hello everyone ! In my pass I inspect the penultimate instruction from every basic block in runOnFunction(). I am interested in ICMP instructions only. if(BB->size()>1) if(last->getPrevNode()) { previous = last->getPrevNode(); ok=1; } I want to get the operands of previous, which is of type Instruction*. Due tests based on getNumOperands, ICMP has 2 (as normal). if ( ok && ((previous->getNumOperands())>=2) ) errs()<<"\nTTTTT...
2012 Dec 20
0
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
getPrevNode<http://llvm.org/docs/doxygen/html/classllvm_1_1ilist__node.html#a77b897207ef0a1ae95c404695aed9a4b>() Get the previous node, or 0 for the list head. I don't see any method like hasPrevNode. It can be a weird problem because "current->getPrevNode()" is indicating to "cur...
2014 Jul 26
2
[LLVMdev] Finding previous emitted instruction
...precedes a function epilogue in the final emitted code, and insert a NOP between them if that happens. My initial attempt at it looked like this: MachineBasicBlock& MBB; MachineBasicBlock::iterator MBBI; <-- points to where the epilogue would be inserted if (MBBI != MBB.begin() ? MBBI->getPrevNode()->isCall() : MBB.getPrevNode()->back().isCall()) { // insert NOP } However, this did not work because at the stage where I am trying to do this (in X86FrameLowering::emitEpilogue), the MBBs look like this: BB0: ... CALL ... <-- call I am trying to detect EH_LABEL ......
2012 Dec 20
2
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
Hello, Thank you for your answer. If I want to use then I have error: ‘NodeTy* llvm::ilist_half_node<NodeTy>::getPrev() [with NodeTy = llvm::Instruction]’ is protected error: ‘llvm::ilist_half_node<llvm::Instruction>’ is not an accessible base of ‘llvm::Instruction’ Do you know any other method to access the previous instruction of a terminator instruction? PS: back() is not an
2012 Dec 20
1
[LLVMdev] LLVM segmentation fault / need use Instruction instead of Instruction*
I solved by checking if(BB->size()>1) Thank you all for the help ! Now debugging the next segfault. On Thu, Dec 20, 2012 at 12:59 PM, Alexandru Ionut Diaconescu < alexandruionutdiaconescu at gmail.com> wrote: > getPrevNode<http://llvm.org/docs/doxygen/html/classllvm_1_1ilist__node.html#a77b897207ef0a1ae95c404695aed9a4b>() > Get the previous node, or 0 for the list head. I don't see any method > like hasPrevNode. > It can be a weird problem because "current->getPrevNode()" is indicati...
2013 Jan 10
0
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
Hi, On 10/01/13 10:56, Alexandru Ionut Diaconescu wrote: > Hello everyone ! > > In my pass I inspect the penultimate instruction from every basic block in > runOnFunction(). I am interested in ICMP instructions only. > > |if(BB->size()>1) > if(last->getPrevNode()) > { > previous = last->getPrevNode(); > ok=1; > } > | > > I want to get the operands of previous, which is of type Instruction*. Due tests > based on getNumOperands, ICMP has 2 (as normal). > > |if ( ok && ((previous->getNu...
2011 May 20
3
[LLVMdev] convert a char * to a value
...i'm supposed to add this method, in an IR basic bloc: to add it into a basic bloc i do: //i: is the basic bloc std::vector<Value*> void_43_params; Constant* tbname = ConstantArray::get(M.getContext(),i->getNameStr() , true); Constant* pbname = ConstantArray::get(M.getContext(), i->getPrevNode()->getNameStr(), true); void_43_params.push_back(tbname); void_43_params.push_back(pbname); CallInst* void_43 = CallInst::Create(func_branchPredict, void_43_params.begin(), void_43_params.end(), "", i->getTerminator()); when i execute the pass (opt -load ....) i get an error: C...
2015 Oct 08
5
ilist/iplist are broken (maybe I'll fix them?)
...ted. There are also a number of arbitrary "hooks" for managing external state. Yay?) Benefits -------- What do we get in return? - Nodes "know" if they are the sentinel, since `next == nullptr`. This lets you do cute things like `NodeTy *getNextNode()` and `NodeTy *getPrevNode()`, which do the obvious, returning nullptr instead of the sentinel. A naive list would need to compare against `end()`. - Iterating forward will eventually dereference `nullptr` (can't infinite loop, even in release builds). - A whole lot of branches :/. UB from sentinel hac...
2011 May 20
0
[LLVMdev] convert a char * to a value
...ink it is similar to what you want to do. -- John T. > > //i: is the basic bloc > std::vector<Value*> void_43_params; > Constant* tbname = ConstantArray::get(M.getContext(),i->getNameStr() , > true); > Constant* pbname = ConstantArray::get(M.getContext(), > i->getPrevNode()->getNameStr(), true); > void_43_params.push_back(tbname); > void_43_params.push_back(pbname); > CallInst* void_43 = CallInst::Create(func_branchPredict, > void_43_params.begin(), void_43_params.end(), "", i->getTerminator()); > > when i execute the pass (opt -l...
2012 Dec 18
1
[LLVMdev] problem with runOnLoop
...tack dump error frequently as well. Also trying to access basic blocks in runOnBasicBlock(BasicBlock &BB). This is at the 4th line with errs(): Instruction* current = BB.getTerminator(); errs() << "\n last: "<<*current<<"\n"; Instruction* prev = current->getPrevNode(); errs()<<*prev<<"\n"; What can be the cause?
2012 Dec 18
1
[LLVMdev] BasicBlock back()
PS: I works when I use Instruction* prev = current->getPrevNode(); But then I have runtime error Stack dump that is very frequent... On Mon, Dec 17, 2012 at 6:20 PM, John Criswell <criswell at illinois.edu>wrote: > On 12/17/12 10:34 AM, Alexandru Ionut Diaconescu wrote: > > Hello, > > I am a beginner of LLVM. I am trying to move among...
2013 Jan 11
2
[LLVMdev] LLVM Instruction*->getOperand() not working properly for ICMP
...:56, Alexandru Ionut Diaconescu wrote: > >> Hello everyone ! >> >> In my pass I inspect the penultimate instruction from every basic block in >> runOnFunction(). I am interested in ICMP instructions only. >> >> |if(BB->size()>1) >> if(last->getPrevNode()) >> { >> previous = last->getPrevNode(); >> ok=1; >> } >> | >> >> I want to get the operands of previous, which is of type Instruction*. >> Due tests >> based on getNumOperands, ICMP has 2 (as normal). >>...
2014 Apr 15
10
[LLVMdev] [PATCH] Seh exceptions on Win64
Hi, I'd like to submit a patch to match the clang patch on the front end. http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140414/103257.html The front end doesn't need this patch to work but it's still important. This is mostly based on work done by kai from redstar.de Could I get some feedback on this? I'm not sure if the emitting of the register names will effect
2013 Apr 09
0
[LLVMdev] Getting the position of a BasicBlock that doesn't exist anymore in the backend
...the BasicBlock in the Function to decide the position of the label). The most desirable situation would be to be able to know which is the BasicBlock that is immediately after in the stream and point to that, but I don't know if there is a reliable way to do that ( I tried to use the ->getPrevNode() ->getNextNode() on the BasicBlock object pointed by the BlockAddress, but I get unreliable results). Any idea? Cheers, Marcello -- Marcello Maggioni Codeplay Software Ltd 45 York Place, Edinburgh, EH1 3HP Tel: 0131 466 0503 Fax: 0131 557 6600 Website: http://www.codeplay.com Twitter: http...