Displaying 4 results from an estimated 4 matches for "assert_valid_modul".
Did you mean:
assert_valid_module
2007 Nov 26
2
[LLVMdev] Fibonacci example in OCaml
...s would just magically
> work, so this:
>
> do (if 1 <= 2 then fib else fib) 40
>
> 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...
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...
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