Skip to content

Commit

Permalink
fix bin/dune
Browse files Browse the repository at this point in the history
  • Loading branch information
ailrst committed Jan 21, 2025
1 parent a1d8a2b commit fbe5d55
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
(modes exe)
(modules offline_coverage)
(flags (-cclib -lstdc++))
(libraries asli.libASL offlineASL))
(libraries asli.libASL aslp_offline.aarch64))

(executable
(name offline_sem)
Expand All @@ -51,4 +51,4 @@
(modes exe)
(modules offline_sem)
(flags (-cclib -lstdc++))
(libraries asli.libASL offlineASL))
(libraries asli.libASL aslp_offline.aarch64 aslp_offline.pc_aarch64))
4 changes: 3 additions & 1 deletion bin/offline_sem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ open Asl_utils
let run (opcode: string) (pc: int option) =
let op = Z.of_string opcode in
let bv = Primops.prim_cvt_int_bits (Z.of_int 32) op in
let stmts = OfflineASL.Offline.run bv in
let stmts = match pc with
| None -> OfflineASL.Offline.run bv
| Some x -> OfflineASL_pc.Offline.run ~pc:x bv in
List.iter (fun s -> Printf.printf "%s\n" (pp_stmt s)) stmts

let opt_instr = ref []
Expand Down
11 changes: 8 additions & 3 deletions libASL/ocaml_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@ let write_new_dune_file use_pc files dir : unit =
let target_gen_files = String.concat "" @@ List.map (fun k ->
Printf.sprintf " %s.ml\n" k
) files in
let oc = open_out (dir ^ "/dune") in
let oc = open_out (dir ^ "/dune.template") in
Printf.fprintf oc "(rule
(targets\n%s)
(targets\n%s
dune.template
)
(deps gen-command)
(action (with-stdin-from gen-command (run asli)))
)" target_gen_files ;
Expand All @@ -410,7 +412,7 @@ let write_new_dune_file use_pc files dir : unit =

(* Write the dune build file *)
let write_dune_file use_pc files dir =
let oc = open_out (dir ^ "/dune") in
let oc = open_out (dir ^ "/dune.template") in
Printf.fprintf oc "; AUTO-GENERATED BY OCAML BACKEND
(library
(name offlineASL)
Expand Down Expand Up @@ -438,7 +440,10 @@ let run config dfn dfnsig tests fns =
let files = (write_test_file tests dir)::files in
let decoder = write_decoder_file config.use_pc dfn dfnsig files dir in
write_ibi dir ;
try
write_new_dune_file config.use_pc (decoder::files@global_deps) dir
with
| Sys_error _ as e -> Printf.eprintf "failed to write dune file\n%s" (Printexc.to_string e); Printexc.print_backtrace stderr

module OcamlBackend : Backend = struct
let run ~(config:conf) dfn dfnsig tests fns = run config dfn dfnsig tests fns
Expand Down
2 changes: 2 additions & 0 deletions libASL/symbolic_lifter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ let run include_pc iset pat env : offline_result =

let run_marshal include_pc iset pat env : offline_result =
let fname = Printf.sprintf "marshalled-offline-lifter-%x"
(*FIXME: I don't think this is working as expected *)
(Hashtbl.seeded_hash 1234 (Printf.sprintf "%b %s %s" include_pc iset pat))
in
if (Sys.file_exists fname)
Expand All @@ -431,5 +432,6 @@ let run_marshal include_pc iset pat env : offline_result =
else
let r: offline_result = run include_pc iset pat env in
let oc = open_out_bin fname in
Printf.printf "Writing marshalled lifter (pc: %b iset: %s pat: %s): %s\n" include_pc iset pat fname;
Marshal.to_channel oc r []; close_out oc;
r
3 changes: 2 additions & 1 deletion offlineASL-pc/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(rule
(targets
offline.ml
dune.template
decode_tests.ml
aarch64_vector_transfer_vector_table.ml
aarch64_vector_transfer_vector_permute_zip.ml
Expand Down Expand Up @@ -754,4 +755,4 @@
Offline_utils
)
(libraries asli.libASL-stage0))
(alias (name default) (deps (package aslp_offline) ../aslp_offline.install))
(alias (name default) (deps (package aslp_offline) ../aslp_offline.install))
8 changes: 4 additions & 4 deletions offlineASL/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

(rule (targets
offline.ml
offline.ml
dune.template
decode_tests.ml
aarch64_vector_transfer_vector_table.ml
aarch64_vector_transfer_vector_permute_zip.ml
Expand Down Expand Up @@ -370,7 +371,6 @@
aarch64_branch_conditional_cond.ml
aarch64_branch_conditional_compare.ml
Offline_utils.ml

)
(deps gen-command)
(action
Expand All @@ -379,7 +379,7 @@


(library
(name off)
(name offlineASL)
(public_name aslp_offline.aarch64)
(flags
(:standard -w -27 -w -33 -cclib -lstdc++))
Expand Down Expand Up @@ -755,4 +755,4 @@
aarch64_branch_conditional_compare
Offline_utils
)
(libraries asli.libASL))
(libraries asli.libASL))

0 comments on commit fbe5d55

Please sign in to comment.