search for: llvmrunfunct

Displaying 13 results from an estimated 13 matches for "llvmrunfunct".

2016 Jul 11
2
More function signatures for LLVMRunFunction?
Hello, I am new to LLVM, and came across a snag when working through tutorials. With the MC JIT execution engine, LLVMRunFunction only works on "main()"-like functions -- other functions fail with the message "Full-featured argument passing not supported yet!". The workaround recommended by the tutorials is to create a main()-compatible wrapper function and to send in parameters via pointer. Are there...
2017 Jan 25
2
mcjit C interface problems
...args[] = {LLVMCreateGenericValueOfInt(LLVMInt32Type(), x, 0), LLVMCreateGenericValueOfInt(LLVMInt32Type(), y, 0)}; printf("args[0]: %d\n", (int)LLVMGenericValueToInt(args[0], 0)); printf("args[1]: %d\n", (int)LLVMGenericValueToInt(args[1], 0)); LLVMGenericValueRef res = LLVMRunFunction(engine, sum, 2, args); printf("result: %d\n", (int)LLVMGenericValueToInt(res, 0)); LLVMDumpModule(mod); // Write out bitcode to file if (LLVMWriteBitcodeToFile(mod, "sum.bc") != 0) { fprintf(stderr, "error writing bitcode to file, skipping\n"); } LLVMD...
2016 Jul 15
2
More function signatures for LLVMRunFunction?
Hi Lang, Thanks for the reply. Responses below. As far as I know nobody is actively working on MCJIT any more. I've been > working on the next generation of LLVM JIT APIs (ORC - see > include/llvm/ExecutionEngine/Orc) for a while now, but they don't have > functionality for running arbitrary functions yet. > Thanks for the pointer to ORC -- it looks like the runFunction
2015 Jan 08
2
[LLVMdev] JIT simple module and accessing the value fails
I'm using the llvm-c API and want to use the JIT. I've created the following module ; ModuleID = '_tmp' @a = global i64 5 define i64 @__tempfunc() { entry: %a_val = load i64* @a ret i64 %a_val } This output is generated by LLVMDumpModule just before I call LLVMRunFunction. Which yields a LLVMGenericValueRef. However converting the result to a 64bit integer via LLVMGenericValueToInt(gv, true), it results in 360287970189639680 or something similar - not 5. Converting via LLVMGenericValueToInt(gv, false) didn't help either. How can I use global variables in...
2016 Aug 10
2
crash JIT with AVX intrinsics
Hi all, I have some old code using the JIT via the LLVM-3.0-C API. I want to upgrade to newer versions of LLVM. As a simple example I wrote a C program that creates the following function and calls it: ; ModuleID = 'round-avx.bc' target triple = "x86_64-pc-linux-gnu" define void @round(<8 x float>*) { _L1: %1 = load <8 x float>* %0 %2 = call <8 x
2012 Apr 25
2
[LLVMdev] Crash in JIT
...ess=0x60c93a2c) frame #0: 0x0000000102e00042 frame #1: 0x00000001015c01fb LLVMPlayGround`llvm::JIT::runFunction(llvm::Function*, std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> > const&) + 4747 at JIT.cpp:547 frame #2: 0x00000001015a0db2 LLVMPlayGround`LLVMRunFunction + 322 at ExecutionEngineBindings.cpp:195 frame #3: 0x0000000101096125 LLVMPlayGround`main + 741 at main.c:91 frame #4: 0x0000000101095e34 LLVMPlayGround`start + 52 Which looks to be in some non-c code. At least XCode cannot find any corresponding source: 0x102e00042: movl $10, (%rsp)...
2012 Apr 25
0
[LLVMdev] Crash in JIT
...ess=0x60c93a2c) frame #0: 0x0000000102e00042 frame #1: 0x00000001015c01fb LLVMPlayGround`llvm::JIT::runFunction(llvm::Function*, std::vector<llvm::GenericValue, std::allocator<llvm::GenericValue> > const&) + 4747 at JIT.cpp:547 frame #2: 0x00000001015a0db2 LLVMPlayGround`LLVMRunFunction + 322 at ExecutionEngineBindings.cpp:195 frame #3: 0x0000000101096125 LLVMPlayGround`main + 741 at main.c:91 frame #4: 0x0000000101095e34 LLVMPlayGround`start + 52 Which looks to be in some non-c code. At least XCode cannot find any corresponding source: 0x102e00042: movl $10, (%rsp)...
2010 Aug 12
3
[LLVMdev] LLVM-C: Calling functions contained in other libraries
...engine; LLVMModuleRef module = LLVMModuleCreateWithName("MyModule"); LLVMValueRef toCall = d(module); LLVMDumpModule(module); LLVMLinkInInterpreter(); LLVMCreateInterpreterForModule(&engine, module, &error); LLVMGenericValueRef result = LLVMRunFunction(engine, toCall, 0, NULL); LLVMDisposeModule(module); [pool drain]; return 0; } Thank you, Filip -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100812/388c33da/attachment.html>
2017 Jan 26
2
mcjit C interface problems
...> > > LLVMCreateGenericValueOfInt(LLVMInt32Type(), y, 0)}; > > > > printf("args[0]: %d\n", (int)LLVMGenericValueToInt(args[0], 0)); > > printf("args[1]: %d\n", (int)LLVMGenericValueToInt(args[1], 0)); > > > > LLVMGenericValueRef res = LLVMRunFunction(engine, sum, 2, args); > > > > printf("result: %d\n", (int)LLVMGenericValueToInt(res, 0)); > > > It seems to fail to add, and always returns the first argument. > > Any help greatly appreciated. > > I don't think LLVMGenericValueToInt / LLVMRunFun...
2009 Dec 24
0
[LLVMdev] Running functions built with the LLVM C API
...opriate type, and then call it. There isn’t a tutorial using the LLVM C API that I’ve seen, so I’ve been working with bits and pieces found online, and of course the header files. I haven’t been able to find an equivalent to getPointerToFunction as yet, however. The JIT example I found[1] is using LLVMRunFunction, with requisite boxing of arguments and unboxing of return value. Is this the recommended route? Is the C API just lacking a getPointerToFunction equivalent? If so, I imagine it will be fairly straightforward to add one, which I’ll be happy to do. Thanks very much, Rob [1]: http://npcontempla...
2010 Aug 12
0
[LLVMdev] LLVM-C: Calling functions contained in other libraries
On Aug 12, 2010, at 10:43 AM, F van der Meeren wrote: > Where am I going wrong here? > Did you link against the library that contains the function? -eric
2010 Oct 25
0
[LLVMdev] Ocaml bindings for execution engines
...tionEngineRef EE) { unsigned NumArgs; LLVMGenericValueRef Result, *GVArgs; unsigned I; NumArgs = Wosize_val(Args); GVArgs = (LLVMGenericValueRef*) malloc(NumArgs * sizeof(LLVMGenericValueRef)); for (I = 0; I != NumArgs; ++I) GVArgs[I] = Genericvalue_val(Field(Args, I)); Result = LLVMRunFunction(EE, F, NumArgs, GVArgs); free(GVArgs); return alloc_generic_value(Result); } I noticed that the Args parameter has not been protected by CAMLparam with CAMLreturn. Is this safe in this case, because we allocated a GVArgs? The other bindings files, sometimes, also ignore CAMLparam and CAMLr...
2009 Nov 05
2
[LLVMdev] Strange error for libLLVMCore.a
...ference to `LLVMRunPassManager' c:\Work\llvm//fac.c:77: undefined reference to `LLVMDumpModule' c:\Work\llvm//fac.c:79: undefined reference to `LLVMInt32Type' c:\Work\llvm//fac.c:79: undefined reference to `LLVMCreateGenericValueOfInt' c:\Work\llvm//fac.c:80: undefined reference to `LLVMRunFunction' c:\Work\llvm//fac.c:83: undefined reference to `LLVMGenericValueToInt' c:\Work\llvm//fac.c:85: undefined reference to `LLVMDisposePassManager' c:\Work\llvm//fac.c:86: undefined reference to `LLVMDisposeBuilder' c:\Work\llvm//fac.c:87: undefined reference to `LLVMDisposeExecution...