search for: dump_module

Displaying 5 results from an estimated 5 matches for "dump_module".

2007 Nov 26
2
[LLVMdev] Fibonacci example in OCaml
...> would run, but instead it produces this error: > > $ llc -f run.bc -o run.s > llc: bitcode didn't read correctly. > Reason: Invalid instruction with no BB Try 'Llvm_analysis.assert_valid_module m;' before you write bitcode to figure out where things went awry. ('dump_module m;' may also help.) GIGO applies (but garbage-in/segfault-out is more likely). Unfortunately, even if the bindings were more strongly typed, it would still be structurally possible to build invalid LLVM code, so you've just got to take care not to violate the invariants, then use the...
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
On Monday 26 November 2007 16:21, Gordon Henriksen wrote: > Try 'Llvm_analysis.assert_valid_module m;' before you write bitcode to > figure out where things went awry. ('dump_module m;' may also help.) > GIGO applies (but garbage-in/segfault-out is more likely). Ok, thanks for the tip. > Unfortunately, even if the bindings were more strongly typed, it would > still be structurally possible to build invalid LLVM code, so you've > just got to take care not...
2007 Nov 26
0
[LLVMdev] Fibonacci example in OCaml
Here is a complete 104-line native code compiler for a tiny subset of OCaml that is expressive enough to compile an external Fibonacci program: type expr = | Int of int | Var of string | BinOp of [ `Add | `Sub | `Leq ] * expr * expr | If of expr * expr * expr | Apply of expr * expr type defn = | LetRec of string * string * expr open Camlp4.PreCast;; let expr = Gram.Entry.mk
2007 Nov 25
2
[LLVMdev] Fibonacci example in OCaml
Here's my translation of the Fibonacci example into OCaml: open Printf open Llvm let build_fib m = let fibf = define_function "fib" (function_type i32_type [| i32_type |]) m in let bb = builder_at_end (entry_block fibf) in let one = const_int i32_type 1 and two = const_int i32_type 2 in let argx = param fibf 0 in set_value_name "AnArg" argx; let
2013 Jul 12
14
[LLVMdev] [Proposal] Parallelize post-IPO stage.
...erator I = Part.begin(), E = Part.end(); + I != E; I++) { + const Function *F = *I; + VMap[F] = CreateFuncDecl(F, New); + } + + for (ModPartScheme::iterator I = Part.begin(), E = Part.end(); + I != E; I++) + CollectGlobalSymbol(*I, New, VMap); +} + +void __attribute__((used)) dump_module(Module *M) { + std::string EI; + tool_output_file f("module.ll", EI); + f.keep(); + + M->print(f.os(), 0); +} + +void __attribute__((used)) dump_type(Type *T) { + T->dump(); +} + +// Splitting the merged module by moving the specified functions to the +// new module +IPOPartiti...