search for: settailcall

Displaying 20 results from an estimated 25 matches for "settailcall".

2008 Nov 17
2
[LLVMdev] Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
...); const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); AllocaInst *AI = new AllocaInst(Type::Int32Ty); Value *ST = new StoreInst(Ten,AI,false,4,j); Value *BT = new BitCastInst(ST,VoidPtrTy,"",j); CallInst *CallPrint = CallInst::Create(myprint, BT, "", j); CallPrint->setTailCall(true); I am getting the following error while executing. Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed. What am I doing wrong :(? I always get stuck badly when these assertions fail :(. Please help me out here. Thanks, Bhavani --- On Sun, 11/16...
2008 Sep 12
3
[LLVMdev] Tail-calling
For marking a call site as a tail call you have to call void setTailCall(bool isTC = true) on the CallInst. The calling convention of the function needs to be CallingConv::Fast (currently only fastcc calls are optimized) and the call has to be in tail position of course. To enable tail call optimization in an embedded vm i guess you would include llvm/Target/TargetOpti...
2015 Jan 19
2
[LLVMdev] [INCOMPLETE] [GC] Support wrapping vararg functions in statepoint
...tionType>(PT->getElementType()); @@ -5760,7 +5760,7 @@ void SelectionDAGBuilder::LowerCallTo(ImmutableCallSite CS, SDValue Callee, TargetLowering::CallLoweringInfo CLI(DAG); CLI.setDebugLoc(getCurSDLoc()).setChain(getRoot()) .setCallee(RetTy, FTy, Callee, std::move(Args), CS) - .setTailCall(isTailCall); + .setTailCall(isTailCall).setVarArg(isVarArg); std::pair<SDValue,SDValue> Result = lowerInvokable(CLI, LandingPad); if (Result.first.getNode()) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index eba98b8.....
2008 Nov 17
1
[LLVMdev] Assertion `InReg && "Value not in map!"' failed
...; Trying to cast (void) to (void*) is invalid. Instead, you > should cast the AllocaInst, ala: > > Value *BT = new BitCastInst(AI,VoidPtrTy,"",j); > > Nick > > > CallInst *CallPrint = CallInst::Create(myprint, BT, > "", j); > > CallPrint->setTailCall(true); > > > > I am getting the following error while executing. > > Assertion `castIsValid(getOpcode(), S, Ty) && > "Illegal BitCast"' failed. > > > > What am I doing wrong :(? I always get stuck badly > when these assertions fail :(. Pl...
2008 Nov 17
1
[LLVMdev] Assertion `InReg && "Value not in map!"' failed
...the AllocaInst, ala: > >> > >> Value *BT = new > BitCastInst(AI,VoidPtrTy,"",j); > >> > >> Nick > >> > >>> CallInst *CallPrint = > CallInst::Create(myprint, BT, > >> "", j); > >>> CallPrint->setTailCall(true); > >>> > >>> I am getting the following error while > executing. > >>> Assertion `castIsValid(getOpcode(), S, Ty) > && > >> "Illegal BitCast"' failed. > >>> What am I doing wrong :(? I always get stuck >...
2008 Aug 19
7
[LLVMdev] Please help with LLVM C++ integration
...->getOrInsertFunction("foo", Type::Int32Ty, (Type *)0)); BasicBlock * BB = BasicBlock::Create("EntryBlock", FooF); Value *Ten = ConstantInt::get(Type::Int32Ty, 10); CallInst *Add1CallRes = CallInst::Create(my_function, Ten, "some_test_func", BB); Add1CallRes->setTailCall(true); ReturnInst::Create(Add1CallRes, BB); std::cout << "We just constructed this LLVM module:\n\n" << *M; std::cout << "\n\nRunning foo: " << std::flush; std::vector<GenericValue> noargs; GenericValue gv = EE->runFunction(FooF, noargs);...
2012 Feb 09
1
[LLVMdev] Difficulty inserting putchar in IR
...nsertFunction("putchar", IntegerType::getInt32Ty(Context), IntegerType::getInt32Ty(Context), NULL)); Value *One = ConstantInt::get(Type::getInt32Ty(Context), 1); CallInst *CallFibX1 = CallInst::Create(putchar_func, One, "fibx1", BB); CallFibX1->setTailCall(); Thanks and Regards, Tarun Agrawal -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120210/9bcd728b/attachment.html>
2008 Nov 16
1
[LLVMdev] How do I get the result of an instruction?
...for (BasicBlock::iterator j = blk->begin(), k = blk->end(); j != k; ++j){ Instruction *inst = j; //if inst satisfies my condition, write reults to file CallInst *CallPrint = CallInst::Create(myprint, ???, "", j); CallPrint->setTailCall(true); } } What do I put in the ???. How do I cast Instruction *inst into char * which can be passed into the function? Hope this is clear. Thanks, Bhavani --- On Sun, 11/16/08, Eli Friedman <eli.friedman at gmail.com> wrote: > From: Eli Friedman <eli.friedman at gmai...
2008 Aug 19
0
[LLVMdev] Please help with LLVM C++ integration
...Ty, (Type *)0)); > BasicBlock * BB = BasicBlock::Create("EntryBlock", FooF); > Value *Ten = ConstantInt::get(Type::Int32Ty, 10); > CallInst *Add1CallRes = CallInst::Create(my_function, Ten, > "some_test_func", BB); > Add1CallRes->setTailCall(true); > > ReturnInst::Create(Add1CallRes, BB); > > std::cout << "We just constructed this LLVM module:\n\n" << *M; > std::cout << "\n\nRunning foo: " << std::flush; > > std::vector<GenericValue>...
2008 Aug 19
0
[LLVMdev] Please help with LLVM C++ integration
...Ty, (Type *)0)); > BasicBlock * BB = BasicBlock::Create("EntryBlock", FooF); > Value *Ten = ConstantInt::get(Type::Int32Ty, 10); > CallInst *Add1CallRes = CallInst::Create(my_function, Ten, > "some_test_func", BB); > Add1CallRes->setTailCall(true); > > ReturnInst::Create(Add1CallRes, BB); > > std::cout << "We just constructed this LLVM module:\n\n" << *M; > std::cout << "\n\nRunning foo: " << std::flush; > > std::vector<GenericValue>...
2008 Nov 17
0
[LLVMdev] Assertion `InReg && "Value not in map!"' failed
...> Value *BT = new > >> BitCastInst(AI,VoidPtrTy,"",j); > >>>> Nick > >>>> > >>>>> CallInst *CallPrint = > >> CallInst::Create(myprint, BT, > >>>> "", j); > >>>>> CallPrint->setTailCall(true); > >>>>> > >>>>> I am getting the following error while > >> executing. > >>>>> Assertion `castIsValid(getOpcode(), > S, Ty) > >> && > >>>> "Illegal BitCast"' failed. > >>...
2008 Sep 12
0
[LLVMdev] Tail-calling
Arnold Schwaighofer wrote: > Take this with a grain of salt or two since i have never done it ;) > but i guess that setting those globals is what > cl::ParseCommandLineOptions does in lli/llc.cpp. I can confirm that this is actually how it works (fastcc on the function + setTailCall on the call instruction + llvm::PerformTailCallOpt = true). I might add that of course you also have to make sure that the tail call is immediately before a ret instruction. :) Note that it also depends on the JIT for the target architecture whether this is actually supported. I verified that t...
2008 Nov 16
0
[LLVMdev] How do I get the result of an instruction?
On Sat, Nov 15, 2008 at 3:58 PM, bhavani krishnan <bhavi63 at yahoo.com> wrote: > Thanks! > > How do I cast the result to a string? I basically need to store the results of some instructions in a file. If you're confused about how the IR works, http://llvm.org/demo/ can be useful. The question you're asking doesn't really seem to make sense. -Eli
2008 Nov 17
0
[LLVMdev] How do I get the result of an instruction?
...n(), > k = blk->end(); j != k; ++j){ > > Instruction *inst = j; > > //if inst satisfies my condition, write > reults to file > > CallInst *CallPrint = > CallInst::Create(myprint, ???, "", j); > > CallPrint->setTailCall(true); > > } > > } > > What do I put in the ???. How do I cast Instruction > *inst into char * which can be passed into the function? > > Well, you can do something like the following: > define i32 @f() nounwind { > entry: > %x = alloca i32 > %resultt...
2008 Feb 25
0
[LLVMdev] Calling functions
...arg = PointerType::get( ArgTy, 0 ); functionConstant = ConstantExpr::getIntToPtr( functionConstant, arg ); [...] (BB and CoefficientOne definition and other stuff) CallInst *CallExternal = new CallInst(functionConstant, CoefficientOne, "external_call", BB ); CallExternal->setTailCall(); ####### The runtime error was: /var/tmp/portage/sys-devel/llvm-base-2.2/work/llvm-2.2/include/llvm/Support/Casting.h:199: typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X = llvm::FunctionType, Y = const llvm::Type*]: Assertion `isa<X>(Val) &&amp...
2008 Sep 11
0
[LLVMdev] Tail-calling
On Thu, Sep 11, 2008 at 4:31 PM, Arnold Schwaighofer <arnold.schwaighofer at gmail.com> wrote: > Tail calls through function pointers should work.If not please send a testcase. > > I just added the two examples from the bug (1392) that calls for true > tail call support. They work on my machine (-tailcallopt needs to be > enabled) ;) > > That would be commit 56127. >
2008 Nov 17
1
[LLVMdev] How do I get the result of an instruction?
...; ++j){ > > > Instruction *inst = j; > > > //if inst satisfies my condition, > write > > reults to file > > > CallInst *CallPrint = > > CallInst::Create(myprint, ???, "", j); > > > CallPrint->setTailCall(true); > > > } > > > } > > > What do I put in the ???. How do I cast > Instruction > > *inst into char * which can be passed into the > function? > > > > Well, you can do something like the following: > > define i32 @f() nounwind { &gt...
2008 Nov 15
2
[LLVMdev] How do I get the result of an instruction?
Thanks! How do I cast the result to a string? I basically need to store the results of some instructions in a file. Thanks, Bhavani --- On Sun, 11/16/08, John Criswell <criswell at uiuc.edu> wrote: > From: John Criswell <criswell at uiuc.edu> > Subject: Re: [LLVMdev] How do I get the result of an instruction? > To: "bhavi63 at yahoo.com" <bhavi63 at
2014 Mar 29
2
[LLVMdev] Cast specific pointer type to generic one
Hi, Suppose I have a pointer to "something" (a structure I defined) and I want to pass the pointer to a generic function, that gets a 64-bit address pointer. How do I do that? For instance: The function is: void Foo (void *); I get the specific pointer using getPointerOperand() on a store instruction that store to it: inst->getPointerOperand()->getType() Now I want
2008 Sep 11
3
[LLVMdev] Tail-calling
Tail calls through function pointers should work.If not please send a testcase. I just added the two examples from the bug (1392) that calls for true tail call support. They work on my machine (-tailcallopt needs to be enabled) ;) That would be commit 56127. regards On Thu, Sep 11, 2008 at 11:21 PM, Evan Cheng <evan.cheng at apple.com> wrote: > Arnold implemented tail call. We