summaryrefslogtreecommitdiff
path: root/src/slice.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-10-14 19:55:08 +0100
committerAlasdair Armstrong2019-10-14 20:14:43 +0100
commit5056bf80156738b3ed146ae052f751fa703fecad (patch)
tree15a9d4adfbff57fae1ea3988844d2a4bdc59c7e2 /src/slice.ml
parent2374aea33aa332f3927dd4dc4d6d9a15f5620ac9 (diff)
Add -Ofixed_int and -Ofixed_bits to assume fixed-precision ints and bitvectors in C
Assumes a Sail C library that has functions with the right types to support this. Currently lib/int128 supports the -Ofixed_int option, which was previously -Oint128. Add a version of Sail C library that can be built with -nostdlib and -ffreestanding, assuming the above options. Currently just a header file without any implementation, but with the right types
Diffstat (limited to 'src/slice.ml')
-rw-r--r--src/slice.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/slice.ml b/src/slice.ml
index 427d5913..0011bb4d 100644
--- a/src/slice.ml
+++ b/src/slice.ml
@@ -173,6 +173,15 @@ let add_def_to_graph graph def =
IdSet.iter (fun id -> graph := G.add_edge self (Type id) !graph) (typ_ids typ)
| LEXP_memory (id, _) ->
graph := G.add_edge self (Function id) !graph
+ | LEXP_id id ->
+ begin match Env.lookup_id id env with
+ | Register _ -> graph := G.add_edge self (Register id) !graph
+ | Enum _ -> graph := G.add_edge self (Constructor id) !graph
+ | _ ->
+ if IdSet.mem id (Env.get_toplevel_lets env) then
+ graph := G.add_edge self (Letbind id) !graph
+ else ()
+ end
| _ -> ()
end;
LEXP_aux (lexp_aux, annot)
@@ -204,6 +213,7 @@ let add_def_to_graph graph def =
E_aux (e_aux, annot)
in
let rw_exp self = { id_exp_alg with e_aux = (fun (e_aux, annot) -> scan_exp self e_aux annot);
+ lEXP_aux = (fun (l_aux, annot) -> scan_lexp self l_aux annot);
pat_alg = rw_pat self } in
let rewriters self =