search for: getreturntyp

Displaying 20 results from an estimated 27 matches for "getreturntyp".

Did you mean: getreturntype
2008 May 22
0
[LLVMdev] How to get a return type of a function with LLVM-C API
...om bitcode file) with > LLVM-C API, but there seems no appropriate API to do that. From my memory, this info is stored in the function type, so you could look at the function's type and get the info there. Looking the the API docs [1], I find that there is a simple method on Function called getReturnType(). You should thus be able to do: Type* rt = F->getReturnType(); Good luck, Matthijs [1]: http://llvm.org/doxygen/classllvm_1_1Function.html -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc...
2013 Jul 31
1
[LLVMdev] Problem to remove successors
...t;BranchInst>(TI)->setUnconditionalDest(TI->getSuccessor(1-SuccNum)); } else { // Otherwise convert to a return instruction... Value *RetVal = 0; // Create a value to return... if the function doesn't return null... if (!(BB->getParent()->getReturnType())->isVoidTy()) RetVal = Constant::getNullValue(BB->getParent()->getReturnType()); // Create the return... NewTI = 0; } break; case Instruction::Invoke: // Should convert to call case Instruction::Switch: // Should remove entry default: cas...
2008 May 22
3
[LLVMdev] How to get a return type of a function with LLVM-C API
...d shader module // ret = LLVMCreateMemoryBufferWithContentsOfFile( input, &MemBuf, // [out] &ErrStr); // [out] ret = LLVMParseBitcode( MemBuf, &M, // [out] &ErrStr); // [out] F = LLVMGetFirstFunction(M); RetTy = LLVMGetReturnType(F); // NG! Can't do this ---- How can I do that? (I am using HEAD version of llvm) And is there a tutorial or document for LLVM C API? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachme...
2014 Jul 07
2
[LLVMdev] Return Type of Call Function with nested bitcast
Hi All, I am facing an issue with CallInst with nested bitcast instruction. I want to check if the return type of a call is void or non-void the below line works well for CallInst without bit cast. *cast<CallInst>(I)->getCalledFunction()->getReturnType()->isVoidTy()* But for Call instructions like *call void bitcast (void (%struct.jpeg_compress_struct.131*, i32)* @jinit_c_master_control to void (%struct.jpeg_compress_struct.109*, i32)*)(%struct.jpeg_compress_struct.109* %0, i32 0)* getCalledFuncion returns null and the pass crashes. Thanks...
2009 Mar 14
5
[LLVMdev] Strange LLVM Crash
I'm implementing a JIT and getting some strange crashes. I'm unsure exactly what's causing them, but it seems to occur when I call the getReturnType() method on some LLVM function objects. More precisely, I'm registering some native C++ functions as LLVM functions through the addGlobalMapping method of an execution engine object. I then keep a pointer to those LLVM function objects, which I use later on to create call instructions to those...
2013 May 29
2
[LLVMdev] CloneFunctionInto() Error
...0x0000000000521f91 Stack dump: 0. Program arguments: opt -load ../../../Release+Asserts/lib/Blocks.so -blocks Aborted (core dumped) ***The code is > std::vector<Type*> ArgTypes; > ValueToValueMapTy VMap; >FunctionType *FTy = FunctionType::get(F.getFunctionType()->getReturnType(), ArgTypes, F.getFunctionType()->isVarArg()); >Function *NewF = Function::Create(FTy, F.getLinkage(), F.getName()); > SmallVector<ReturnInst*, 8> Returns; >CloneFunctionInto(NewF, (Function*) &F, VMap, false, Returns, "_", 0, 0); Th...
2009 Mar 14
0
[LLVMdev] Strange LLVM Crash
Hi Nyx, > I'm implementing a JIT and getting some strange crashes. I'm unsure exactly > what's causing them, but it seems to occur when I call the getReturnType() > method on some LLVM function objects. More precisely, I'm registering some > native C++ functions as LLVM functions through the addGlobalMapping method > of an execution engine object. I then keep a pointer to those LLVM function > objects, which I use later on to create call i...
2009 Jul 22
0
[LLVMdev] Assertion in Function.cpp when linking modules
...hard time figuring out the following problem: I am porting a library that uses LLVM 2.5 from Linux to Windows (LLVM compiled with cmake/MSVC, llvm-g++ pre-built binaries). Compilation works fine, but at runtime, I encounter the following assertion: Assertion failed: FunctionType::isValidReturnType(getReturnType()) && !isa<OpaqueType>(getReturnType ()) && "invalid return type", file .\Function.cpp, line 164 This happens somewhere in "LinkInModule" when trying to link two loaded .bc-files (generated by llvm-g++). The weird point: The assertion fires because the c...
2012 Oct 08
1
[LLVMdev] Fwd: Multiply i8 operands promotes to i32
...lic ABIInfo { public: MSP430ABIInfo (CodeGenTypes &CGT) : ABIInfo(CGT) {} ABIArgInfo classifyReturnType(QualType RetTy) const; ABIArgInfo classifyArgumentType(QualType RetTy) const; virtual void computeInfo(CGFunctionInfo &FI) const { FI.getReturnInfo() = classifyReturnType(FI.getReturnType()); for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end(); it != ie; ++it) it->info = classifyArgumentType(it->type); } virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty, CodeGenFunction &CGF) c...
2015 Dec 03
3
Function attributes for LibFunc and its impact on GlobalsAA
----- Original Message ----- > From: "James Molloy via llvm-dev" <llvm-dev at lists.llvm.org> > To: "Vaivaswatha Nagaraj" <vn at compilertree.com> > Cc: "LLVM Dev" <llvm-dev at lists.llvm.org> > Sent: Thursday, December 3, 2015 4:41:46 AM > Subject: Re: [llvm-dev] Function attributes for LibFunc and its impact on GlobalsAA > >
2013 May 29
0
[LLVMdev] CloneFunctionInto() Error
...t -load ../../../Release+Asserts/lib/Blocks.so > -blocks > Aborted (core dumped) > > > > ***The code is > > > > std::vector<Type*> ArgTypes; > > > ValueToValueMapTy VMap; > > >FunctionType *FTy = > FunctionType::get(F.getFunctionType()->getReturnType(), > ArgTypes, F.getFunctionType()->isVarArg()); > > >Function *NewF = Function::Create(FTy, F.getLinkage(), F.getName()); > > > SmallVector<ReturnInst*, 8> Returns; > > >CloneFunctionInto(NewF, (Function*) &F, VMap, false, Ret...
2011 Sep 16
2
[LLVMdev] How to duplicate a function?
...function that we want to change. Fn = M.getFunction("haha"); // Start by computing a new prototype for the function, which is the same as // the old function, but has an extra argument. FTy = Fn->getFunctionType(); // Find out the return value. RetTy = FTy->getReturnType(); // set the calling convention to C. // so, we interoperate with C Code properly. Function *tmp = cast<Function>(Fn); tmp->setCallingConv(CallingConv::C); return true; } bool DP::runOnFunction(Function &F) { #if 0 Value *param; // Find the instruction...
2014 Jun 24
2
[LLVMdev] Issues with clang-llvm debug info validity
...ex 048c8f8..2bded23 100644 --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -771,7 +771,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, SmallVector<llvm::Value *, 16> EltTys; // Add the result type at least. - EltTys.push_back(getOrCreateType(Ty->getReturnType(), Unit)); + EltTys.push_back(getOrCreateType(Ty->getReturnType(), Unit).getRef()); // Set up remainder of arguments if there is a prototype. // otherwise emit it as a variadic function. @@ -779,7 +779,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, EltTys.push_ba...
2011 Sep 16
0
[LLVMdev] How to duplicate a function?
...nction("haha"); // Fn = M.getFunction("haha"); // Start by computing a new prototype for the function, which is the same as // the old function, but has an extra argument. FTy = Fn->getFunctionType(); // Find out the return value. RetTy = FTy->getReturnType(); #if 0 if (Fn->getName() == "haha") { f = M.getOrInsertFunction("ShawnFunction", /* return type */ Type::getVoidTy(M.getContext()), /* actual 1 type */ IntegerType::get(M.getContext(), 32), NULL); } if ( !...
2009 Apr 15
0
[LLVMdev] Patch: MSIL backend global pointers initialization
Hi, Artur > The interesting for me part of the CallInst is printf(i8* noalias %0, i32 > 123). > I was diging in doxygen documentation but I really can't see the easy way to > compare those instructions and again finish with reinvented (but working) > wheel ;). Ah, sorry. I missed that you're doing variadic calls, not casting variadic function to definite ones. I think you
2012 Mar 16
1
[LLVMdev] Lowering formal pointer arguments
Hi Patrik, > DAG.getMachineFunction().getFunction() only works in LowerFormalArguments (there it returns the callee), not in LowerCall (where it returns the caller, rather than the callee). You need to pass more information about the function type to LowerCall (besides partial information such as the isVarArg parameter). > > I can provide a patch if you are interested. (Unfortunately,
2013 Nov 04
0
[LLVMdev] Implementing an llvm.setreturnaddress intrinsic
...: Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], []>; And I'm using it as follows: B.CreateCall2( Intrinsic::getDeclaration(M, Intrinsic::setreturnaddress), ConstantInt::get(Type::getInt32Ty(RI->getContext()), 0), B.CreateIntToPtr(ConstantInt::get(IntPtrTy, 0 /* testing */)), RA->getReturnType())); The problem I'm facing is that for some reason, my following line inside X86TargetLowering::LowerOperation is never getting called: case ISD::SETRETURNADDR: return LowerSETRETURNADDR(Op, DAG); This is despite the fact that I can confirm the following line inside SelectionDAGBuilder...
2009 Apr 15
2
[LLVMdev] Patch: MSIL backend global pointers initialization
Hello, > So, looking for type of callee (not result, but function type!) you'll > obtain the > real "signature" of callee and if you'll strip all pointer cast you'll > obtain the "declaration" (=variadic) type of the callee. Maybe I misunderstood something but I just get the variadic declaration not the real "signature", like this: const
2007 Dec 03
1
[LLVMdev] Using Function Passes from Module Passes
Dear All, I'm having some problems using a function pass from a Module pass. My code is as follows: DominatorTree & domTree; ... Function &F = *I; // I is an interator from using Module::begin() ... domTree = getAnalysis<DominatorTree>(F); When I compile this code, I get the following error: /home/vadve/criswell/src/llvm22/include/llvm/Pass.h: In member function
2009 Apr 16
2
[LLVMdev] Patch: MSIL backend global pointers initialization
...given CallSite FunctionType* MSILWriter::getCallSiteFType(CallSite CS) { std::vector<const Type *> params; CallSite::arg_iterator AI=CS.arg_begin(), AE = CS.arg_end(); for ( ; AI!=AE; ++AI ) params.push_back((*AI)->getType()); return FunctionType::get(CS.getCalledFunction()->getReturnType(), params,CS.getCalledFunction()->isVarArg()); } Thanks! Regards, Artur -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090416/43320474/attachment.html>