search for: global_context

Displaying 7 results from an estimated 7 matches for "global_context".

2017 Mar 09
2
LLVMGetBitcodeModuleInContext2 problem
...orita <toshi at tensyr.com> 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); > > gl...
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(g...
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: > > >>
2017 Feb 21
3
What is the proper usage of LLVMContext?
Hi, I'm Ryo Ota. I have two questions about `llvm::LLVMContext`. Q1) What is the difference between the following (A)`my_context` and (B)`global_context`? Do I have to create a LLVMContext by myself? Or use `getGlobalContext()`? Could you tell me what situation needs a LLVMContext which is created by myself such as (A)? (A) { llvm::LLVMContext my_context; // codes using only my_context (get Int32ty() or StructType::create or etc...) } (B) { llvm:...
2010 Jun 27
0
[LLVMdev] ocaml bindings + ocamlbuild problem
Hello, I'm trying to use Llvm_bitwriter + ocamlbuild, but it doesn't recognize its dependency on Unix, so it doesn't compile. Minimal case: (* FILE: minimal.ml *) let main () = let m = Llvm.create_module (Llvm.global_context ()) "test" in ignore (Llvm_bitwriter.output_bitcode stdout m) ;; main () (* FILE: _tags *) <*.{byte,native}>: g++, use_unix, use_llvm, use_llvm_bitwriter (* FILE: myocamlbuild.ml *) open Ocamlbuild_plugin;; ocaml_lib ~extern:true "llvm";; ocaml_lib ~extern:true &...
2013 Jan 14
0
[LLVMdev] OCaml binding: error with the function "has_metadata"
...6 I am using the latest 3.2 release from the LLVM download page and this is a small code sample that is crashing, giving the error message above: ************************************ let load_module filename = let mb = Llvm.MemoryBuffer.of_file filename in Llvm_bitreader.parse_bitcode (Llvm.global_context ()) mb let stats m = let print llvalue = if Llvm.has_metadata llvalue then Printf.printf "%s\n%!" (Llvm.value_name llvalue) in Llvm.iter_functions print m let _ = let m = load_module Sys.argv.(1) in stats m ************************************* Does a...
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); >> > > LLVMCreateMemoryBufferWith...