search for: constptr

Displaying 12 results from an estimated 12 matches for "constptr".

2017 Apr 11
2
[RFC] Design of a TBAA sanitizer
...tant addresses. LLVM states that > > > constant locations are noalias with themselves, and you again have the > > > "noalias does not imply pointer inequality" problem. > > > > That won't even have to be special cased, because if we emit a check > > ConstPtr != ConstPtr, > > such a check will be trivially optimized away. > > But won't it be constant folded to trigger the sanitizer crash / > warning? That is, since LLVM will state the ConstPtr NoAlias > ConstPtr, you'll emit the check: > > if (overlap(ConstPtr, Sz, Const...
2017 Apr 11
2
[RFC] Design of a TBAA sanitizer
...> > The same problem exists with constant addresses. LLVM states that > constant locations are noalias with themselves, and you again have the > "noalias does not imply pointer inequality" problem. > That won't even have to be special cased, because if we emit a check ConstPtr != ConstPtr, such a check will be trivially optimized away. > -- Sanjoy > > > > > -- Sanjoy > > > > > > > > > > > > > > > > This means, at least in LLVM IR, you have to account for cases like: > > > > > > > &gt...
2011 Oct 05
2
[LLVMdev] replacing a global variable by a constant
...replacing a global variable by a constant value for erase instruction. i had seen the code that as follows 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(); } but i dont know how can declare constptr. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111005/35b8a0c8/attachment.html>
2009 Mar 08
2
[LLVMdev] Creating Pointer Constants
...er for a subset of the Matlab language and as a part of my implementation, I would like to be able to pass a constant pointer to a native function I'm calling. Right now, this is what I do: llvm::Constant* constInt = llvm::ConstantInt::get(llvm::Type::Int64Ty, (int64)thePointer); llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt, llvm::PointerType::getUnqual(llvm::Type::Int32Ty)); builder.CreateCall(my_function, constPtr); The resulting IR call looks like this: call void @nativeFunc(i32* inttoptr (i64 146876396 to i32*)) I'm just wondering if there is a better way to appr...
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 variable with a constant. >> > You should be able to replace the initializer for the global with your > constant, mark it as having internal...
2009 Mar 11
0
[LLVMdev] Creating Pointer Constants
...> as a > part of my implementation, I would like to be able to pass a constant > pointer to a native function I'm calling. > > Right now, this is what I do: > > llvm::Constant* constInt = llvm::ConstantInt::get(llvm::Type::Int64Ty, > (int64)thePointer); > llvm::Value* constPtr = llvm::ConstantExpr::getIntToPtr(constInt, > llvm::PointerType::getUnqual(llvm::Type::Int32Ty)); > > builder.CreateCall(my_function, constPtr); > > The resulting IR call looks like this: > > call void @nativeFunc(i32* inttoptr (i64 146876396 to i32*)) This is correct. >...
2011 Oct 05
0
[LLVMdev] replacing a global variable by a constant
...able use the constant instead? Ciao, Duncan. > i had seen the code that as follows > > 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(); > } > > but i dont know how can declare constptr. > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailma...
2010 Jan 06
0
[LLVMdev] [Help] How can we call an object's virtual function inside IR?
Hi Gyounghwa Kim, > First of all, thank you very much for your answer. > I tried your sugestion and found out that it is not what I wanted. > What I have to do is call a native C function from inside this > generated function. > Is there any way that we can find and call native C functions not > created by LLVM IR? You can insert a declaration of the function into the IR, then
2010 Jan 05
5
[LLVMdev] [Help] How can we call an object's virtual function inside IR?
Dear experts, I am learning llvm by reading documents and have a question to ask. The following is the example of code generation that I created. [[a [10.00]] > [3.00]] ; ModuleID = 'ExprF' define i1 @expr(double* %record) { entry: %0 = getelementptr double* %record, i32 0 ; <double*> [#uses=1] %1 = load double* %0 ; <double>
2008 Dec 05
0
[LLVMdev] replacing a global variable by a constant
Hi Ralf, > I am trying to replace a global variable with a constant. You should be able to replace the initializer for the global with your constant, mark it as having internal linkage and then run some optimization pass over it to do the rest (not sure which one it was again, probably some constant propagation or global value optimization). That pass would then probably do some similar
2008 Dec 05
2
[LLVMdev] replacing a global variable by a constant
Hi, I am trying to replace a global variable with a constant. I did manage to do it, but somehow it appears to be fairly bruteforce by just iterating over all functions/bblocks/instructions and filtering for those that load the variable and replacing the instruction with Instruction::replaceAllUsesWith(). The more intuitive way of iterating over the uses of the variable did not work out as I
2017 Apr 11
2
[RFC] Design of a TBAA sanitizer
Hi Kostya, On April 11, 2017 at 1:30:10 PM, Kostya Serebryany (kcc at google.com) wrote: > of course, but accesses are done via pointers, and if TBAA queries > MayAlias(AccessViaP1, AccessViaP2) > there should (??) be a point in the IR where both P1 and P2 exist together > and can be compared. That may not be possible (though I'm second guessing what exactly you have in mind so