search for: functiontype

Displaying 20 results from an estimated 402 matches for "functiontype".

2012 Nov 18
1
[LLVMdev] What is a FunctionType really?
On 18/11/12 18:37, David Blaikie wrote: > Types, function or otherwise, have no in-memory representation. They > merely describe how bits should be interpreted. This is what I'm asking about the FunctionType. If I have a Pointer to a FunctionType it is clear how the bits should be interpreted, but what does the FunctionType it self say about the bits, if anything? In terms of use, can I create variables which are of FunctionType directly? -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -...
2010 Nov 29
3
[LLVMdev] FunctionType as a function argument
Hi all. I would like to declare a function that takes a function pointer as an argument. In C, it would be : void execute(char (*func)(void*), void *param) So, in my compiler, I have : std::vector<const Type *> cbFPtrArgs(1, Type::getInt8PtrTy(C)); FunctionType * cbFPtrTy = FunctionType::get(Type::getInt8Ty(C), cbFPtrArgs, false); Function * func = cast<Function>(M->getOrInsertFunction(fName, Type::getInt32Ty(C), cbFPtrTy, Type::getInt8PtrTy(C), (Type *)0)); But then I get an error form LLVM : /home/salomon/AppSRC/LLVM/release_28/lib/VMCore/Typ...
2009 Jul 31
2
[LLVMdev] Inserting Instructions (pass)
Hi, I' am trying to insert an InlineAsm Instruction in my pass, which FunctionType do I need for Inlineasm? If I understand it right, I need a call instruction to insert the new produced InlineAsm? Thanks for help, Michael for (BasicBlock::iterator bi = i->begin(), be = i->end(); bi != be; ++bi){ std::vector<const Type*> asm_arguments;...
2010 Nov 29
0
[LLVMdev] FunctionType as a function argument
You need a pointer-to-function type, but FunctionType just gives you a function type. Use PointerType::getUnqual(FunctionType::get(...)). Or TypeBuilder<char (*func)(void*), false>::get(context) from Support/TypeBuilder.h. On Mon, Nov 29, 2010 at 10:37 AM, Salomon Brys <salomon.brys at gmail.com>wrote: > Hi all. > I would like to d...
2009 Aug 01
2
[LLVMdev] Inserting Instructions (pass)
Thank you Chris, for your hint, but I am still too stupid. I tried two versions asm_arguments.push_back(Type::VoidTy); FunctionType *asm_type = FunctionType::get(Type::VoidTy, asm_arguments, false); Alternatively FunctionType *asm_type = FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false); . Can you give me a snippet of example code, or somebody else? Thanks for help Michael for (Basic...
2009 Jul 31
0
[LLVMdev] Inserting Instructions (pass)
On Jul 31, 2009, at 10:24 AM, Michael Graumann wrote: > Hi, > I’ am trying to insert an InlineAsm Instruction in my pass, which > FunctionType do I need for Inlineasm? > If I understand it right, I need a call instruction to insert the > new produced InlineAsm? > > Thanks for help Inline asm works like a "callee". So for: call void asm sideeffect "isync", "~{dirflag},~{fpsr},~{flags}"() nou...
2012 Nov 18
2
[LLVMdev] What is a FunctionType really?
This may sound weird, but what exactly is a FunctionType? That is, in terms of memory, or underlying value, what does the FunctionType actually represent. At first I though it might be a pointer, but it is not -- since you have to wrap a PointerType around it to use as such. Can a FunctionType value actually exist, or is strictly an abstract concept? In...
2012 Nov 18
0
[LLVMdev] What is a FunctionType really?
On Sun, Nov 18, 2012 at 6:40 AM, edA-qa mort-ora-y <eda-qa at disemia.com> wrote: > This may sound weird, but what exactly is a FunctionType? That is, in > terms of memory, or underlying value, what does the FunctionType > actually represent. At first I though it might be a pointer, but it is > not -- since you have to wrap a PointerType around it to use as such. > Can a FunctionType value actually exist, or is strictly an a...
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
Hi, I'm trying to get my head around c++ - IR - c++ API and getting used tramform manual information to code. The manual states alloca is defined for <type>. FunstionType is a type, so alloca for functionType should be possible? Not? If we have a valid Module *m we can get an allocate instruction allocating space for a non-argumented function as follows: AllocaInst* pa2 = new AllocaInst( FunctionType::get( Type::getVoidTy(m->getContext()), false ) , 1, "myName"); b...
2009 Aug 01
1
[LLVMdev] Inserting Instructions (pass)
Hi, both versions are working: FunctionType *asm_Ftype = FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false); InlineAsm* Iasm = InlineAsm::get(asm_Ftype,"isync","~{dirflag},~{fpsr},~{flags}",true); How can I insert this InlineAsm, because it is no instruction and this way it will not work: In...
2009 Jan 02
1
[LLVMdev] Function Type and Argument List
Hi all, I am having some problem using the Function class. For my application, FunctionType is not known at the time I initialize the function. So, I just initialize the Function as return type void with no arguments. As I work on my function, I get to know the arguments and I insert the arguments in ArgumentList data structure of the function. The FunctionType is defined as const and I c...
2009 Aug 01
0
[LLVMdev] Inserting Instructions (pass)
On Jul 31, 2009, at 5:04 PM, Michael Graumann wrote: > Thank you Chris, > for your hint, but I am still too stupid. I tried two versions > > asm_arguments.push_back(Type::VoidTy); > FunctionType *asm_type = FunctionType::get(Type::VoidTy, > asm_arguments, false); > > Alternatively > > FunctionType *asm_type = FunctionType::get(Type::VoidTy, > std::vector<const Type*>(), false); > > . Can you give me a snippet of example code, or somebody else? > Thanks...
2011 Jul 09
4
[LLVMdev] type-system-rewrite branch landing tomorrow
...]: Entering directory `/home/jay/llvm/objdir-self/tools/opt' llvm[2]: Compiling GraphPrinters.cpp for Debug+Asserts build clang: /home/jay/svn/llvm-project/llvm/trunk/include/llvm/Support/Casting.h:194: typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X = llvm::FunctionType, Y = llvm::Type*, typename llvm::cast_retty<To, From>::ret_type = llvm::FunctionType*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed. This is one of the cases that was giving me grief when I was working on the Clang bits! Her...
2011 Jul 05
2
[LLVMdev] [type-system-rewrite][PATCH] de-constify Type* in FunctionType::get()
This patch removes the deprecated form of FunctionType::get() which takes "const Type*"s for the argument types, and replaces just enough "const Type*" with "Type*" elsewhere to get everything building cleanly again. (My motivation for this was that I was getting ambiguous overload errors from some calls to FunctionType::g...
2013 Nov 26
2
[LLVMdev] Disabling optimizations when using llvm::createPrintModulePass
...#39;d like to see the operations that are necessary to compute the result, though. Can I somehow disable this optimization in the pass, leading to more verbose IR code? Here is the code I use to create the IR: llvm::LLVMContext c; llvm::Module module("test", c); llvm::Type * functionType = llvm::IntegerType::get(c, 16); llvm::Function * llvmFunction = llvm::cast <llvm::Function>(module.getOrInsertFunction("foo", functionType, nullptr)); llvmFunction->setCallingConv(llvm::CallingConv::C); llvm::BasicBlock * body = llvm::BasicBlock::Create(c, "__en...
2008 Nov 12
2
[LLVMdev] RefineAbstractType
...a function pointer that takes a pointer to itself > has to do with opaque types, but you'd write it like this: It has to do with the way we're processing things right now. We have to break the processing recursion so we create an Opaque type as a stand-in for the (yet-to-be-completed) FunctionType when we encounter an argument referencing the (yet-to-be-completed) FunctionType. We want to resolve those OpaqueTypes once we have the FunctionType constructed. > > %t = type void (%t)* > > or if you want the function: > > %t = type void (%t*) Cool. > > Unfortunately, c...
2011 Feb 28
2
[LLVMdev] Extending FunctionType
Hi all, I am trying to extend a FunctionType to include new parameters. In particular, I want to ensure that the main function has been declared with both argsc and argsv. However there seems to be no easy way to accomplish this: llvm::Function::getFunctionType() returns a a reference to a const object, while modifying only the argument li...
2011 Jul 05
0
[LLVMdev] [type-system-rewrite][PATCH] de-constify Type* in FunctionType::get()
...tal. Unfortunately I'm struggling to find time to finish things up and land the branch (this week for sure! :). Since you've already done this work, go ahead and land it if you'd like. -Chris On Jul 5, 2011, at 2:48 AM, Jay Foad wrote: > This patch removes the deprecated form of FunctionType::get() which > takes "const Type*"s for the argument types, and replaces just enough > "const Type*" with "Type*" elsewhere to get everything building > cleanly again. (My motivation for this was that I was getting > ambiguous overload errors from some call...
2015 Mar 10
4
[LLVMdev] noob IR builder question
...ng namespace llvm; 2 3 llvm::Module *module; 4 llvm::IRBuilder<> builder(getGlobalContext()); 5 6 int main(int argc, const char * argv[]) { 7 llvm::LLVMContext & context = llvm::getGlobalContext(); 8 module = new llvm::Module("calc", context); 9 10 11 llvm::FunctionType *funcType = llvm::FunctionType::get(builder.getVoidTy(), false); 12 llvm::Function *mainFunc = 13 llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, "main", module); 14 llvm::BasicBlock *entry = llvm::BasicBlock::Create(context, "entrypoint", mainFunc); 15...
2016 Sep 19
3
llvm interpreter does not find function defined by addGlobalMapping
...ecutionEngine = llvm::EngineBuilder(std::unique_ptr<llvm::Module>(pModule) ).setEngineKind(llvm::EngineKind::Interpreter).create(); pModule->setDataLayout(pExecutionEngine->getDataLayout()); // declaration of the c function. std::vector<llvm::Type *> noArgTypes; llvm::FunctionType* ft = llvm::FunctionType::get(llvm::Type::getDoubleTy(context),noArgTypes, false); auto pFunction = llvm::Function::Create(ft, llvm::Function::ExternalLinkage, "testFunction",pModule); pExecutionEngine->addGlobalMapping(pFunction,reinterpret_cast<void*>(&testFunction));...