search for: createmalloc

Displaying 8 results from an estimated 8 matches for "createmalloc".

Did you mean: createalloca
2015 Jan 27
2
[LLVMdev] Create a call to function malloc using LLVM API
...r.CreateAlloca(tp);//builder is IRBuilder if(tp->isPointerTy()){ Type* tpp = tp->getPointerElementType(); Type* ITy = Type::getInt32Ty(getGlobalContext()); Constant* AllocSize = ConstantExpr::getSizeOf(tpp) AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); CallInst::CreateMalloc(arg_alloc, ITy, tpp, AllocSize); } But the generated LLVM IR seems incorrect: %malloccall = tail call i8* bitcast (i8* (i64)* @malloc to i8* (i32)*)(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32)) I don't quite understand the arguments of the function CallInst::CreateMalloc. Is t...
2020 Apr 15
2
question on the signature of malloc
...TypeRef Ty, const char *Name) { Type* ITy = Type::getInt32Ty(unwrap(B)->GetInsertBlock()->getContext()); Constant* AllocSize = ConstantExpr::getSizeOf(unwrap(Ty)); AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, ITy); Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(), ITy, unwrap(Ty), AllocSize, nullptr, nullptr, ""); return wrap(unwrap(B)->Insert(Malloc, Twine(Name))); } In this code I highlighted the line which I have qu...
2009 Oct 20
1
[LLVMdev] Quick Question...
...I know that LLVM subscribes to the notion of "progress over backwards compatibility." And in that spirit, maybe someone could help me better understand the motivation behind removing the MallocInst? Is there a design doc anywhere? From a pragmatic sense, the IRBuilder's createMalloc, which was returning a MallocInst, was doing a lot of messy work for us users: http://llvm.org/docs/doxygen/html/Instructions_8cpp-source.html#l00463 . With MallocInst disappearing, is IRBuilder::createMalloc disappearing too? Thanks, ~Jon
2007 May 27
1
[LLVMdev] New LLVMBuilder api
...t cvs ? >> >> It is there: >> http://llvm.org/cvsweb/cvsweb.cgi/llvm/include/llvm/Support/LLVMBuilder.h?rev=HEAD&content-type=text/x-cvsweb-markup > > Ah, right, sorry, not looking properly. > > This is a tiny bit like .NET, but that uses emit rather than CreateX. CreateMalloc and CreateAlloca should not the ArraySize be set to (a) 1 as default argument ? Aaron
2007 May 27
4
[LLVMdev] New LLVMBuilder api
On Sun, 27 May 2007, Aaron Gray wrote: >> I just checked in a new LLVMBuilder class into llvm/Support/LLVMBuilder.h, > It does not seem to be on the LLVM cvsweb, is that still showing 1.9 or 2.0 > and not cvs ? It is there: http://llvm.org/cvsweb/cvsweb.cgi/llvm/include/llvm/Support/LLVMBuilder.h?rev=HEAD&content-type=text/x-cvsweb-markup -Chris -- http://nondot.org/sabre/
2007 May 27
0
[LLVMdev] New LLVMBuilder api
> On Sun, 27 May 2007, Aaron Gray wrote: >>> I just checked in a new LLVMBuilder class into >>> llvm/Support/LLVMBuilder.h, >> It does not seem to be on the LLVM cvsweb, is that still showing 1.9 or >> 2.0 >> and not cvs ? > > It is there: >
2010 Aug 29
0
[LLVMdev] Dataflow analysis based optimisations
...er the > FunctionAttrsPass, which would then lower the instructions to either a > call to malloc or an alloca instruction. I see vague references to an > LLVM malloc instruction; did this disappear after 2.6? Yes, the LLVM malloc instruction is no more. There might still be an IRBuilder::CreateMalloc, but that now emits a regular call to library "malloc". Now the case where function A calls function B, and function B needs to return a pointer to a freshly-allocated object, is fairly common. One way to attack this is to have each function create its own "region" or "mem...
2010 Aug 28
2
[LLVMdev] Dataflow analysis based optimisations
On 28/08/10 02:20, Kenneth Uildriks wrote: > There are passes which mark function parameters as "nocapture", which > means that the function does not store the passed-in pointer for use > after that function returns. If pointers to a newly created object > are only ever passed through "nocapture" parameters, never stored in a > global, and not returned from the