search for: llvmgenericvaluetoint

Displaying 6 results from an estimated 6 matches for "llvmgenericvaluetoint".

2017 Jan 25
2
mcjit C interface problems
...); exit(EXIT_FAILURE); } long long x = strtoll(argv[1], NULL, 10); long long y = strtoll(argv[2], NULL, 10); LLVMGenericValueRef 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 (LLVMW...
2017 Jan 26
2
mcjit C interface problems
Thanks for the tip - getting closer: $ ./capi_test 5 6 args[0]: 5 args[1]: 6 result: 4294959200 Here's the code I changed: printf("args[0]: %d\n", (int)LLVMGenericValueToInt(args[0], 0)); printf("args[1]: %d\n", (int)LLVMGenericValueToInt(args[1], 0)); uint64_t (*func)(); func = (uint64_t (*)())LLVMGetFunctionAddress(engine, "sum"); printf("result: %lu\n", (*func)()); Anything else I should look at? Toshi On Wed, Jan 25, 2017...
2015 Jan 08
2
[LLVMdev] JIT simple module and accessing the value fails
...le ; 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 a JIT situation? Is anything wrong with the IR?
2012 Apr 25
2
[LLVMdev] Crash in JIT
...ericValueRef argX = LLVMCreateGenericValueOfInt(int32, 5, 0); LLVMGenericValueRef argB = LLVMCreateGenericValueOfInt(int32, 1, 0); LLVMGenericValueRef args[] = {argM, argX, argB}; LLVMGenericValueRef result2 = LLVMRunFunction(jit, func, 3, args); unsigned long long answer = LLVMGenericValueToInt(result2, 0); printf("And the answer is %d\n", (int)answer); LLVMDisposeModule(module); LLVMContextDispose(llvm); return 0; } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120...
2012 Apr 25
0
[LLVMdev] Crash in JIT
...LLVMGenericValueRef argX = LLVMCreateGenericValueOfInt(int32, 5, 0); LLVMGenericValueRef argB = LLVMCreateGenericValueOfInt(int32, 1, 0); LLVMGenericValueRef args[] = {argM, argX, argB}; LLVMGenericValueRef result2 = LLVMRunFunction(jit, func, 3, args); unsigned long long answer = LLVMGenericValueToInt(result2, 0); printf("And the answer is %d\n", (int)answer); LLVMDisposeModule(module); LLVMContextDispose(llvm); return 0; } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120425...
2009 Nov 05
2
[LLVMdev] Strange error for libLLVMCore.a
...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 `LLVMDisposeExecutionEngine' collect2: ld returned 1 exit status $ llvm-config --libs --cflags...