similar to: [LLVMdev] Function Arguments

Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] Function Arguments"

2012 Sep 05
1
[LLVMdev] Calling a function with a pointer to a global char array as argument
Hello; Thanks to Eli for the pointer to the ConstantDataArray::getString() fucntion. Now I am trying to declare a global char array with the content "hi" and call a function "print" (which takes a char pointer and return an insteger. I am doing the following in the code - Function Creation: PointerType* array = PointerType::get(IntegerType::getInt8Ty(getGlobalContext())
2015 Mar 10
4
[LLVMdev] noob IR builder question
I am trying to get a handle on IR builder, at least some basics. I ran through a tutorial here: Create a working compiler with the LLVM framework, Part 1 <http://www.ibm.com/developerworks/library/os-createcompilerllvm1/>, and it worked well enough. I have some simple code that creates a hello world IR. I am trying to now bring in some concepts from the Kaleidoscope tutorial, namely
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
ok, i have changed functionType code to: llvm::FunctionType* ft = llvm::FunctionType::get(llvm::Type::getInt32Ty(llvm::getGlobalContext()), std::vector<const llvm::Type*>(1, llvm::Type::getInt32Ty(llvm::getGlobalContext())), false); when I run my app the compiler says: E:\Projects\Whistle\Whistle\Release>Whistle file.c file.c(3) : warning: implicit declaration of function
2013 May 21
1
[LLVMdev] Is it valid to add parameters to a function once it is created
I create a function with an empty signature: void llvm_start_new_function() { llvm::outs() << "Staring new LLVM function ...\n"; Mod = new llvm::Module("module", llvm::getGlobalContext()); builder = new llvm::IRBuilder<>(llvm::getGlobalContext()); llvm::FunctionType *funcType = llvm::FunctionType::get(builder->getVoidTy(), false);
2013 Nov 26
0
[LLVMdev] Help needed with a pass
I'm a newbie to LLVM and I've really been struggling to write a pass which changes the behavior of the following function: #include<stdlib.h>#include<stdio.h>#include<string.h>void foo(char* bar){const char* path;path=getenv(<SOME_ENV_VAR>); if (path!=NULL){strcpy(bar,path);}else{printf("env_var not set!");}} In the pass, I hope to invoke
2010 Aug 18
0
[LLVMdev] clang: call extern function using JIT
Can someone pease tell me what I am doing wrong? Im trying to register an external function with the JIT, so can call functions in my music application. Here my function int Execute(llvm::Module *Mod, char * const *envp) { llvm::InitializeNativeTarget(); std::string Error; llvm::OwningPtr<llvm::ExecutionEngine> EE( llvm::ExecutionEngine::createJIT(Mod, &Error)); if (!EE) {
2010 May 05
2
[LLVMdev] How to cast an integer array to an integer pointer? (user question)
I am new to LLVM and couldn't find any llvm-user list, so I am posting my user question here, sorry. I am trying to create a simple "puts" call accepting the static string, with the code below. The last line (CallInst::Create) fails with an assert: "Calling a function with a bad signature!" Because the type of function is void(u8*) and the argument supplied is:
2012 May 27
0
[LLVMdev] Help with Values sign
I show you the trace of calls to llvm that my compiler makes to generate the code above. bloques.back().last is of type Value* and bloques.back().bl is BasicBlock* (the current Block) bloques.back().last = dyn_cast<Value>(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), $1, true)); // $1 is an int AllocaInst *alloc = new AllocaInst(
2010 May 11
2
[LLVMdev] How to create Global Variables using LLVM API?
I am new to LLVM API. and I am experimenting with it. I want to create Global Variables in a module. I am able to create local variables using IRBuilder class. I tried using GlobalVariable class to create global variables. but it doesn't work. my code looks like this: Module* mod = new Module("test", getGlobalContext()); Constant* c = mod->getOrInsertFunction("main",
2010 Aug 18
2
[LLVMdev] clang: call extern function using JIT
gafferuk <gafferuk at gmail.com> writes: > Can someone pease tell me what I am doing wrong? It is hard to say because you don't say what the problem is, but let's try. > Im trying to register an external function with the JIT, so can call > functions in my music > > application. > > Here my function > > int Execute(llvm::Module *Mod, char * const *envp)
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 =
2010 May 11
0
[LLVMdev] How to create Global Variables using LLVM API?
subramanyam wrote: > > I am new to LLVM API. and I am experimenting with it. > I want to create Global Variables in a module. > I am able to create local variables using IRBuilder class. I tried using > GlobalVariable class to create global variables. > but it doesn't work. my code looks like this: > > Module* mod = new Module("test", getGlobalContext()); >
2009 Oct 06
0
[LLVMdev] 2.6/trunk Execution Engine question
> > It just occurred to me... in the case where it's failing, the > ExecutionEngine was trying to JIT a global, and it had never JITted > any functions!  I'll work up a small test case, but I think it's > relevant since the thing is trying to allocate the globals with the > functions. > That was it! The following small test program crashes in getPointerToGlobal:
2013 Jul 25
2
[LLVMdev] Error for AllocaInst and Instruction
Hi, For the following code const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb); Bb->getInstList().push_back(newInst); It gives me the error " error: no matching constructor for initialization of 'llvm::AllocaInst' AllocaInst* newInst = new
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
I am trying to create such module with API (it's equivalent to c++: const char* ss[] = {"s1","s2"};): @ss = global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @.str1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0)] ; <[2 x i8*]*> [#uses=0] @.str1 = private constant [3 x i8] c"s1\00", align 1 ; <[3 x i8]*> [#uses=1]
2010 Aug 18
1
[LLVMdev] clang: call extern function using JIT
Im trying to call fuctions in my music application from c code which will be used by the JIT. Here my function, i have made no other changes to the clang interpreter example. Can you see anything else I have to add to either the fuction below or to the c code to be JIT at the bottom? // function I wish to call. int yipee(int aVar) { aVar = 5; } int Execute(llvm::Module *Mod, char * const
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 declare a function that takes a function pointer
2013 Aug 19
0
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
On Aug 19, 2013, at 14:26 , chentommy <baiypwup at hotmail.com> wrote: > Hello LLVMDev List, > > > It's my first time sending a message to the List - I have been working on a tool for my research project using LLVM. Thanks for your awesome work! > > I have come across some bytecode like the following with an GetElementPtr instruction in brackets: > >
2013 Aug 19
4
[LLVMdev] Generating GetElementPtr inlined in a function argument list programmatically
Hello LLVMDev List, It's my first time sending a message to the List - I have been working on a tool for my research project using LLVM. Thanks for your awesome work! I have come across some bytecode like the following with an GetElementPtr instruction in brackets: Bytecode:%3 = call i32 @_Z4funcPKc(i8* getelementptr inbounds ([5 x i8]* @.str2, i32 0, i32 0)) C++ code:func("bleh");
2012 May 27
2
[LLVMdev] Help with Values sign
How are you checking the return value? I put your code in santos.ll and then executed it with lli, and I get 1 as a return value. lli santos.ll ; echo $? 1 Joey On 27 May 2012 16:59, Santos Merino <santitox at hotmail.es> wrote: > I show you the trace of calls to llvm that my compiler makes to generate > the > code above. bloques.back().last is of type Value* and