search for: llvmmemorybufferref

Displaying 17 results from an estimated 17 matches for "llvmmemorybufferref".

2017 Mar 08
2
LLVMGetBitcodeModuleInContext2 problem
I'm trying to use LLVMGetBitcodeModuleInContext2 to load a .bc file. However, it's not working. The code looks something like this: void llvm_load_IR_library(char *path) { LLVMContextRef global_context; LLVMMemoryBufferRef module_path; LLVMModuleRef ir_lib_module; bool flag; module_path = LLVMCreateMemoryBufferWithMemoryRange(path, strlen(path), "path", 1); global_context = LLVMGetGlobalContext(); flag = LLVMGetBitcodeModuleInContext2(global_context, module_path, &...
2016 Sep 12
2
Counterintuitive use of LLVMBool in C-API?
Hi, I stumbled across the following: > /* Builds a module from the bitcode in the specified memory buffer, > returning a > reference to the module via the OutModule parameter. Returns 0 on success. > */ > LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, > LLVMModuleRef *OutModule); However in most scenarios i know, a Bool is something like 0 = False !0 = True In short: is it just me or is this really counterintuitive? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/ll...
2017 Mar 09
2
LLVMGetBitcodeModuleInContext2 problem
...> wrote: > Made it a bit further. Here's the current code: > > void llvm_load_IR_library(char *path) > { > char *error; > LLVMExecutionEngineRef engine; > object0_t* (*func)(void), *output; > LLVMContextRef global_context; > LLVMMemoryBufferRef module; > LLVMModuleRef ir_lib_module; > bool flag; > > printf("loading IR library from path: %s\n", path); > > LLVMCreateMemoryBufferWithContentsOfFile(path, &module, &error); > > global_context = LLVMGetGlobalContex...
2016 Sep 12
1
Counterintuitive use of LLVMBool in C-API?
...s.llvm.org> wrote: > > > > I stumbled across the following: > > /* Builds a module from the bitcode in the specified memory buffer, > returning a > > reference to the module via the OutModule parameter. Returns 0 on > success. */ > > LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, > > LLVMModuleRef *OutModule); > > However in most scenarios i know, a Bool is something like > > 0 = False > > !0 = True > > > > In short: is it just me or is this really counterintuitive? > > It is counterintuitive, but it is also consistent with...
2014 Apr 04
2
[LLVMdev] Weird problems on calling an external function from MCJIT on Windows(mingw)
...); LLVMInitializeAllTargetMCs(); LLVMInitializeAllTargetInfos(); LLVMInitializeAllAsmParsers(); LLVMInitializeAllAsmPrinters(); LLVMInitializeAllDisassemblers(); // just initialize them all.... prt(a_outside_func(50)); // afraid of linker optmize it out char *err = 0; LLVMMemoryBufferRef ll_f = 0; LLVMModuleRef m = 0; LLVMCreateMemoryBufferWithContentsOfFile("test_load_lib.ll",&ll_f,&err); //read .ll prt(err); LLVMParseIRInContext(LLVMGetGlobalContext(),ll_f,&m,&err); // ll_f doesnt need freeing prt(err); LLVMDumpModule(m); LLVMLinkInMCJIT...
2008 May 22
3
[LLVMdev] How to get a return type of a function with LLVM-C API
Hi LLVM-ers, I am trying to get a return type of a function(from bitcode file) with LLVM-C API, but there seems no appropriate API to do that. I've tried to do that with following code, ---- LLVMModuleRef M; LLVMMemoryBufferRef MemBuf; LLVMValueRef F; // Function LLVMTypeRef RetTy; char *ErrStr; // // -- Load shader module // ret = LLVMCreateMemoryBufferWithContentsOfFile( input, &MemBuf, // [out] &ErrStr); // [out] ret = LLVMPars...
2014 Apr 04
2
[LLVMdev] Weird problems on calling an external function from MCJIT on Windows(mingw)
...> LLVMInitializeAllAsmParsers(); > > LLVMInitializeAllAsmPrinters(); > > LLVMInitializeAllDisassemblers(); // just initialize them all.... > > prt(a_outside_func(50)); // afraid of linker optmize it > out > > > > char *err = 0; > > LLVMMemoryBufferRef ll_f = 0; > > LLVMModuleRef m = 0; > > > LLVMCreateMemoryBufferWithContentsOfFile("test_load_lib.ll",&ll_f,&err); > > //read .ll > > prt(err); > > LLVMParseIRInContext(LLVMGetGlobalContext(),ll_f,&m,&err); // ll_f > doesnt > &gt...
2017 Mar 08
2
LLVMGetBitcodeModuleInContext2 problem
Or do you mean I need to load the module into memory before calling LLVMGetBitcodeModuleInContext2? > Yes, you need to load the module into memory first. > LLVMCreateMemoryBufferWithContentsOfFile will do that for you. Thanks! On Wed, Mar 8, 2017 at 3:48 PM, Friedman, Eli <efriedma at codeaurora.org> wrote: > On 3/8/2017 3:44 PM, Toshiyasu Morita wrote: > > >>
2014 Apr 04
2
[LLVMdev] Weird problems on calling an external function from MCJIT on Windows(mingw)
...AllAsmPrinters(); > >> > LLVMInitializeAllDisassemblers(); // just initialize them all.... > >> > prt(a_outside_func(50)); // afraid of linker optmize > it > >> > out > >> > > >> > char *err = 0; > >> > LLVMMemoryBufferRef ll_f = 0; > >> > LLVMModuleRef m = 0; > >> > > >> > > LLVMCreateMemoryBufferWithContentsOfFile("test_load_lib.ll",&ll_f,&err); > >> > //read .ll > >> > prt(err); > >> > LLVMParseIRInContext(LLVMGetGlo...
2012 Feb 07
0
[LLVMdev] Create ObjectFile with C bindings
Hey! I've been studying the LLVM C bindings (include/llvm-c/) and it 's not very clear to me how I could create an ELF object file with them. Function "LLVMCreateObjectFile" (in Object.h) needs an "LLVMMemoryBufferRef" object but I'm not sure how I should create one using the created "LLVMModuleRef". The reason why I want to use the C bindings and not the C++ interface is because I use them through some Erlang NIFs [1]. I apologize if it's something obvious that I'm missing! Best...
2017 Mar 08
2
LLVMGetBitcodeModuleInContext2 problem
...trying to use LLVMGetBitcodeModuleInContext2 to load a .bc file. >> However, it's not working. >> >> The code looks something like this: >> >> void llvm_load_IR_library(char *path) >> >> { >> LLVMContextRef global_context; >> LLVMMemoryBufferRef module_path; >> LLVMModuleRef ir_lib_module; >> bool flag; >> >> module_path = LLVMCreateMemoryBufferWithMemoryRange(path, >> strlen(path), "path", 1); >> > > LLVMCreateMemoryBufferWithContentsOfFile takes a path. > >...
2017 Sep 18
0
Counterintuitive use of LLVMBool in C-API?
...t; > >> > I stumbled across the following: >> > /* Builds a module from the bitcode in the specified memory buffer, >> returning a >> > reference to the module via the OutModule parameter. Returns 0 on >> success. */ >> > LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, >> > LLVMModuleRef *OutModule); >> > However in most scenarios i know, a Bool is something like >> > 0 = False >> > !0 = True >> > >> > In short: is it just me or is this really counterintuitive? >> >> It is counterintuitive,...
2013 May 05
0
[LLVMdev] llvm-c: Types of functions
...the function and from that pull it's type as a LLVMTypeRef. This would be a 'function type', from which I can pull info about the return type and iterate the arguments, etc. At least, that's what I'm trying to do in my code: LLVMContextRef context = LLVMContextCreate(); LLVMMemoryBufferRef fileMemBuff; LLVMCreateMemoryBufferWithContentsOfFile( "test.bin", &fileMemBuff, &msg); LLVMModuleRef module; LLVMGetBitcodeModuleInContext( context, fileMemBuff, &module, &msg); LLVMValueRef testFunc = LLVMGetNamedFunction(m...
2008 Mar 04
1
[LLVMdev] [PATCH] Prefer to use *.opt ocaml executables as they are more efficient.
I noticed that the ocaml compilation isn't using the .opt executables if they're available. We might gain a slight optimization in ocaml compile time by optionally using them with this patch. --- autoconf/configure.ac | 18 +++++ configure | 195 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 188 insertions(+), 25 deletions(-) -------------- next part
2008 Mar 04
0
[LLVMdev] [PATCH] Cleanup the c and ocaml binding documentation.
...uleProvider] class. > */ > typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef; > > /* Used to provide a module to JIT or interpreter. > - * See the llvm::MemoryBuffer class. > + * See the [llvm::MemoryBuffer] class. > */ > typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef; > > @@ -165,18 +165,21 @@ void LLVMDisposeMessage(char *Message); > /*===-- Modules > -----------------------------------------------------------===*/ > > /* Create and destroy modules. */ > +/** See [llvm::Module::Module]. */ > LLVMModuleRef LLVMModuleCreateWithName(cons...
2008 Mar 04
1
[LLVMdev] [PATCH] Cleanup the c and ocaml binding documentation.
--- bindings/ocaml/llvm/llvm.ml | 2 +- bindings/ocaml/llvm/llvm.mli | 2 +- bindings/ocaml/llvm/llvm_ocaml.c | 2 +- include/llvm-c/Core.h | 32 +++++++++++++++++++------------- 4 files changed, 22 insertions(+), 16 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 316a84e85ed2363551149e65a227c8e7c8192624.diff Type:
2013 Sep 30
1
[LLVMdev] RFC: llvm-shlib-test (Was: [llvm] r191029 - llvm-c: Make LLVMGetFirstTarget a proper prototype)
Attached is what I got thus far. What I'm struggling with is proper integration in build system. What is in there is just wild guesses from my side, both on autoconf and cmake variants. It would be great if someone with proper knowledge of the buildsystems could have a look. Also I'm not sure how to properly handle compilation on msvc - clearly "-std=c11 -Wstrict-prototypes" is