search for: getnextnod

Displaying 15 results from an estimated 15 matches for "getnextnod".

Did you mean: getnextnode
2015 Oct 08
5
ilist/iplist are broken (maybe I'll fix them?)
...it's a little more complicated. 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 br...
2015 Oct 20
2
ilist/iplist are broken (maybe I'll fix them?)
...nt to get some buy-in before > > really diving in. I've CC'ed the people in the IRC conversation and a > > couple of others that seem to care about ADT and/or UB. > > A quick update on this. > > The first problem I hit was that there are callers that *rely* on > `getNextNode()` returning the sentinel instead of `nullptr`. If you > look at the implementation of `getNextNode()`, that's kind of insane. > > The only way I could think to root out all the similar issues was to > look at every call to the implicit conversions and confirm they aren't >...
2015 Oct 21
3
ilist/iplist are broken (maybe I'll fix them?)
...e it's not a > big deal. It's certainly more convenient to eschew type safety. I'm > willing to let these bitrot back if that's better. > > Now that I've rooted out the bugs I was looking for (confirmed LLVM > is clean as of r250852) I'll get back to fixing `getNextNode()` and > ilist itself. > >> >> On Tue, Oct 20, 2015 at 11:13 AM, Duncan P. N. Exon Smith via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> > On 2015-Oct-07, at 17:57, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote: >> > >>...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...t's the same problem as you described. By printing I meant calling printf function and passing my global variable as one of the arguments. My code: Instruction* InstructionVisitor::incrementGlobalKey(Instruction* I) { IRBuilder<> Builder(I->getContext()); Builder.SetInsertPoint(I->getNextNode()); GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey"); if (key) { LoadInst* load = Builder.CreateLoad(key); Value* inc = Builder.CreateAdd(load, Builder.getInt64(1)); StoreInst* store = Builder.CreateStore(inc, key); return store; } return I; } Instruction* Instr...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...;TargetLibraryInfoWrapperPass>().getTLI(F)); for (Instruction &I : instructions(F)) { visitor.visit(I); } } return true;} Later in InstructionVisitor I try to update it like that: IRBuilder<> Builder(I->getContext());Builder.SetInsertPoint(I->getNextNode()); GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey"); if (key) { LoadInst* load = Builder.CreateLoad(key); Value* inc = Builder.CreateAdd(load, Builder.getInt64(1)); StoreInst* store = Builder.CreateStore(inc, key);} I print that global variable during...
2020 Jul 19
2
Instrument intrinsic invalid
...aTuples.push_back(MDString::get(Inst->getContext(), c)); MDNode* N = MDNode::get(Inst->getContext(), dataTuples); Value* meta = MetadataAsValue::get(Inst->getContext(), N); std::vector<Value*> args; args.push_back(meta); IRBuilder<> Builder(Inst->getNextNode()); Builder.CreateCall(dbglabelPtr, args, ""); } And before my pass finish, I print the IR, it shows I successfully add the intrinsic %5 = load i32 (i32, i32)*, i32 (i32, i32)** %1, align 8, !dbg !35, !ppp.load !36 call void @llvm.dbg.label(metadata !36), !dbg !37 ... ; Functio...
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
2014 Jul 07
4
[LLVMdev] Splitting basic block results in unknown instruction type assertion
...#include "llvm/Pass.h" #include "llvm/InstVisitor.h" using namespace llvm; namespace { class TestInstVisitor : public InstVisitor<TestInstVisitor> { public: void visitCallInst(CallInst &I) { Instruction *splitPoint = I.getNextNode(); BasicBlock *head = splitPoint->getParent(); BasicBlock *tail = head->splitBasicBlock(splitPoint); } }; class TestPass : public ModulePass { public: static char ID; TestPass() : ModulePass(ID) {} virtual bool r...
2017 Mar 04
2
Figuring out return address of a call
...addresses through a function pass, split the basic block *after* the call instruction, then generate a BlockAddress as follows: if (auto CL = dyn_cast<CallInst>(&*I)) { BasicBlock *callblock = (*CL)->getParent(); BasicBlock *postblock = callblock->splitBasicBlock((*CL)->getNextNode()); BlockAddress *retaddr = BlockAddress::get(postblock); ... } This works well except that the BlockAddress is slightly off. I run into the problem that during code generation, my BlockAddress is moved past the instructions that store arguments. E.g., if the function returns an argument, %ra...
2013 Apr 09
0
[LLVMdev] Getting the position of a BasicBlock that doesn't exist anymore in the backend
...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: https://twitter.com/cod...
2018 Jan 09
2
Passing Array base address/pointer to runtime function in LLVM IR
...= llvm::ConstantInt::get(i32_type, numberOfElement); args.push_back(getElementPtrInst->getPointerOperand()); args.push_back(value); callInst = llvm::CallInst::Create(runtimeInitializeRandomIntegerArrayValue, args,"" , allocaInst->getNextNode()); Tried the above code but no luck .. Any method that can easily pass array base address/pointer to function. Question on stackoverlfow: https://stackoverflow.com/questions/48162515/passing-array-base-address-pointer-to-runtime-function-in-llvm-ir Thanks in advance.. Bernard Nongpoh -------...
2018 May 24
0
LLVM Pass To Remove Dead Code In A Basic Block
> On 25 May 2018, at 01:46, Aaron via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi all, > > LLVM optimization pass gives an error "Terminator found in the middle of a basic block!" since basic block IR may have multiple "ret" instructions. It seems LLVM does not accept multiple return in a basic block by default. > Yes, if you’re inserting
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
Hi all, LLVM optimization pass gives an error "Terminator found in the middle of a basic block!" since basic block IR may have multiple "ret" instructions. It seems LLVM does not accept multiple return in a basic block by default. Is there a specific optimization or pass that I can enable to remove unreachable codes in basic blocks? Best, Aaron -------------- next part
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
...assert(it != basicBlock->getInstList().end() && "Can't split block since there is no following instruction in the basic block."); auto newBlock = llvm::BasicBlock::Create(basicBlock->getContext(), "splitedBlock", basicBlock->getParent(), basicBlock->getNextNode()); // Move all of the instructions from original block into new block. newBlock->getInstList().splice(newBlock->end(), basicBlock->getInstList(), it, basicBlock->end()); // Now we must loop through all of the successors of the New block (which // _were_ the successor...
2014 Nov 03
8
[LLVMdev] [PATCH] Protection against stack-based memory corruption errors using SafeStack
...f (Align > MaxAlignment) + MaxAlignment = Align; + } + + if (MaxAlignment > StackAlignment) { + // Re-align the base pointer according to the max requested alignment + assert(isPowerOf2_32(MaxAlignment)); + IRB.SetInsertPoint(cast<Instruction>(BasePointer->getNextNode())); + BasePointer = cast<Instruction>(IRB.CreateIntToPtr( + IRB.CreateAnd(IRB.CreatePtrToInt(BasePointer, IntPtrTy), + ConstantInt::get(IntPtrTy, ~uint64_t(MaxAlignment-1))), + StackPtrTy)); + } + + // Allocate space for every unsafe stati...