From 6fcda7718aa20e46415da57bc73c6caede4ebab4 Mon Sep 17 00:00:00 2001 From: Alistair Michael Date: Mon, 2 Sep 2024 13:47:45 +1000 Subject: [PATCH] Scala backend & lifter-optimiser bdd copyprop (#102) * Add scala backend for BASIL * Add lifttime PC variable Optional support for offline lifter to specify the PC value at lifttime. * Remove problematic list, add missing variables * Optional pass to remove unsupported globals * Whitespace in transforms * Re-enable case simp for offline * Decoder cleanup and sanity checks * Simplify reachability based on enc * Add lifttime PC variable Optional support for offline lifter to specify the PC value at lifttime. * Remove problematic list, add missing variables * Optional pass to remove unsupported globals * Whitespace in transforms * Re-enable case simp for offline * Decoder cleanup and sanity checks * Simplify reachability based on enc * wip rt copyprop * use bdd lattice for clobbered & read * refac * untested xform to ternary * not working * refactor so analysis and transform both called into from bdd AI walk * fix anlaysis a bit and add bvadd * cleanup bvops * Eliminate comparisons during IntToBits Leverage interval information to reduce trivial comparisons during post-passes, then cleanup in RemoveUnused. * fix rebuild expr * passing cov disabled * test and fix bdd sle/slt * Merged backends (#80) * Add scala backend for BASIL * Add C++ Backend for LLVM * add aslBackwardsVisitor * aslVisitor: change vstmt to return stmt list BREAKING! This change affects the signature of the Asl_visitor.visit_stmt method. For compatibility, a visit_stmt_single method is provided with equivalent behaviour to the old visit_stmt. There is also an added helper function to convert visitActions on single statements to visitActions on a list of statements. Both of these compatibility helpers WILL THROW if used with a visitor that returns non-singleton statement lists. This gives the user the flexibility to insert new statements or delete statements entirely. On the other hand, post-functions in ChangeDoChildrenPost will need to handle lists of functions as well. This follows the original CIL visitor: https://people.eecs.berkeley.edu/~necula/cil/api/Cil.cilVisitor.html * fix backwards visitor and rearrange code it is no longer a good idea for the backwards and forwards visitors to have a subtyping relation. * support -x 0 to print encoding name. (#78) this is very useful when looking for the name of an encoding, without cluttering the output with the disassembly trace. the default debug_level has been lowered to -1 to support -x 0 as a non-default level. we cannot print by default since that would clutter stdout when used as a library. Co-authored-by: rina * progress * possibly working * build standalone * print lifted semantics * readme * add mill script * add generic lifter interface * delete old utils * generate separate scala assembly file * cleanup * update tests * marshall offline lifter * fix symbolic lifter merge * update action * update cpp lifter * cpp: allow llvm 18 * cpp: clean up offlineASL-cpp folder delete old hpp files in root reset meson.build to empty --------- Co-authored-by: Nicholas Coughlin Co-authored-by: rina --- .github/workflows/test.yml | 2 +- .gitignore | 5 + asli.opam | 1 + bin/asli.ml | 22 +- dune-project | 1 + libASL/asl_utils.ml | 29 + libASL/cpp_backend.ml | 1 + libASL/cpu.ml | 11 +- libASL/cpu.mli | 3 +- libASL/decoder_program.ml | 162 ++- libASL/dune | 9 +- libASL/ocaml_backend.ml | 5 +- libASL/offline_opt.ml | 590 ++++++++++- libASL/rt_funs.ml | 26 + libASL/scala_backend.ml | 846 ++++++++++++++++ libASL/symbolic.ml | 20 +- libASL/symbolic_lifter.ml | 121 ++- libASL/transforms.ml | 953 +++++++++++++++++- offlineASL-cpp/.gitignore | 1 + offlineASL-cpp/build.sh | 19 + .../include/aslp/llvm_interface.hpp | 37 + .../subprojects/aslp-lifter-llvm/meson.build | 2 +- .../aslp-lifter/include/aslp/interface.hpp | 9 + offlineASL-scala/.gitignore | 4 + offlineASL-scala/build.sc | 23 + offlineASL-scala/lifter/src/interface.scala | 145 +++ offlineASL-scala/main/src/Main.scala | 20 + offlineASL-scala/main/src/NoneLifter.scala | 174 ++++ offlineASL-scala/readme.md | 9 + offlineASL/offline_utils.ml | 18 +- tests/aslt/test_antlr.t | 16 +- tests/aslt/test_cntlm.t | 184 ++-- tests/aslt/test_dis.t | 32 +- tests/bdd_ops.ml | 73 ++ tests/dune | 8 + 35 files changed, 3330 insertions(+), 251 deletions(-) create mode 100644 libASL/rt_funs.ml create mode 100644 libASL/scala_backend.ml create mode 100755 offlineASL-cpp/build.sh create mode 100644 offlineASL-scala/.gitignore create mode 100644 offlineASL-scala/build.sc create mode 100644 offlineASL-scala/lifter/src/interface.scala create mode 100644 offlineASL-scala/main/src/Main.scala create mode 100644 offlineASL-scala/main/src/NoneLifter.scala create mode 100644 offlineASL-scala/readme.md create mode 100644 tests/bdd_ops.ml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 38f4d39c..52de67dd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,7 +53,7 @@ jobs: - run: echo 'preparing nix shell environment' - run: dune build --profile release -j4 - - run: echo ':gen A64 aarch64_* ocaml offlineASL' | OCAMLRUNPARAM=b dune exec asli + - run: echo ':gen A64 aarch64_* ocaml false offlineASL' | OCAMLRUNPARAM=b dune exec asli - run: dune build offlineASL -j4 diff --git a/.gitignore b/.gitignore index bc24e96c..82c82b8e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,8 @@ scripts/total.txt build/ offlineASL/aarch64_* +offlineASL-cpp/subprojects/aslp-lifter/src/generated/* +offlineASL-cpp/subprojects/aslp-lifter/include/aslp/generated/* + + + diff --git a/asli.opam b/asli.opam index 4a09e8ae..c36f30e1 100644 --- a/asli.opam +++ b/asli.opam @@ -29,6 +29,7 @@ depends: [ "lwt" "cohttp-lwt-unix" "yojson" + "mlbdd" "odoc" {with-doc} ] build: [ diff --git a/bin/asli.ml b/bin/asli.ml index 792c767a..c0e9d5af 100644 --- a/bin/asli.ml +++ b/bin/asli.ml @@ -27,7 +27,10 @@ let opt_export_aarch64_dir = ref "" let opt_verbose = ref false -let () = Printexc.register_printer + +let () = + Printexc.record_backtrace true ; + Printexc.register_printer (function | Value.EvalError (loc, msg) -> Some (Printf.sprintf "EvalError at %s: %s" (pp_loc loc) msg) @@ -40,7 +43,7 @@ let help_msg = [ {|:sem Decode and print opcode semantics|}; {|:ast [file] Decode and write opcode semantics to stdout or a file, in a structured ast format|}; {|:gen Generate an offline lifter using the given backend|}; - {| [backend] [dir]|}; + {| [pc-option] [backend] [dir]|}; {|:project Execute ASLi commands in |}; {|:q :quit Exit the interpreter|}; {|:run Execute instructions|}; @@ -56,6 +59,7 @@ let help_msg = [ (** supported backends for :gen and their default output directories *) let gen_backends = [ + ("scala", (Cpu.Scala, "offlineASL-scala/lifter/src/generated")); ("ocaml", (Cpu.Ocaml, "offlineASL")); ("cpp", (Cpu.Cpp, "offlineASL-cpp/subprojects/aslp-lifter")); ] @@ -197,18 +201,24 @@ let rec process_command (tcenv: TC.Env.t) (cpu: Cpu.cpu) (fname: string) (input0 (fun s -> Printf.fprintf chan "%s\n" (Utils.to_string (PP.pp_raw_stmt s))) (Dis.dis_decode_entry cpu.env cpu.denv decoder op); Option.iter close_out chan_opt - | ":gen" :: iset :: id :: rest when List.length rest <= 2 -> + | ":gen" :: iset :: id :: rest when List.length rest <= 3 -> + let pc_option = Option.value List.(nth_opt rest 1) ~default:"false" in let backend_str = Option.value List.(nth_opt rest 0) ~default:"ocaml" in - Printf.printf "Generating lifter for %s %s using %s backend\n" iset id backend_str; + Printf.printf "Generating lifter for %s %s with pc option %s using %s backend\n" iset id pc_option backend_str; + + let pc_option = match String.lowercase_ascii pc_option with + | "false" -> false + | "true" -> true + | _ -> invalid_arg @@ Printf.sprintf "unkown pc option %s (expected: true, false)" pc_option in let (backend, default_dir) = match List.assoc_opt backend_str gen_backends with | Some x -> x | None -> invalid_arg @@ Printf.sprintf "unknown backend %s (supported: %s)" backend_str (String.concat ", " List.(map fst gen_backends)) in - let dir = Option.value List.(nth_opt rest 1) ~default:default_dir in + let dir = Option.value List.(nth_opt rest 2) ~default:default_dir in let cpu' = Cpu.mkCPU cpu.env cpu.denv in - cpu'.gen iset id backend dir; + cpu'.gen iset id pc_option backend dir; Printf.printf "Done generating %s lifter into '%s'.\n" backend_str dir; | ":dump" :: iset :: opcode :: rest -> let fname = diff --git a/dune-project b/dune-project index f57814cc..ec36847e 100644 --- a/dune-project +++ b/dune-project @@ -27,6 +27,7 @@ "lwt" "cohttp-lwt-unix" "yojson" + "mlbdd" ) ) diff --git a/libASL/asl_utils.ml b/libASL/asl_utils.ml index b3b13a8d..a282ebc1 100644 --- a/libASL/asl_utils.ml +++ b/libASL/asl_utils.ml @@ -545,6 +545,35 @@ let masklength (x: string): int = String.iter (function ' ' -> () | _ -> r := !r + 1) x; !r +(* Location of a statement *) +let get_loc s = + match s with + | Stmt_If(_, _, _, _, loc) + | Stmt_VarDeclsNoInit(_, _, loc) + | Stmt_VarDecl(_, _, _, loc) + | Stmt_ConstDecl(_, _, _, loc) + | Stmt_Assign(_,_,loc) + | Stmt_FunReturn(_,loc) + | Stmt_ProcReturn(loc) + | Stmt_Assert(_, loc) + | Stmt_Unpred loc + | Stmt_ConstrainedUnpred loc + | Stmt_ImpDef (_, loc) + | Stmt_Undefined loc + | Stmt_ExceptionTaken loc + | Stmt_Dep_Unpred loc + | Stmt_Dep_Undefined loc + | Stmt_See (_,loc) + | Stmt_Throw (_, loc) + | Stmt_DecodeExecute (_, _, loc) + | Stmt_TCall (_, _, _, loc) + | Stmt_Case (_, _, _, loc) + | Stmt_For (_, _, _, _, _, loc) + | Stmt_While (_, _, loc) + | Stmt_Repeat (_, _, loc) + | Stmt_Try (_, _, _, _, loc) + | Stmt_Dep_ImpDef (_, loc) -> loc + (****************************************************************) (** {2 Function signature accessors} *) (****************************************************************) diff --git a/libASL/cpp_backend.ml b/libASL/cpp_backend.ml index 386e1536..76c7f25b 100644 --- a/libASL/cpp_backend.ml +++ b/libASL/cpp_backend.ml @@ -155,6 +155,7 @@ let rec prints_expr e st = | Expr_LitString s -> "\"" ^ s ^ "\"" | Expr_Tuple(es) -> "std::make_tuple(" ^ (String.concat "," (List.map (fun e -> prints_expr e st) es)) ^ ")" | Expr_Unknown(ty) -> default_value ty st + | Expr_If(_, c, t, [], e) -> Printf.sprintf "((%s) ? (%s) : (%s))" (prints_expr c st) (prints_expr t st) (prints_expr e st) | _ -> failwith @@ "prints_expr: " ^ pp_expr e diff --git a/libASL/cpu.ml b/libASL/cpu.ml index a5b06260..ec28aa4f 100644 --- a/libASL/cpu.ml +++ b/libASL/cpu.ml @@ -12,6 +12,7 @@ open Asl_utils type gen_backend = | Ocaml | Cpp + | Scala type gen_function = AST.ident -> Eval.fun_sig -> Eval.fun_sig Bindings.t -> Eval.fun_sig Bindings.t -> string -> unit @@ -25,7 +26,7 @@ type cpu = { elfwrite : Int64.t -> char -> unit; opcode : string -> Primops.bigint -> unit; sem : string -> Primops.bigint -> unit; - gen : string -> string -> gen_backend -> string -> unit; + gen : string -> string -> bool -> gen_backend -> string -> unit; } let mkCPU (env : Eval.Env.t) (denv: Dis.env): cpu = @@ -60,16 +61,18 @@ let mkCPU (env : Eval.Env.t) (denv: Dis.env): cpu = (fun s -> Printf.printf "%s\n" (pp_stmt s)) (Dis.dis_decode_entry env denv decoder opcode) - and gen (iset: string) (pat: string) (backend: gen_backend) (dir: string): unit = + and gen (iset: string) (pat: string) (include_pc: bool) (backend: gen_backend) (dir: string): unit = if not (Sys.file_exists dir) then failwith ("Can't find target dir " ^ dir); (* Build the symbolic lifter *) - let (decoder_id,decoder_fnsig,tests,instrs) = Symbolic_lifter.run iset pat env in + let (decoder_id,decoder_fnsig,tests,instrs) = Symbolic_lifter.run_marshal include_pc iset pat env in let run_gen_backend : gen_function = match backend with | Ocaml -> Ocaml_backend.run - | Cpp -> Cpp_backend.run in + | Cpp -> Cpp_backend.run + | Scala -> Scala_backend.run + in (* Build backend program *) run_gen_backend decoder_id decoder_fnsig tests instrs dir diff --git a/libASL/cpu.mli b/libASL/cpu.mli index 3b49f2ad..54801332 100644 --- a/libASL/cpu.mli +++ b/libASL/cpu.mli @@ -8,6 +8,7 @@ type gen_backend = | Ocaml | Cpp + | Scala type gen_function = Asl_ast.ident -> Eval.fun_sig -> Eval.fun_sig Asl_utils.Bindings.t -> Eval.fun_sig Asl_utils.Bindings.t -> string -> unit @@ -21,7 +22,7 @@ type cpu = { elfwrite : Int64.t -> char -> unit; opcode : string -> Primops.bigint -> unit; sem : string -> Primops.bigint -> unit; - gen : string -> string -> gen_backend -> string -> unit; + gen : string -> string -> bool -> gen_backend -> string -> unit; } val mkCPU : Eval.Env.t -> Dis.env -> cpu diff --git a/libASL/decoder_program.ml b/libASL/decoder_program.ml index 123352ba..b979f451 100644 --- a/libASL/decoder_program.ml +++ b/libASL/decoder_program.ml @@ -2,19 +2,13 @@ open Asl_ast open Symbolic open Asl_utils -(* - Convert an ASL decoder/instruction construct into an executable ASL program. - The results consits of: - - A decoder function - - A series of instruction encoding test functions, to sanity check the result - - A series of instruction encoding behaviour functions, corresponding to the instruction execution - - All of these functions consume the 32bit instruction encoding, with only the tests - returning a boolean result. -*) - let enc = Ident("enc") let enc_type = Type_Bits (expr_of_int 32) +let pc = Ident("pc") +let pc_type = Type_Bits (expr_of_int 32) + +let generate_args include_pc = + [enc_type, enc] @ (if include_pc then [pc_type, pc] else []) let expr_in_bits e b = let bv = Value.to_bits Unknown (Value.from_bitsLit b) in @@ -23,13 +17,75 @@ let expr_in_bits e b = let expr_in_mask e b = let bv = Value.to_mask Unknown (Value.from_maskLit b) in sym_expr @@ sym_inmask Unknown (Exp e) bv +let get_body_fn nm = FIdent (pprint_ident nm, 0) + + +(* + let mutual e bdds = + let distinct = List.mapi (fun i e' -> (i,MLBDD.(is_false (dand e e')))) bdds in + List.filter_map (fun (i,b) -> if not b then Some i else None) distinct + + let rec order_indep pos bdds = + match bdds with + | e::xs -> + let res = mutual e xs in + let res = List.map (fun offset -> (pos, offset + pos)) res in + let remaining = order_indep (pos+1) xs in + res@remaining + | [] -> [] + + + (* Given a list of bodies and their BDD guards, collapse common bodies *) + let similar_bodies a b = + match a, b with + | DecoderBody_UNPRED _, DecoderBody_UNPRED _ -> true + | DecoderBody_UNALLOC _, DecoderBody_UNALLOC _ -> true + | DecoderBody_NOP _, DecoderBody_NOP _ -> true + | DecoderBody_Encoding(nm, _), DecoderBody_Encoding(nm', _) -> nm = nm' + | _ -> false + + let rec common_bodies xs = + match xs with + | (g,b)::xs -> + let (same,rest) = List.partition (fun (_,b') -> similar_bodies b b') xs in + let conds = List.map (fun (g,_) -> g) same in + let collapse = List.fold_right MLBDD.dor conds g in + let rest = common_bodies rest in + (collapse,b)::rest + | _ -> [] + + let slice_of_mask m (lo,wd) = + let hi = 32 - lo - wd in + DecoderPattern_Mask (String.sub m hi wd) + + let covert_back e slices = + let masks = List.map implicant_to_mask (MLBDD.allprime e) in + List.map (fun m -> List.map (slice_of_mask m) slices) masks +*) + + + + +(* + Convert an ASL decoder/instruction construct into an executable ASL program. + The results consists of: + - A decoder function + - A series of instruction encoding test functions, to sanity check the result + - A series of instruction encoding behaviour functions, corresponding to the instruction execution + + The decoder and instruction behaviour functions take the 32bit instruction encoding and optionally + the current PC, returning nothing. + The test functions take only the current instruction encoding and return a boolean result. +*) let enc_expr opcode = match opcode with | Opcode_Bits b -> expr_in_bits (Expr_Var enc) b - | Opcode_Mask m -> expr_in_mask (Expr_Var enc) m + | Opcode_Mask m -> + if String.exists (fun c -> c = 'x') m then expr_in_mask (Expr_Var enc) m + else expr_in_bits (Expr_Var enc) m -let enc_slice lo wd = +let enc_slice lo wd = Expr_Slices (Expr_Var enc, [Slice_LoWd (expr_of_int lo, expr_of_int wd)]) let field_extract loc (IField_Field (f, lo, wd)) = @@ -40,6 +96,11 @@ let unpred_test loc (i, b) = let not_expr a = Expr_TApply (FIdent ("not_bool", 0), [], [a]) +let rec and_exprs = function + | [e] -> e + | e::es -> Expr_TApply (FIdent ("and_bool", 0), [], [e;and_exprs es]) + | [] -> expr_true + let decode_slice_expr s = match s with | DecoderSlice_Slice(lo, wd) -> enc_slice lo wd @@ -53,19 +114,23 @@ let rec decode_pattern_expr p e = | DecoderPattern_Wildcard _ -> expr_true | DecoderPattern_Not p -> not_expr (decode_pattern_expr p e) +(* + Test function to evaluate guard statements on instruction encodings. + Often these tests are trivially true, avoid building the function if so. + No need to sanity test the opcode, we validate this in a pre-pass over the decoder statically. + *) let get_test_fn nm = FIdent (pprint_ident nm ^ "_decode_test", 0) +let is_trivial_test ((Encoding_Block (nm, _, fields, opcode, guard, unpreds, b, loc)),opost,cond,exec) = + unpreds = [] && guard = expr_true let build_test_fn ((Encoding_Block (nm, _, fields, opcode, guard, unpreds, b, loc)),opost,cond,exec) = - (* Assert no unpredictable bits and return true *) - let stmts = List.map (unpred_test loc) unpreds @ [Stmt_FunReturn(expr_true, loc)] in - (* Run the encoding guard given the extracted fields *) - let stmts = List.map (field_extract loc) fields @ [Stmt_If (guard, stmts, [], [Stmt_FunReturn(expr_false, loc)], loc)] in - (* Sanity test the opcode *) - let stmts = [Stmt_If(enc_expr opcode, stmts, [], [Stmt_FunReturn(expr_false, loc)], loc)] in + (* Return the guard result *) + let stmts = [Stmt_FunReturn(guard, loc)] in + (* Assert no unpredictable bits *) + let stmts = List.map (unpred_test loc) unpreds @ stmts in let fid = get_test_fn nm in (fid, (Some type_bool, [enc_type, enc], [], [enc], loc, stmts)) -let get_body_fn nm = FIdent (pprint_ident nm, 0) -let build_instr_fn ((Encoding_Block (nm, _, fields, opcode, guard, unpreds, b, loc)),opost,cond,exec) = +let build_instr_fn include_pc ((Encoding_Block (nm, _, fields, opcode, guard, unpreds, b, loc)),opost,cond,exec) = (* Extract all of the instructions fields *) let stmts = List.map (field_extract loc) fields in (* Add encoding body *) @@ -76,42 +141,40 @@ let build_instr_fn ((Encoding_Block (nm, _, fields, opcode, guard, unpreds, b, l let stmts = stmts @ exec in (* Build the function decl *) let fid = get_body_fn nm in - (fid, (None, [enc_type, enc], [], [enc], loc, stmts)) - -let rec and_all = function - | [e] -> e - | e::es -> Expr_TApply (FIdent ("and_bool", 0), [], [e;and_all es]) - | [] -> expr_true + let typed_args = generate_args include_pc in + (fid, (None, typed_args, [], List.map snd typed_args, loc, stmts)) -let rec decode_case vs (DecoderAlt_Alt (ps, b)) = +let rec decode_case include_pc has_test vs (DecoderAlt_Alt (ps, b)) = let ps = List.map2 decode_pattern_expr ps vs in let (body, oc) = (match b with | DecoderBody_UNPRED loc -> ([Stmt_Dep_Unpred(loc)], []) | DecoderBody_UNALLOC loc -> ([Stmt_Undefined(loc)], []) | DecoderBody_NOP loc -> ([], []) - | DecoderBody_Encoding(nm, loc) -> + | DecoderBody_Encoding(nm, loc) -> let test_fn = get_test_fn nm in let body_fn = get_body_fn nm in + let args = (Expr_Var enc)::(if include_pc then [Expr_Var pc] else []) in let test = Expr_TApply (test_fn, [], [Expr_Var enc]) in - ([Stmt_TCall(body_fn, [], [Expr_Var enc], loc)], [test]) + ([Stmt_TCall(body_fn, [], args, loc)], if IdentSet.mem nm has_test then [test] else []) | DecoderBody_Decoder (fs, c, loc) -> let stmts = List.map (field_extract loc) fs in - (stmts @ build_decoder_case c, [])) in - let c = and_all (ps @ oc) in + (stmts @ build_decoder_case include_pc has_test c, [])) in + let c = and_exprs (ps @ oc) in S_Elsif_Cond(c, body) -and build_decoder_case (DecoderCase_Case(ss, alts, loc)) = +and build_decoder_case include_pc has_test (DecoderCase_Case(ss, alts, loc)) = let decode_slices = List.map decode_slice_expr ss in - match List.map (decode_case decode_slices) alts with + match List.map (decode_case include_pc has_test decode_slices) alts with | S_Elsif_Cond(c,body)::xs -> [Stmt_If(c, body, xs, [Stmt_Assert(expr_false,loc)], loc)] | _ -> failwith "Empty decoder case" -let build_decoder iset c loc = - let stmts = build_decoder_case c in +let build_decoder include_pc has_test iset c loc = + let stmts = build_decoder_case include_pc has_test c in let fid = FIdent(iset ^ "_decoder", 0) in - (fid, (None, [enc_type, enc], [], [enc], loc, stmts)) + let typed_args = generate_args include_pc in + (fid, (None, typed_args, [], List.map snd typed_args, loc, stmts)) -let run iset pat env problematic = +let run include_pc iset pat env = let loc = Unknown in (* Find all matching instructions, pulled from testing.ml *) @@ -119,15 +182,28 @@ let run iset pat env problematic = let re = Str.regexp pat in let filterfn = function | ((Encoding_Block (Ident nm, Ident is, _, _, _, _, _, _)),_,_,_) -> - is = iset && Str.string_match re nm 0 && not (List.mem nm problematic) + is = iset && Str.string_match re nm 0 | _ -> assert false in let encs = List.filter filterfn (Eval.Env.listInstructions env) in - (* Build the encoding functions *) - let tests = List.map build_test_fn encs in - let instr = List.map build_instr_fn encs in - let dec = build_decoder iset decoder loc in + (* Run a series of sanity tests over the decoder *) + (*let dec_body = DecoderChecks.do_transform decoder env in + let fid = FIdent(iset ^ "_decoder", 0) in + let typed_args = generate_args include_pc in + let dec = (fid, (None, typed_args, [], List.map snd typed_args, loc, dec_body)) in + *) + + (* Build the encoding test functions if necessary *) + let (trivial,essen) = List.partition is_trivial_test encs in + let tests = List.map build_test_fn essen in + let has_test = IdentSet.of_list ( List.map ( fun ((Encoding_Block (nm, _, fields, opcode, guard, unpreds, b, loc)),opost,cond,exec) -> nm ) essen ) in + + (* Build the instruction functions *) + let instr = List.map (build_instr_fn include_pc) encs in + + (* Build the decoder itself *) + let dec = build_decoder include_pc has_test iset decoder loc in (* Add to the environment *) List.iter (fun (f,s) -> Eval.Env.addFun loc env f s) tests; diff --git a/libASL/dune b/libASL/dune index 341e074d..6ebc82e3 100644 --- a/libASL/dune +++ b/libASL/dune @@ -38,12 +38,15 @@ (modules cpu dis elf eval lexer lexersupport loadASL monad primops rws symbolic tcheck testing transforms value symbolic_lifter decoder_program call_graph req_analysis - offline_transform ocaml_backend dis_tc offline_opt - cpp_backend arm_env pretransforms flags + offline_transform dis_tc offline_opt + ocaml_backend + cpp_backend + scala_backend + arm_env pretransforms flags ) (preprocessor_deps (alias ../asl_files) (alias cpp_backend_files)) (preprocess (pps ppx_blob)) - (libraries libASL_stage0 libASL_support str)) + (libraries libASL_stage0 libASL_support str mlbdd)) (alias diff --git a/libASL/ocaml_backend.ml b/libASL/ocaml_backend.ml index 50face90..5579ef9e 100644 --- a/libASL/ocaml_backend.ml +++ b/libASL/ocaml_backend.ml @@ -133,6 +133,7 @@ let rec prints_expr e st = | Expr_LitString s -> "\"" ^ s ^ "\"" | Expr_Tuple(es) -> "(" ^ (String.concat "," (List.map (fun e -> prints_expr e st) es)) ^ ")" | Expr_Unknown(ty) -> default_value ty st + | Expr_If (ty, c, t, [], e) -> Printf.sprintf "(if (%s) then (%s) else (%s))" (prints_expr c st) (prints_expr t st) (prints_expr e st) | _ -> failwith @@ "prints_expr: " ^ pp_expr e @@ -313,8 +314,8 @@ and write_stmts s st = write_seq st; write_stmt s st ) xs; - dec_depth st; - assert (not st.skip_seq) + dec_depth st + (*assert (not st.skip_seq)*) let build_args targs args = if List.length targs = 0 && List.length args = 0 then "()" diff --git a/libASL/offline_opt.ml b/libASL/offline_opt.ml index cdb942c0..477f6f80 100644 --- a/libASL/offline_opt.ml +++ b/libASL/offline_opt.ml @@ -43,6 +43,8 @@ let is_pure_expr f = let is_var_decl f = f = Offline_transform.rt_decl_bv || f = Offline_transform.rt_decl_bool + + (* module CopyProp = struct type clas = Declared | @@ -180,7 +182,7 @@ module CopyProp = struct self#add_dep impure_ident; let _ = List.map (self#vexpr) es in SkipChildren - | e -> failwith @@ "Unknown runtime expression: " ^ (pp_expr e) + | e -> (Printf.printf "Unknown runtime expression: %s\n" (pp_expr e)); DoChildren end let get_deps e = @@ -263,6 +265,22 @@ module CopyProp = struct | None -> false | _ -> true + (* To change this, you'd need to know : + - The condition under which its safe to copy prop + - The current reachability + + If you can't establish you are guarded, implies you need to introduce a branch. + The branch will have the outcomes of both exp reduction and maintaining the current temp. + Then need to specialise everything downstream for this point based on this introduced branch. + + This means you need to pull the condition out to the front. + Which means its needs to be fully reduced and in terms of enc. + BDD approach gives us this flexibility, every single condition in the program in terms of original enc. + Relatively simple to reduce from that point: eliminate guards based on reachability, etc. + + You can implement constant-prop and dead code in a similar fashion, as long as your notions of conditional + use / redefinition / loss of constant precision is purely in terms of the original enc. + *) class copyprop_transform st = object inherit Asl_visitor.nopAslVisitor method! vexpr = function @@ -289,6 +307,7 @@ module CopyProp = struct Asl_visitor.visit_stmts v body end +*) module DeadContextSwitch = struct (* Backwards walk to reduce consecutive context switches. @@ -309,3 +328,572 @@ module DeadContextSwitch = struct let run fn body = let (s,_) = walk_stmts body false in s end + + +module RtCopyProp = struct + + let debug_log = false + + type clas = + Declared | + Defined of IdentSet.t | + Clobbered of IdentSet.t | + Essential + + let pp_clas c = + match c with + | Declared -> "Declared" + | Defined ids -> "Defined (" ^ pp_identset ids ^ ")" + | Clobbered ids -> "Clobbered (" ^ pp_identset ids ^ ")" + | Essential -> "Essential" + + let merge_clas a b = + match a, b with + | Declared, Declared -> Declared + + (* Ignore declared? *) + | Declared, Defined d + | Defined d, Declared -> Defined d + | Declared, Clobbered c + | Clobbered c , Declared -> Clobbered c + + (* Can't drop essential though - needs to hold once set *) + | Declared, Essential + | Essential, Declared -> Essential + + (* Union deps, consider essential even if only conditional *) + | Defined d, Defined d' -> Defined (IdentSet.union d d') + | Defined d, Clobbered d' + | Clobbered d, Clobbered d' + | Clobbered d, Defined d' -> Clobbered (IdentSet.union d d') + | Defined _, Essential + | Essential, Defined _ -> Essential + + (* *) + | Clobbered _, Essential + | Essential, Clobbered _ + | Essential, Essential -> Essential + + + + type state = { + var_clas : clas Bindings.t; + ctx : (ident * MLBDD.t) list; + (* maps idents to the condution under which they are clobbered *) + cond_clobbered: (MLBDD.t) Bindings.t; (* ident -> clobber condition (any dep updated) *) + (* maps idents to the condition under which they are read after clobbering *) + cond_read: (MLBDD.t) Bindings.t; (* ident -> clobber condition (any dep updated) *) + + (*deps: IdentSet.t Bindings.t; (* ident -> ident *) *) + + (* not used; stores dep sets for bindings (and the def reachability) *) + cond_dep: (MLBDD.t * IdentSet.t) Bindings.t; (* binding -> condition * deps *) + (**) + bdd: Transforms.BDDSimp.state; + } + + type rt = state + type olt = MLBDD.t + + + let pp_state st = + (pp_bindings pp_clas st.var_clas) ^ "\n" ^ + "cond read: " ^ + (pp_bindings (fun i -> Printf.sprintf "%s\n" (Transforms.BDDSimp.pp_abs (Val [i]))) st.cond_read) ^ + "\ncond clob: " ^ + (pp_bindings (fun i -> Printf.sprintf "%s\n" (Transforms.BDDSimp.pp_abs (Val [i]))) st.cond_clobbered) + + let pp_essential st = + pp_bindings pp_clas (Bindings.filter (fun f v -> v = Essential) st.var_clas) + + let set_var v k st = + let var_clas = Bindings.add v k st.var_clas in + (* TODO: need to be adapted for new lattice ? *) + { st with var_clas } + + + let cond_merge al bl = Bindings.merge (fun i a b -> match a,b with + | Some a, Some b -> Some (MLBDD.dor a b) + | Some a, _ -> Some a + | _ , Some b -> Some b + | _ -> None) al bl + + let add_cond i c bs = Bindings.add i (match (Bindings.find_opt i bs) with + | Some x -> (MLBDD.dor c x) + | None -> c + ) bs + + let add_conds is c bs = cond_merge bs (Seq.map (fun i -> i, c) is |> Bindings.of_seq) + + + (* only update deps *) + let clobber_var v st = + let var_clas = Bindings.map (fun c -> match c with Defined ids | Clobbered ids when IdentSet.mem v ids -> Clobbered ids | _ -> c) st.var_clas in + (*let st = {st with cond_clobbered = (add_cond v (st.bdd.ctx) st.cond_clobbered)} in *) + let st = Seq.fold_left (fun st (i,c) -> + match c with + | Defined ids + | Clobbered ids when IdentSet.mem v ids + -> {st with cond_clobbered = (add_cond i (st.bdd.ctx) st.cond_clobbered)} + | _ -> st + ) st (Bindings.to_seq var_clas) in + { st with var_clas } + + let update_clobbers st = + (* update everything based on the conditions of their dependencies *) + let ids = Bindings.to_seq st.cond_clobbered in + Seq.fold_left (fun st (iv,cond) -> + let var_clas = Bindings.map (fun c -> match c with Defined ids | Clobbered ids when IdentSet.mem iv ids -> Clobbered ids | _ -> c) st.var_clas in + let st = Seq.fold_left (fun st (ii,c) -> match c with + | Defined ids + | Clobbered ids when IdentSet.mem ii ids -> {st with cond_clobbered = (add_cond ii cond st.cond_clobbered)} + | _ -> st + ) st (Bindings.to_seq var_clas) in + { st with var_clas } + ) st ids + + + + let get_var v st = Bindings.find_opt v st.var_clas + + let merge_st (ts:MLBDD.t) (fs:MLBDD.t) (joined: Transforms.BDDSimp.state) xa xb = + let merge_cond a b = (MLBDD.dor (MLBDD.dand ts a) (MLBDD.dand fs b)) in + let merged_bdd = Bindings.merge (fun (k:ident) a b -> match a,b with + | Some a, Some b -> Some (merge_cond a b) + | Some a, None -> Some (MLBDD.dand ts a) + | None, Some a -> Some (MLBDD.dand fs a) + | None, None -> None) in + let cond_clobbered = merged_bdd xa.cond_clobbered xb.cond_clobbered in + let cond_read = merged_bdd xa.cond_read xb.cond_read in + let cond_dep = Bindings.merge (fun k a b -> match a,b with + | Some (isa, a), Some (isb, b) -> Option.map (fun x -> x, IdentSet.union a b) (Some (merge_cond isa isb)) + | Some (isa, a), None -> Some (MLBDD.dand ts isa, a) + | None, Some (isa, a) -> Some (MLBDD.dand fs isa, a) + | _ -> None + ) xa.cond_dep xb.cond_dep in + let var_clas = Bindings.merge (fun k a b -> + match a, b with + | Some a, Some b -> Some (merge_clas a b) + | Some a, None + | None, Some a -> Some a + | None, None -> None) xa.var_clas xb.var_clas in + let st : state = {xa with bdd=joined; var_clas ; cond_clobbered=cond_clobbered; cond_read=cond_read; cond_dep=cond_dep } in + st + + + let init_state reachable = {bdd=Transforms.BDDSimp.init_state reachable; + var_clas = Bindings.empty; ctx = []; + cond_clobbered = Bindings.empty ; + cond_read = Bindings.empty ; + cond_dep = Bindings.empty} + + let push_context m st = { st with ctx = m::st.ctx } + let peek_context st = match st.ctx with x::xs -> x | _ -> invalid_arg "peek_context" + let pop_context st = let (i,c),tl = (match st.ctx with x::xs -> x,xs | _ -> invalid_arg "pop_context") in + { st with ctx = tl ; bdd = {st.bdd with ctx = c} } + + let has_context st = List.length st.ctx > 0 + + let decl_var v st = set_var v Declared st + let define_var v deps st = + let r = set_var v (Defined deps) st in + let cond_dep = Bindings.find_opt v st.cond_dep |> + Option.map (fun (c,b) -> MLBDD.dor c (st.bdd.ctx), IdentSet.union b deps) |> + function + | Some c -> Bindings.add v c st.cond_dep + | None -> st.cond_dep + in + {r with cond_dep } + + type xform = + | Prop + | PropCond of MLBDD.t (* encoding whether prop is allowed *) + | No + + let read_var v (st,i) = + let st = {st with cond_read = (add_cond v (st.bdd.ctx) st.cond_read )} in + match get_var v st with + (* Reading undeclared generally means a value that is gradually constructed through partial updates *) + | Some (Declared) -> (set_var v Essential st, i) + (* Reading clobbered implies we cannot reorder *) + | Some (Clobbered deps) -> (st, IdentSet.union i deps) + (*if (Transforms.BDDSimp.is_true clobbered st.bdd) then (set_var v Essential st, i) else st, i) *) + (* Collect ids for transitive walk given a defined variable *) + | Some (Defined ids) -> (st, IdentSet.union i ids) + | _ -> (st, i) + + let write_var v (st,i) = + let st = if has_context st then (set_var v Essential st) else st in + (* cannot copy-prop exprs dependent on a run-time branch*) + let st = clobber_var v st in + let (st,i) = match get_var v st with + | Some (Declared) -> (set_var v (Defined i) st, i) + | Some (Defined ids) -> ((set_var v (Clobbered i) st), i) + | Some (Clobbered deps) -> (st, i) + | Some Essential -> (st, i) + | None -> (st, i) + in (st,i) + + + let impure_ident = Ident "CopyProp_impure" + + let read_vars (vs: IdentSet.t) (st: state): state = + let read_set s st = IdentSet.fold read_var s (st,IdentSet.empty) in + (* If impure is in the readset, the reads are not pure. Clobber any impure dependencies now. *) + let st = if IdentSet.mem impure_ident vs then clobber_var impure_ident st else st in + (* Reading variables after they are clobbered shifts them to essential vars *) + let rec iter delta seen st = + let (st,deps) = read_set delta st in + let seen = IdentSet.union seen delta in + let delta = IdentSet.diff deps seen in + if IdentSet.cardinal delta = 0 then st + else iter delta seen st in + iter vs IdentSet.empty st + + (* TODO: Updating, check if this has some context dependence *) + let update_deps v deps st = + if has_context st then (set_var v Essential st) (* cannot copy-prop exprs dependent on a run-time branch*) + else + match get_var v st with + | Some (Declared) -> + set_var v (Defined deps) st + | Some (Defined d') -> + set_var v (Defined (IdentSet.union deps d')) st + | Some (Clobbered d') -> + set_var v (Clobbered (IdentSet.union deps d')) st + | _ -> st + + class deps_walker = object (self) + inherit Asl_visitor.nopAslVisitor + val mutable deps = IdentSet.empty + + method add_dep i = deps <- IdentSet.add i deps + method get_deps = deps + + method! vexpr = function + | Expr_TApply (f, _, _) when is_lit f -> + SkipChildren + | Expr_TApply (f, [], [Expr_Var v]) when is_var_load f -> + self#add_dep v; + SkipChildren + | Expr_TApply (f, [], [e;_;_]) when is_slice f -> + let _ = self#vexpr e in + SkipChildren + | Expr_TApply (f, tes, es) when is_pure_expr f -> + let _ = List.map (self#vexpr) es in + SkipChildren + | Expr_TApply (f, [], [Expr_Var a;i]) when is_array_load f -> + self#add_dep a; + SkipChildren + | Expr_TApply(f, _, es) when is_gen_call f -> + self#add_dep impure_ident; + let _ = List.map (self#vexpr) es in + SkipChildren + | e -> (if debug_log then Printf.printf "Unknown runtime expression: %s\n" (pp_expr e)); DoChildren + end + + let get_deps e = + let v = new deps_walker in + let _ = Asl_visitor.visit_expr v e in + v#get_deps + + + + + let rec walk_stmt s st = + match s with + (* Var decl *) + | Stmt_ConstDecl(t, v, Expr_TApply(f, [], args), loc) when is_var_decl f -> + decl_var v st + + (* Var assign *) + | Stmt_TCall(f, [], [Expr_Var v; e], loc) when is_var_store f -> + (* Collect reads and process them all *) + let deps = get_deps e in + let st = read_vars deps st in + (* Clobber anything dependent on v *) + let st,deps = write_var v (st,deps) in + (* Update deps for v *) + st + (*update_deps v deps st*) + + (* Array assign *) + | Stmt_TCall(f, [], [Expr_Var a; i; e], loc) when is_array_store f -> + (* Collect reads and process them all *) + let deps = get_deps e in + let st = read_vars deps st in + (* Clobber anything dependent on a *) + let st,deps = write_var a (st,deps) in + st + + (* Assert *) + | Stmt_TCall(f, [], [e], loc) when is_assert f -> + (* Collect reads and process them all *) + let deps = get_deps e in + read_vars deps st + + (* LiftTime branch *) + | Stmt_If(c, t, [], f, loc) -> + (* merge in the bdds as well *) + let deps = get_deps c in + read_vars deps st + (* branches handled by caller splitting, walking children, and joining *) + + (* + let cond = Transforms.BDDSimp.eval_expr c st.bdd in + let c = Transforms.BDDSimp.rebuild_expr c cond st.bdd in + let ncond = Transforms.BDDSimp.not_bool cond in + let tst:state = walk_stmts t {st with bdd = (Transforms.BDDSimp.restrict_ctx cond {st.bdd with stmts = []})} in + let fst:state = walk_stmts f {st with bdd = (Transforms.BDDSimp.restrict_ctx ncond {st.bdd with stmts = []})} in + + let condbdd = match cond with + | Val [t] -> t + | _ -> failwith (Printf.sprintf "unable to eval cond branch %s %s %s" (Transforms.BDDSimp.pp_abs cond) (Transforms.BDDSimp.pp_state st.bdd) (pp_expr c) ) + in + + let st': state = merge_st cond tst fst in + let st'= {st' with bdd = Transforms.BDDSimp.writeall st.bdd.stmts st'.bdd} in + let st' = {st' with bdd = Transforms.BDDSimp.write (Stmt_If (c, tst.bdd.stmts, [], fst.bdd.stmts, loc)) st'.bdd} in + *) + + + (* RunTime branch *) + | Stmt_ConstDecl(t, v, Expr_TApply(f, [], [c]), loc) when is_branch f -> + (* Collect reads and process them all *) + let deps = get_deps c in + let st = read_vars deps st in + (* Push the merge point *) + push_context (v, st.bdd.ctx) st + + (* Context switch *) + | Stmt_TCall(f, [], [Expr_TApply(f2, [], [Expr_Var i])], loc) when is_context_switch f && is_merge_target f2 -> + let top = fst (peek_context st) in + if i = top then ((pop_context st)) else st + + (* Impure effect *) + | Stmt_TCall(f, _, es, loc) when is_gen_call f -> + (* Collect reads and process them all *) + let st = List.fold_right (fun e st -> + let deps = get_deps e in + read_vars deps st) es st in + (* Clobber everything linked to global state *) + clobber_var impure_ident st + + | v -> st + + and walk_stmts s st : state = + List.fold_left (fun st s -> walk_stmt s st) st s + + + (* To change this, you'd need to know : + - The condition under which its safe to copy prop + - The current reachability + + If you can't establish you are guarded, implies you need to introduce a branch. + The branch will have the outcomes of both exp reduction and maintaining the current temp. + Then need to specialise everything downstream for this point based on this introduced branch. + + This means you need to pull the condition out to the front. + Which means its needs to be fully reduced and in terms of enc. + BDD approach gives us this flexibility, every single condition in the program in terms of original enc. + Relatively simple to reduce from that point: eliminate guards based on reachability, etc. + + You can implement constant-prop and dead code in a similar fashion, as long as your notions of conditional + use / redefinition / loss of constant precision is purely in terms of the original enc. + +statement s is the only definition of x reaching u
on every path from s to u there are no assignments to y
 + + *) + + + (* + variable is not clobbered then read + *) + let cond_candidate v st rtst = + match get_var v st with + | Some Essential -> No + | Some Clobbered deps -> + let c = Bindings.find_opt v st.cond_read in + let b = Bindings.find_opt v st.cond_clobbered in + (match c,b with + | Some read,Some clob -> + let cond = (MLBDD.dand read (MLBDD.dnot clob)) in + (if (Transforms.BDDSimp.is_true (Val [cond]) rtst) then + ( + (*Printf.printf "Condcopyprop prop var %s read => clobbered %s simplifies to FALSE\n" (pprint_ident v) (Transforms.BDDSimp.pp_abs (Val [MLBDD.dand read (MLBDD.dnot clob)])) ; *) + Prop + ) + else + if (Transforms.BDDSimp.is_false (Val [cond]) rtst) then + ( + (* we don't need to generate a condition at read if we know statically *) + (*Printf.printf "Condcopyprop noprop var %s read => clobbered %s simplifies to TRUE\n" (pprint_ident v) (Transforms.BDDSimp.pp_abs (Val [cond])); *) + No) + else PropCond (cond)) + | Some _, None -> if debug_log then Printf.printf "UNCONCD PROP\n" ; Prop + | _,_ -> (*Printf.printf "Condcopyprop: Clobbered variable missing cond read %s\n" (pprint_ident v); *) + No) (* TODO: clobbered but not subsequently read? *) + | Some Defined _ -> (*Printf.printf "Condcopyprop ONLY DEFINED %s\n" (pprint_ident v);*) Prop + | Some Declared -> No + | None -> No + + + + let cp_idents = function + | Ident c -> Ident (c) , Ident (c ^ "_copyprop") + | _ -> failwith "only copyprop vars" + + type cand = { + typ: ty + } + + + + class cond_copyprop_transform cpst = object(self) + inherit Asl_visitor.nopAslVisitor + val mutable rtst = None + + val mutable candidates : cand Bindings.t = Bindings.empty + + method xf_stmt (x:stmt) (st:Transforms.BDDSimp.state) : stmt list = + rtst <- Some st; Asl_visitor.visit_stmt self x + + method candidate v = (Prop = (cond_candidate v cpst (Option.get rtst))) + method essential v = (No = (cond_candidate v cpst (Option.get rtst))) + + method! vstmt s = ChangeDoChildrenPost ([s], fun s -> List.concat_map self#stmt_xform s) + method! vexpr e = ChangeDoChildrenPost (e, fun e -> self#expr_xform e) + + + (* + Decl of candidate -> decl of expr ref + decl of tmp (unless its never clobbered) + Write to candidate -> if !clobbered, write to expr ref, else write to tmp + Read of candidate -> Wrap whole statement in same test, read from appropriate var + *) + + (* + For run-time variables that we have determined we can copyprop, + pull them to lift-time variables so they can be conditionally + copy-propagated at lift time. + *) + method stmt_xform (s : stmt) : stmt list = + let cp_cond c = Option.get (Transforms.BDDSimp.bdd_to_expr (Val [c]) (Option.get rtst)) in + match s with + (* Transform runtime variable decls into expression decls *) + | Stmt_ConstDecl(t, v, Expr_TApply(f, [], args), loc) when is_var_decl f -> + candidates <- Bindings.add v {typ=t} candidates; + (match (cond_candidate v cpst (Option.get rtst)) with + | No -> if debug_log then Printf.printf "Condcopyprop: NOT PROP at DEFINITION of var %s\n " (pprint_ident v); + [s] + | Prop -> + (* move run-time to lift-time *) + (*Printf.printf "Condcopyprop: UNCOND prop at DEFINITION of var %s\n " (pprint_ident v); *) + [Stmt_VarDeclsNoInit (Offline_transform.rt_expr_ty, [snd (cp_idents v)], Unknown)] + | PropCond cond -> + let ncp,cp = cp_idents v in + (* if (cond) lift-time else run-time *) + if debug_log then Printf.printf "Condcopyprop: CONDITIONAL prop at DEFINITION %s: %s\n " (pprint_ident v) (Transforms.BDDSimp.pp_abs (Val [cond])); + (*let c = cp_cond cond in *) + (* lift-time conditionally generates the copy-propagated or non-propagated form *) + [ + Stmt_ConstDecl (Offline_transform.rt_expr_ty, ncp, Expr_TApply(f, [], args), Unknown); + Stmt_VarDeclsNoInit (Offline_transform.rt_expr_ty, [cp], Unknown); + ] + ) + (* Transform stores into assigns *) + | Stmt_TCall(f, [], [Expr_Var v; e], loc) when is_var_store f -> + (match (cond_candidate v cpst (Option.get rtst)) with + | No -> (*(Printf.printf "Condcopyprop: UNCOND DISABLE PROP on STORE of var %s\n " (pprint_ident v));*) [s] + | Prop -> + (if debug_log then Printf.printf "Condcopyprop: UNCOND RT PROP on STORE of var %s\n " (pprint_ident v); + [(Stmt_Assign (LExpr_Var (snd (cp_idents v)), e, loc))]) + | PropCond cond -> let nocp,cp = cp_idents v in + if debug_log then Printf.printf "Condcopyprop: CONDITIONAL rt prop on STORE of var %s\n " (pprint_ident v); + (* + - if copy-prop'ed form is reachable then generate a store statement + - if non-copyprop'ed form is reachable then generate an assignment statement + *) + (* can re-evaluating an expression have side effects? *) + + let gen_store_rt_var = Stmt_TCall(f, [], [Expr_Var nocp; e], loc) in + let assign_lt_var = Stmt_Assign(LExpr_Var cp, e, loc) in + (* TODO: could further narrow cases here using bdd*) + [Stmt_If ( cp_cond cond, [assign_lt_var], [], [gen_store_rt_var], Unknown)] + ) + | Stmt_TCall(f, _, _, _) when is_var_store f -> failwith "unhandled store" + | _ -> [s] + + method expr_xform (e:expr) : expr = match e with + | Expr_TApply(f, [], [Expr_Var v]) when is_var_load f -> + (match (cond_candidate v cpst (Option.get rtst)) with + | No -> e + | Prop -> Expr_Var (snd (cp_idents v)) + | PropCond cpcond -> let ncp,cp = cp_idents v in + let load = Expr_TApply(f, [], [Expr_Var ncp]) in + let prop = Expr_Var cp in + let yescpcond = Option.get (Transforms.BDDSimp.bdd_to_expr (Val [cpcond]) (Option.get rtst)) in + let vt = Bindings.find v candidates in + (* TODO: might be good to check that yes and no are disjoint here *) + let e = Expr_If (vt.typ, yescpcond, prop, [] , load) in + e + ) + + | Expr_TApply(f, [], [Expr_Var v; e]) when is_var_store f -> failwith "store expression"; + | _ -> e + end + + module AnalysisLat = struct + let debug_log = false + type rt = state + type olt = Transforms.BDDSimp.state + let xfer_stmt (l:olt) (r:rt) (s:stmt) : rt * stmt list = + (*Printf.printf "%s ::\n%s\n" (pp_stmt s) (Transforms.BDDSimp.pp_state l);*) + (walk_stmt s r,[s]) + let join (ts:olt) (fs:olt) (js:olt) (rta: rt) (rtb: rt) = if debug_log then Printf.printf "ts %s fs %s" + (Transforms.BDDSimp.pp_abs (Val [ts.ctx])) + (Transforms.BDDSimp.pp_abs (Val [fs.ctx])) + ; + if debug_log then Printf.printf "\n--------------\n"; + let p s rta = if debug_log then Printf.printf "%s: %s\n" s (pp_state rta) in + p "\nTRUE BRANCH: " rta; p "\nFALSE BRANCH: " rtb ; + + let j = merge_st ts.ctx fs.ctx (js:olt) rta rtb in + p "\nJOIN STATE: " j; + if debug_log then Printf.printf "\n==============\n"; + j + + let init s = init_state s + end + + module TransformLat = struct + (* warning: internally mutable because order should not matter etc, join is no-op *) + type rt = {cpst: cond_copyprop_transform} + type olt = Transforms.BDDSimp.state + let xfer_stmt ol ss s = ss,ss.cpst#xf_stmt s ol + let join t f j a b = if (a != b) then (failwith "not allowed") else a (* only have one instance of the object so should be fine *) + let init st = {cpst = new cond_copyprop_transform st} + end + + module BDDAnalysis = Transforms.BDDSimp.EvalWithXfer(AnalysisLat) + module BDDTransform = Transforms.BDDSimp.EvalWithXfer(TransformLat) + + let do_transform reachable copyprop_st stmts = + (* apply BDD AI a second time to compare reachability with candidates in analysis pass *) + let st = Transforms.BDDSimp.init_state reachable in + let st = Transforms.BDDSimp.set_enc st in + let olt,ort = BDDTransform.eval_stmts (TransformLat.init copyprop_st) stmts st in + olt.stmts + + let run fn reachable body = + flush stdout; + if debug_log then Printf.printf "transforming %s\n" (pprint_ident fn); + let st : AnalysisLat.rt = init_state reachable in + let rtst = Transforms.BDDSimp.init_state reachable in + let rtst = Transforms.BDDSimp.set_enc rtst in + (*let st = walk_stmts body st in *) + let a,b = BDDAnalysis.eval_stmts st body rtst in + (* Printf.printf "%s : %s\n" (pprint_ident fn) (pp_essential st); *) + (* Printf.printf "%s : %s\n" (pprint_ident fn) (pp_state st); *) + do_transform reachable b body + +end diff --git a/libASL/rt_funs.ml b/libASL/rt_funs.ml new file mode 100644 index 00000000..0850f56b --- /dev/null +++ b/libASL/rt_funs.ml @@ -0,0 +1,26 @@ + +open Asl_ast + +let rt_var_ty = Type_Constructor (Ident "rt_sym") +let rt_label_ty = Type_Constructor (Ident "rt_label") +let rt_expr_ty = Type_Constructor (Ident "rt_expr") + +let rt_decl_bv = FIdent("decl_bv", 0) (* string -> int -> sym *) +let rt_decl_bool = FIdent("decl_bool", 0) (* string -> sym *) +let rt_gen_bit_lit = FIdent("gen_bit_lit", 0) (* bv -> bv rt *) +let rt_gen_bool_lit = FIdent("gen_bool_lit", 0) (* bool -> bool rt *) +let rt_gen_int_lit = FIdent("gen_int_lit", 0) (* int -> int rt *) +let rt_gen_slice = FIdent("gen_slice", 0) (* bv rt -> int -> int -> bv rt *) + +let rt_gen_branch = FIdent("gen_branch", 0) (* bool rt -> (rt_label, rt_label, rt_label) *) +let rt_true_branch = FIdent("true_branch", 0) +let rt_false_branch = FIdent("false_branch", 0) +let rt_merge_branch = FIdent("merge_branch", 0) + +let rt_switch_context = FIdent("switch_context", 0) (* rt_label -> unit *) +let rt_gen_load = FIdent("gen_load", 0) (* sym -> 'a rt *) +let rt_gen_store = FIdent("gen_store", 0) (* sym -> 'a rt -> unit *) +let rt_gen_assert = FIdent("gen_assert", 0) (* bool rt -> unit *) + +let rt_gen_array_store = FIdent("gen_array_store", 0) (* sym -> int -> 'a rt -> unit *) +let rt_gen_array_load = FIdent("gen_array_load", 0) (* sym -> int -> 'a rt *) diff --git a/libASL/scala_backend.ml b/libASL/scala_backend.ml new file mode 100644 index 00000000..981316b2 --- /dev/null +++ b/libASL/scala_backend.ml @@ -0,0 +1,846 @@ + +open Visitor + +open Asl_utils + +open AST +open Asl_visitor +open Value + +(* For splitting up functions we use type to indicate which parameters are passed by reference. *) + +module StringSet = Set.Make(String) + + let globs = StringSet.of_list [ + "v_PSTATE_UAO"; + "v_PSTATE_PAN"; + "v_PSTATE_DIT"; + "v_PSTATE_SSBS"; + "v_PSTATE_G"; + "v_PSTATE_A"; + "v_PSTATE_I"; + "v_PSTATE_F"; + "v_PSTATE_D"; + "v_PSTATE_C"; + "v_PSTATE_Z"; + "v_PSTATE_V"; + "v_PSTATE_N"; + "v__PC"; + "v__R"; + "v__Z"; + "v_SP_EL0"; + "v_FPSR"; + "v_FPCR"; + "v_PSTATE_BTYPE"; + "v_BTypeCompatible"; + "v___BranchTaken"; + "v_BTypeNext"; + "v___ExclusiveLocal" + ] + + let prims = StringSet.of_list (["mkBits"; "bvextract"; "f_eq_bits"; "f_ne_bits"; "f_add_bits"; "f_sub_bits"; + "f_mul_bits"; "f_and_bits"; "f_or_bits"; "f_eor_bits"; "f_not_bits"; + "f_slt_bits"; "f_sle_bits"; "f_zeros_bits"; "f_ones_bits"; + "f_ZeroExtend"; "f_SignExtend"; "f_asr_bits"; "f_lsl_bits"; + "f_lsr_bits"; "f_decl_bool"; "f_decl_bv"; "f_AtomicEnd"; + "f_AtomicStart"; "f_replicate_bits"; "f_append_bits"; "f_gen_BFAdd"; + "f_gen_BFMul"; "f_gen_FPAdd"; "f_gen_FPCompare"; "f_gen_FPCompareEQ"; + "f_gen_FPCompareGE"; "f_gen_FPCompareGT"; "f_gen_FPConvert"; + "f_gen_FPConvertBF"; "f_gen_FPDiv"; "f_gen_FPMax"; "f_gen_FPMaxNum"; + "f_gen_FPMin"; "f_gen_FPMinNum"; "f_gen_FPMul"; "f_gen_FPMulAdd"; + "f_gen_FPMulAddH"; "f_gen_FPMulX"; "f_gen_FPRSqrtStepFused"; + "f_gen_FPRecipEstimate"; "f_gen_FPRecipStepFused"; "f_gen_FPRecpX"; + "f_gen_FPRoundInt"; "f_gen_FPRoundIntN"; "f_gen_FPSqrt"; "f_gen_FPSub"; + "f_gen_FPToFixed"; "f_gen_FPToFixedJS_impl"; "f_gen_FixedToFP"; + "f_gen_bit_lit"; "f_gen_bool_lit"; "f_gen_branch"; "f_cvt_bits_uint"; + "f_gen_cvt_bits_uint"; "f_gen_cvt_bool_bv"; "f_gen_eor_bits"; + "f_gen_eq_bits"; "f_gen_eq_enum"; "f_gen_int_lit"; "f_gen_store"; + "f_gen_load"; "f_gen_SignExtend"; "f_gen_ZeroExtend"; "f_gen_add_bits"; + "f_gen_and_bits"; "f_gen_and_bool"; "f_gen_asr_bits"; "f_gen_lsl_bits"; + "f_gen_lsr_bits"; "f_gen_mul_bits"; "f_gen_ne_bits"; "f_gen_not_bits"; + "f_gen_not_bool"; "f_gen_or_bits"; "f_gen_or_bool"; "f_gen_sdiv_bits"; + "f_gen_sle_bits"; "f_gen_slt_bits"; "f_gen_sub_bits"; + "f_gen_AArch64_MemTag_set"; "f_gen_Mem_read"; "f_gen_slice"; + "f_gen_replicate_bits"; "f_gen_append_bits"; "f_gen_array_load"; + "f_gen_array_store"; "f_gen_Mem_set"; "f_gen_assert"; + "f_switch_context"; "f_true_branch"; "f_false_branch"; "f_merge_branch"]) + +let mutable_decl = "class Mutable[T](var v: T)" + +type var_type = + | Mutable of ty + | Immutable of ty + | Unit + | Infer (* Omit the type def on scala side *) + +type sc_fun_sig = { + rt: var_type ; + arg_types: (var_type * ident) list; + targs: ident list; + args: ident list; + body: stmt list; +} + +module DefSet = Set.Make(struct + type t = (ident * ty * bool) + let compare (a,b,e) (c,d,f) = (match (Stdlib.compare a c) with + | 0 -> (match (Stdlib.compare b d ) with + | 0 -> (Stdlib.compare e f ) + | s -> s) + | s -> s) +end) + +let compose a b f = b (a f) + +let (let@) x f = fun s -> + let (s,r) = x s in + (f r) s +let (let+) x f = fun s -> + let (s,r) = x s in + (s,f r) + + +module LocMap = Map.Make(struct + type t = l + let compare = Stdlib.compare +end) + +class find_defs = object (self) + inherit Asl_visitor.nopAslVisitor + val mutable defs = LocMap.empty + + method add_dep loc i = defs <- LocMap.add loc i defs + method get_deps = defs + + method! vstmt = function + | Stmt_VarDeclsNoInit(ty, [v], loc) -> self#add_dep loc (v, ty); SkipChildren + | Stmt_VarDecl(ty, v, e, loc) -> self#add_dep loc (v ,ty); SkipChildren + | Stmt_ConstDecl(ty, v, e, loc) -> self#add_dep loc (v , ty) ; SkipChildren + | _ -> DoChildren +end + + +type stvarinfo = { + ident : ident; + var : expr; + typ : var_type; +} + +let state_var = { var = Expr_Var (Ident "st"); typ = Immutable (Type_Constructor (Ident "LiftState[RTSym, RTLabel, BV]")); ident = Ident "st" } + +type st = { + mutable indent: int; + mutable skip_seq: bool; + oc : out_channel; + + (* variables that are access thru mutable.v field *) + mutable mutable_vars : var_type Transforms.ScopedBindings.t; + + (* New functions generated by splitting functions *) + mutable extra_functions : sc_fun_sig Bindings.t; +} + +let define (st) (t: var_type) (v:ident) = Stack.push (Stack.pop st.mutable_vars |> Bindings.add v t) st.mutable_vars +let push_scope st = Stack.push Bindings.empty (st.mutable_vars) +let pop_scope st = Stack.pop (st.mutable_vars) |> ignore + +let var_mutable (v:ident) (st) = + let find_def = Transforms.ScopedBindings.find_binding in + match (find_def st.mutable_vars v) with + | Some Mutable _ -> true + | Some Unit -> false + | Some Infer -> true + | Some Immutable _ -> false + | None -> true (* Globals are mutable by default *) + +let global_imports = [] +let global_opens = [] + +let uniq_counter : int ref = ref 0 + +let new_index _ : int = uniq_counter := !uniq_counter + 1 ; !uniq_counter +let new_name pref = Ident ( pref ^ "_" ^ (string_of_int (new_index ()))) +let new_indexs (b: string) : string = b ^ (string_of_int (new_index ())) + +class stmt_counter = object(this) + inherit Asl_visitor.nopAslVisitor + val mutable stmt_count: int = 0 + val mutable expr_count: int = 0 + + method !vstmt s = stmt_count <- stmt_count + 1; DoChildren + + method !vexpr s = expr_count <- expr_count + 1; DoChildren + + method count (s:stmt) : int = stmt_count <- 0; (visit_stmt this s) |> ignore; stmt_count + + method expr_count (e:expr) : int = expr_count <- 0; (visit_expr this e) |> ignore ; expr_count + method gexpr_count = expr_count +end + +let sl_complexity(sl:stmt list) : int = let s = new stmt_counter in visit_stmts s (sl) |> ignore ; s#gexpr_count +let count_stmts_list (s:stmt list) : int list = List.map ((new stmt_counter)#count) s +let count_stmts (s:stmt) : int = (new stmt_counter)#count s + +(* Shallow inspection of an expression to guess its type. *) +let infer_type e : ty option = + let tint = Some (Type_Constructor (Ident "integer")) in + let tbool = Some (Type_Constructor (Ident "boolean")) in + let tbits = fun b -> Some (Type_Bits b) in + match e with + (* Boolean Expressions *) + | Expr_Var(Ident "TRUE") -> tbool + | Expr_Var(Ident "FALSE") -> tbool + | Expr_TApply(FIdent("and_bool", 0), [], [a;b]) -> tbool + | Expr_TApply(FIdent("or_bool", 0), [], [a;b]) -> tbool + | Expr_TApply(FIdent("implies_bool", 0), [], [a;b]) -> tbool + | Expr_TApply(FIdent("not_bool", 0), [], [a]) -> tbool + + (* Int Expressions using Z *) + | Expr_LitInt i -> tint + | Expr_TApply(FIdent("add_int", 0), [], [a;b]) -> tint + | Expr_TApply(FIdent("sub_int", 0), [], [a;b]) -> tint + | Expr_TApply(FIdent("mul_int", 0), [], [a;b]) -> tint + | Expr_TApply(FIdent("frem_int", 0), [], [a;b]) -> tint + + (* Other operations *) + | Expr_LitBits b -> tbits (Expr_LitInt (b)) + | Expr_Slices(e,[Slice_LoWd(i,w)]) -> tbits (w) + | _ -> None + + +let prints_arg_type (t: var_type) : string = + let rec ctype t = + match t with + | (Type_Bits _) -> "BV" + | (Type_Constructor (Ident "integer")) -> "BigInt" + | (Type_Constructor (Ident "boolean")) -> "Boolean" + | (Type_Tuple l) -> ": (" ^ (String.concat "," (List.map ctype (l)) ) ^ ")" + | Type_Constructor (Ident "rt_label") -> "RTLabel" + | Type_Constructor (Ident "rt_sym") -> "RTSym" + | Type_Constructor (Ident "rt_expr") -> "RTSym" + | Type_Constructor (Ident e) -> e + | t -> failwith @@ "Unknown arg type: " ^ (pp_type t) + in + match t with + | Mutable v -> Printf.sprintf "Mutable[%s]" (ctype v) + | Immutable v -> ctype v + | Infer -> "" + | Unit -> "Unit" + + +(**************************************************************** + * String Utils + ****************************************************************) + +let inc_depth st = st.indent <- st.indent + 2 +let dec_depth st = st.indent <- st.indent - 2 + +let replace s = + String.fold_left (fun acc c -> + if c = '.' then acc ^ "_" + else if c = '#' then acc ^ "HASH" + else acc ^ (String.make 1 c)) "" s + +let plain_ident v : string = + let s = (match v with + | Ident n -> n + | FIdent (n,0) -> n + | FIdent (n,i) -> n ^ "_" ^ (string_of_int i)) in + replace s + +let name_of_ident v : string = + let s = (match v with + | Ident n -> "v_" ^ n + | FIdent (n,0) -> "f_" ^ n + | FIdent (n,i) -> "f_" ^ n ^ "_" ^ (string_of_int i)) in + replace s + +let rec name_of_lexpr l = + match l with + | LExpr_Var v -> name_of_ident v + | LExpr_Field (l, f) -> + let l = name_of_lexpr l in + let f = name_of_ident f in + l ^ "." ^ f + | LExpr_Wildcard -> "_" + | _ -> failwith @@ "name_of_lexpr: " ^ (pp_lexpr l) + +(* Expr printing *) + + +let rec prints_expr ?(deref:bool=true) e (st:st) = + match e with + (* Boolean Expressions *) + | Expr_Var(Ident "TRUE") -> "true" + | Expr_Var(Ident "FALSE") -> "false" + | Expr_TApply(FIdent("and_bool", 0), [], [a;b]) -> + Printf.sprintf "((%s) && (%s))" (prints_expr a st ~deref) (prints_expr b st ~deref) + | Expr_TApply(FIdent("or_bool", 0), [], [a;b]) -> + Printf.sprintf "((%s) || (%s))" (prints_expr a st ~deref) (prints_expr b st ~deref) + | Expr_TApply(FIdent("implies_bool", 0), [], [a;b]) -> + Printf.sprintf "((!(%s)) || (%s))" (prints_expr a st ~deref) (prints_expr b st ~deref) + | Expr_TApply(FIdent("not_bool", 0), [], [a]) -> + Printf.sprintf " (!(%s))" (prints_expr a st ~deref) + + (* State Accesses *) + | Expr_Var(v) -> + let name = (name_of_ident v) in + let name = if (StringSet.mem name globs) then ("v_st." ^ name) else name in + if (deref && (var_mutable v st)) then (name ^ ".v" ) else name + | Expr_Field(e, f) -> + prints_expr e st ^ "." ^ name_of_ident f + | Expr_Array(a,i) -> + Printf.sprintf "(%s).get(%s)" (prints_expr a st) (prints_expr i st) + + (* Int Expressions using Z *) + | Expr_LitInt i -> "BigInt(" ^ i ^ ")" + | Expr_TApply(FIdent("add_int", 0), [], [a;b]) -> + Printf.sprintf "((%s) + (%s))" (prints_expr a st) (prints_expr b st) + | Expr_TApply(FIdent("sub_int", 0), [], [a;b]) -> + Printf.sprintf "((%s) - (%s))" (prints_expr a st) (prints_expr b st) + | Expr_TApply(FIdent("mul_int", 0), [], [a;b]) -> + Printf.sprintf "((%s) * (%s))" (prints_expr a st) (prints_expr b st) + | Expr_TApply(FIdent("frem_int", 0), [], [a;b]) -> + let x = (prints_expr a st) in let y = (prints_expr b st) in + Printf.sprintf "((%s) - ( (%s) * ((%s) / (%s))))" x y x y + + (* Other operations *) + | Expr_TApply(FIdent("as_ref", 0), [], [a]) -> Printf.sprintf "%s" (prints_expr a st ~deref:false) + (*as_ref is only output by backend to idicate not to deref pointers*) + | Expr_LitBits b -> Printf.sprintf "%s.mkBits(%d, BigInt(\"%s\", 2))" (prints_expr state_var.var st) (String.length b) b + | Expr_Slices(e,[Slice_LoWd(i,w)]) -> + let e = prints_expr e st in + let i = prints_expr i st in + let w = prints_expr w st in + let stv = prints_expr state_var.var st in + Printf.sprintf "%s.bvextract(%s,%s,%s)" stv e i w + | Expr_TApply(f, targs, args) -> + let stv = prints_expr state_var.var st in + let deref = not (Bindings.mem f st.extra_functions) in + let f = (name_of_ident f) in + let prim = (StringSet.mem f prims) in + let args = if prim then (targs@args) else (state_var.var::targs@args) in + let f = if prim then (stv ^ "." ^ f) else f in + let args = List.map (fun e -> prints_expr ~deref:deref e st) (args) in + f ^ "(" ^ (String.concat ", " (args)) ^ ")" + + | Expr_LitString s -> "\"" ^ s ^ "\"" + | Expr_Tuple(es) -> "(" ^ (String.concat "," (List.map (fun e -> prints_expr e st) es)) ^ ")" + | Expr_Unknown(ty) -> default_value ty st (* Sound? *) + | Expr_If(_, c, t, [], e) -> Printf.sprintf "(if (%s) then (%s) else (%s))" (prints_expr c st) (prints_expr t st) (prints_expr e st) + + | _ -> failwith @@ "prints_expr: " ^ pp_expr e + +and default_value t st = + let stv = prints_expr state_var.var st in + match t with + | Type_Bits w -> Printf.sprintf "%s.mkBits(%s, BigInt(0))" stv (prints_expr w st) + | Type_Constructor (Ident "boolean") -> "true" + | Type_Constructor (Ident "integer") -> "BigInt(0)" + | Type_Constructor (Ident "rt_label") -> stv ^ ".rTLabelDefault" + | Type_Constructor (Ident "rt_sym") -> stv ^ ".rTSymDefault" + | Type_Constructor (Ident "rt_expr") -> stv ^ ".rTExprDefault" + | Type_Constructor (Ident "Unit") -> "()" + | Type_Constructor (Ident "Any") -> "null" + | Type_Array(Index_Range(lo, hi),ty) -> + let lo = prints_expr lo st in + let hi = prints_expr hi st in + let d = default_value ty st in + Printf.sprintf "Range.Exclusive((%s), (%s)).map(%s).toList" lo hi d + | _ -> failwith @@ "Unknown type for default value: " ^ (pp_type t) + + + +(* End expr printing *) + + +let write_line s st = + let padding = String.concat "" (List.init st.indent (fun _ -> " ")) in + Printf.fprintf st.oc "%s%s" padding s + +let write_seq st = + if st.skip_seq then + st.skip_seq <- false + else Printf.fprintf st.oc "\n" + +let write_nl st = + Printf.fprintf st.oc "\n" + +(**************************************************************** + * Prim Printing + ****************************************************************) + +let write_fun_return e st = + let s = Printf.sprintf "%s" e in + write_line s st + +let write_proc_return st = + write_line "/*proc return */ ()" st + +let write_assert s st = + let s = Printf.sprintf "assert (%s)" s in + write_line s st + +let write_unsupported st = + write_line "throw Exception(\"not supported\")" st + +let write_call f (targs : typeid list) (args: typeid list) st = + let stv = prints_expr state_var.var st in + let prim = (StringSet.mem f prims) in + let f = if prim then (stv ^ "." ^ f) else f in + let args = if prim then (targs@args) else ((prints_expr state_var.var st)::targs@args)in + let call = f ^ " (" ^ (String.concat "," args) ^ ")" in + write_line call st + +let write_ref v ty e st = + let name = name_of_ident v in + let s = Printf.sprintf "val %s = %s(%s)\n" name (prints_arg_type ty) e in + st.skip_seq <- true; + write_line s st + +let write_let v ty e st = + let v = name_of_ident v in + let s = Printf.sprintf "val %s : %s = %s \n" v (prints_arg_type ty) e in + st.skip_seq <- true; + write_line s st + +let write_if_start c st = + let s = Printf.sprintf "if (%s) then {\n" c in + write_line s st + +let write_if_elsif c st = + write_nl st; + let s = Printf.sprintf "} else if (%s) then {\n" c in + write_line s st + +let write_if_else st = + write_nl st; + write_line "} else {\n" st + +let write_if_end st = + write_nl st; + write_line "}" st + +(**************************************************************** + * Stmt Printing + ****************************************************************) + + +let prints_lexpr v st = + match v with + | LExpr_Wildcard -> "_" + | LExpr_Var v -> name_of_ident v + | LExpr_Array (LExpr_Var v, i) -> name_of_ident v + | LExpr_Field (l, f) -> name_of_lexpr l + | LExpr_Tuple (ls) -> "(" ^ String.concat "," (List.map name_of_lexpr ls) ^ ")" + | _ -> failwith @@ "pritns_lexpr: " ^ (pp_lexpr v) + +let rec expr_of_lexpr v = + match v with + | LExpr_Var v -> Expr_Var v + | LExpr_Array (LExpr_Var v, i) -> Expr_Array (Expr_Var v, i) + | LExpr_Field (l, f) -> Expr_Field (expr_of_lexpr l , f) + | LExpr_Tuple (ls) -> Expr_Tuple (List.map expr_of_lexpr ls) + | _ -> failwith @@ "expr_of_lexpr: " ^ (pp_lexpr v) + +let rec write_assign v e st = + match v with + | LExpr_Wildcard -> + failwith @@ "write_assign: " ^ (pp_lexpr v); + (*let s = Printf.sprintf "val _ = %s \n" e in + st.skip_seq <- true; + write_line s st*) + + | LExpr_Var v -> + let v = (if (var_mutable v st) then ((name_of_ident v) ^ ".v" ) else (name_of_ident v)) in + let s = Printf.sprintf "%s = %s" v e in + write_line s st + + | LExpr_Array (LExpr_Var v, i) -> + let i = prints_expr i st in + let v = name_of_ident v in + let s = Printf.sprintf "%s = list_update (%s, %s, %s)" v v i e in + write_line s st + + | LExpr_Field (l, f) -> + let v = name_of_lexpr l in + let s = Printf.sprintf "%s = %s" v e in + write_line s st + + | LExpr_Tuple (ls) -> + let vars = List.init (List.length ls) (fun i -> "tmp" ^ (string_of_int (new_index ()))) in + let v = "(" ^ String.concat "," vars ^ ")" in + let s = Printf.sprintf "val %s = %s \n" v e in + st.skip_seq <- true; + write_line s st; + List.iter2 (fun l e -> + write_seq st; + write_assign l e st + ) ls vars + + | _ -> failwith @@ "write_assign: " ^ (pp_lexpr v) + + +module FunctionSplitter = struct + open Transforms.ScopedBindings + + module StmtSet = Set.Make(struct + type t = stmt + let compare = Stdlib.compare + end) + + type split_ctx = { + (* return type of containing function *) + return_type: var_type; + (* to look up the type of parameters *) + bindings: var_type Bindings.t ; + } + + class find_returns = object(this) + inherit Asl_visitor.nopAslVisitor + val mutable returns = StmtSet.empty + val mutable fun_returns = false + val mutable proc_returns = false + + method! vstmt s = + match s with + | Stmt_FunReturn _ -> (fun_returns <- true); (returns <- (StmtSet.add s returns)); DoChildren + | Stmt_ProcReturn _ -> (proc_returns <- true); (returns <- (StmtSet.add s returns)); DoChildren + | _ -> DoChildren + + method any_rets () = fun_returns || proc_returns + end + +(* Replaces a statement list with a a call to a function containing the same statements. + + If the statement list contains return statements then a return statement is returned. + (we are assuming no early returns). + + We are also assuming that the statement list is an entire scope, i.e. no definitions + escape from the block. + + Typically the statement list sl here is the code block in an if/elseif/else branch. + + returns (call stmt, ident * fun_sig) + *) + let stmt_list_to_function (c: split_ctx) (sl:stmt list)(*: stmt *) = + let in_return_context sl = let v = new find_returns in + visit_stmts v sl |> ignore ; v#any_rets () in + let swap (a,b) = (b,a) in + let param_types = List.filter (fun (t, i) -> i <> state_var.ident) (List.map swap (Bindings.bindings c.bindings)) in + let param_types = (state_var.typ,state_var.ident)::param_types in + let returning = if (in_return_context sl) then c.return_type else Unit in + let fname = new_name "split_fun" in + let targs = [] in + let args = List.map snd (List.tl param_types) in + let funsig : sc_fun_sig = {rt=returning; arg_types=param_types; targs=targs; args=args; body=sl} in + let new_funsig = (fname , funsig) in + let call_params = List.map (fun i -> Expr_TApply ((FIdent("as_ref", 0)), [], [Expr_Var i])) args in + let new_stmt = (match returning with + | Immutable x -> Some None + | Mutable x -> Some None + | Infer -> Some None + | Unit -> None) + |> (function + | Some _ -> Stmt_FunReturn ((Expr_TApply (fname, targs, call_params)), Unknown) + | None -> Stmt_TCall (fname,targs,call_params, Unknown)) + in (new_stmt, new_funsig) + + (* Create a function containing a single return statement of the given expression. All variables used in the expression + become parameters to the function. *) + let expr_to_function (c: split_ctx) (e: expr) = + let fname = new_name "split_expr" in + let returning = Infer in + let params = List.map (fun e -> Option.map (fun v -> v, e) (Bindings.find_opt e c.bindings)) (IdentSet.elements (fv_expr e)) in + let params = List.concat_map Option.to_list params in + let params = (state_var.typ,state_var.ident)::List.filter (fun (t, i) -> i <> state_var.ident) params in + let targs = [] in + let args = List.map snd (List.tl params) in (* chop off state var since its always added to calls*) + (* as_ref here is a bit of a hack *) + let call_params = List.map (fun i -> Expr_TApply ((FIdent("as_ref", 0)), [], [Expr_Var i])) args in + let body = [Stmt_FunReturn (e, Unknown)] in + let funsig = {rt=returning; arg_types=params; targs=targs; args=args; body=body} in + let callexpr = Expr_TApply (fname, [], call_params) in + (callexpr, (fname, funsig)) + + + (* When a scope block has many statements *) + let outline_function_on_size_threshold ctx sl thresh = + let sum x = List.fold_left (fun a b -> (a + b)) 0 x in + let branch_weight = compose count_stmts_list sum in + let stmt_weights = sl |> List.map (fun s -> match s with + | Stmt_If(c, t, els, f, loc) -> (s, [branch_weight t] + @ (List.map (branch_weight) (List.map (function | S_Elsif_Cond (e, sl) -> sl) els)) + @ [branch_weight f]) + | c -> (s, [count_stmts c] ) + ) in + let total = List.map (compose snd sum) stmt_weights |> sum in + if (total < thresh) then (sl, []) else + let (f,s) = stmt_list_to_function ctx sl + in ([f], [s]) + + (* When a function has many statements at the same level. *) + let chunk_outline_stmtlist_on_size_threshold ctx sl thresh = + (* Find all the definitions in the block, move them to the beginning of the block, split the + block into a number of chunks and outline those chunks as a function each. + + Not needed with agressive expression outlining. *) + () + + (* When an expression has many subexpressions *) + let outline_expr_on_size_threshold ctx (thresh:int) (e:expr) = + let c = new stmt_counter in + let c = c#expr_count e in + if (c > thresh) then let (e,f) = expr_to_function ctx e in (e, [f]) else (e, []) + + class branch_outliner (funsig: sc_fun_sig) (outline_thresh:int) = object(this) + inherit Asl_visitor.nopAslVisitor + + val scoped_bindings : var_type Transforms.ScopedBindings.t = let x = Transforms.ScopedBindings.init () in + List.iter (fun (t,i) -> add_bind x i t) (funsig.arg_types); + push_scope x (); + x + + val mutable extra_funs : sc_fun_sig Bindings.t = Bindings.empty + + method add_fun (bs: (ident * sc_fun_sig) list) = extra_funs <- Bindings.union + (fun i a b -> if a == b then Some a else failwith ("(branch_outliner) split function names be distinct " ^ (name_of_ident i))) extra_funs (Bindings.of_seq (List.to_seq bs)) + + method split_sl sl = + let ctx = {return_type = funsig.rt; bindings = current_scope_bindings scoped_bindings} in + let t,nf = outline_function_on_size_threshold ctx sl outline_thresh + in this#add_fun nf; + t + + method split_exp e = + let ctx = {return_type = funsig.rt; bindings = current_scope_bindings scoped_bindings} in + let ne,nf = outline_expr_on_size_threshold ctx outline_thresh e + in this#add_fun nf; + ne + + + method! enter_scope ss = push_scope scoped_bindings () + method! leave_scope ss = pop_scope scoped_bindings () + + method! vstmt s = + match s with + | Stmt_VarDeclsNoInit(ty, vs, loc) -> + List.iter (fun f -> add_bind scoped_bindings f (Mutable ty)) vs; + DoChildren + | Stmt_VarDecl(ty, v, i, loc) -> + add_bind scoped_bindings v (Mutable ty) ; + DoChildren + | Stmt_ConstDecl(ty, v, i, loc) -> + add_bind scoped_bindings v (Immutable ty) ; + DoChildren + | Stmt_If (c, t, els, e, loc) -> + ChangeDoChildrenPost ([Stmt_If (c, t, els, e, loc)], (function + | [Stmt_If (c, t, els, e, loc)] -> + let c' = visit_expr this c in + (* visit each statement list and then maybe outline it *) + let t' = visit_stmts this t in + let t' = this#split_sl t' in + let els' = mapNoCopy (visit_s_elsif this ) els in + let e' = visit_stmts this e in + let e' = this#split_sl e' in + [Stmt_If (c', t', els', e', loc)] + | _ -> [s] + )) + (* Statements with child scopes that shouldn't appear towards the end of transform pipeline *) + | Stmt_Case _ -> failwith "(FixRedefinitions) case not expected" + | Stmt_For _ -> failwith "(FixRedefinitions) for not expected" + | Stmt_While _ -> failwith "(FixRedefinitions) while not expected" + | Stmt_Repeat _ -> failwith "(FixRedefinitions) repeat not expected" + | Stmt_Try _ -> failwith "(FixRedefinitions) try not expected" + | _ -> DoChildren + + method! vs_elsif e = let c,e = match e with + | S_Elsif_Cond (c, sl) -> c,sl in + let sl = visit_stmts this e in + let sl = this#split_sl sl in + ChangeTo (S_Elsif_Cond (c,sl)) + + method! vexpr e = ChangeTo (this#split_exp e) + (*the generated code is too large with this, type inference seems to do ok without *) + (*method! vexpr e = match e with + | Expr_TApply _ -> DoChildren (* to preserve typing of fun returns *) + | e -> ChangeTo (this#split_exp e) *) + + method split_function (x:unit) = let sl = visit_stmts this (funsig.body) in (sl , extra_funs) + + end + +end + + +let rec write_stmt ?(primitive:bool=false) s st = + match s with + | Stmt_VarDeclsNoInit(ty, vs, loc) -> + List.iter (define st (Mutable ty)) vs ; + let e = default_value ty st in + List.iter (fun v -> write_ref v (Mutable ty) e st) vs + + | Stmt_VarDecl(ty, v, e, loc) -> + define st (Mutable ty) v; + let e = prints_expr e st in + write_ref v (Mutable ty) e st + + | Stmt_ConstDecl(ty, v, e, loc) -> + define st (Immutable ty) v; + let e = prints_expr e st in + write_let v (Immutable ty) e st + + | Stmt_Assign(l, r, loc) -> + let e = prints_expr r st in + write_assign l e st + + | Stmt_TCall(f, tes, es, loc) -> + let tes = List.map (fun e -> prints_expr e st) tes in + let es = List.map (fun e -> prints_expr e st) es in + write_call (name_of_ident f) tes es st + + | Stmt_FunReturn(e, loc) -> + write_fun_return (prints_expr e st) st + + | Stmt_ProcReturn(loc) -> + write_proc_return st + + | Stmt_Assert(e, loc) -> + write_assert (prints_expr e st) st + + | Stmt_Throw _ -> + write_unsupported st + + | Stmt_If(c, t, els, f, loc) -> + let rec iter = function + | S_Elsif_Cond(c,b)::xs -> + write_if_elsif (prints_expr c st) st; + write_stmts b st; + iter xs + | [] -> () in + write_if_start (prints_expr c st) st; + write_stmts t st; + iter els; + if f <> [] then (write_if_else st; write_stmts f st); + write_if_end st + + | _ -> failwith @@ "write_stmt: " ^ (pp_stmt s); + +and write_stmts ?(primitive:bool=false) s st = + inc_depth st; + push_scope st; + match s with + | [] -> + write_proc_return st; + dec_depth st + | x::xs -> + write_stmt x st; + List.iter (fun s -> + write_seq st; + write_stmt s st + ) xs; + dec_depth st; + assert (not st.skip_seq) + ; pop_scope st + + +let write_preamble imports opens st = + Printf.fprintf st.oc "/* AUTO-GENERATED ASLp LIFTER FILE */\npackage lifter\n"; + List.iter (fun n -> + Printf.fprintf st.oc "import %s\n" n) imports; + List.iter (fun n -> + Printf.fprintf st.oc "import %s._\n" n) opens; + Printf.fprintf st.oc "\n" + +open AST + +let init_b (u:unit) = Transforms.ScopedBindings.init () + +let init_st : st = { indent = 0; skip_seq=false; oc=stdout; mutable_vars = init_b (); extra_functions = Bindings.empty} + +let rinit_st oc st : st = {st with indent = 0; skip_seq=false; oc=oc; mutable_vars = init_b ()} + +let build_args (tys: ((var_type * ident) list)) targs args = + let targs = List.map (fun t -> name_of_ident t) targs in + (*let args = List.map (fun t -> name_of_ident t) args in *) + let ta = List.map (fun (t, i) -> (name_of_ident i) ^ ": " ^ (prints_arg_type t)) tys in + "(" ^ (String.concat "," (targs@ta)) ^ ")" + +let print_write_fn (name: AST.ident) ((ret_tyo: var_type), (argtypes: ((var_type * ident) list)), targs, args, _, body) st = + let open Transforms.ScopedBindings in + (*update_funcalls {name=(name_of_ident name); + targs=(List.map (fun _ -> Some (Type_Constructor (Ident "integer"))) targs); + args = List.map (fun (t, _) -> Some t) (argtypes)} (st.output_fun) ; *) + let wargs = build_args argtypes targs args in + let ret = prints_arg_type ret_tyo in + let ret = if (ret <> "") then (": " ^ ret) else "" in + (* bind params *) + push_scope st.mutable_vars () ; + List.iter (fun (a,b) -> add_bind st.mutable_vars b a) argtypes ; + + Printf.fprintf st.oc "def %s[RTSym, RTLabel, BV <: RTSym] %s %s = {\n" (name_of_ident name) wargs ret; + + write_stmts body st; + Printf.fprintf st.oc "\n}\n"; + + (* unbind params *) + pop_scope st.mutable_vars () + +let write_fn (name: AST.ident) (fn:sc_fun_sig) st = + if ((sl_complexity fn.body) < 1000) then (print_write_fn name (fn.rt, fn.arg_types, fn.targs, fn.args, (), fn.body) st) else + let ol = new FunctionSplitter.branch_outliner fn 5 in + let (nb,to_add) = ol#split_function () in + st.extra_functions <- to_add ; + print_write_fn name (fn.rt, fn.arg_types, fn.targs, fn.args, (), nb) st; + Bindings.iter (fun n b -> print_write_fn n (b.rt, b.arg_types, b.targs, b.args, (), b.body) st) to_add + +let lift_fsig (fs: Eval.fun_sig) : sc_fun_sig = + let assigned = assigned_vars_of_stmts (fnsig_get_body fs) in + let params = List.map (fun (t,i) -> if (IdentSet.mem i assigned) then Mutable t,i else Immutable t, i) (fnsig_get_typed_args fs) in + let rt = match (fnsig_get_rt fs) with + | Some x -> Immutable x + | None -> Unit + in {rt=rt; arg_types=(state_var.typ,state_var.ident)::params; targs=(fnsig_get_targs fs); args=(fnsig_get_args fs); body=(fnsig_get_body fs)} + + +(* Write an instruction file, containing just the behaviour of one instructions *) +let write_instr_file fn fnsig dir st = + let m = name_of_FIdent fn in + let path = dir ^ "/" ^ m ^ ".scala" in + let oc = open_out path in + let st = rinit_st oc st in + write_preamble global_imports global_opens st; + write_fn fn fnsig st; + close_out oc; + name_of_FIdent fn + + +(* Write the decoder file - should depend on all of the above *) +let write_decoder_file fn fnsig deps dir st = + let m = "aslpOffline" in + let path = dir ^ "/" ^ m ^ ".scala" in + let oc = open_out path in + let st = rinit_st oc st in + write_preamble global_imports (global_opens) st; + write_fn fn fnsig st; + close_out oc; + m + +(* Write the test file, containing all decode tests *) +let write_test_file tests dir st = + let m = "decode_tests" in + let path = dir ^ "/" ^ m ^".scala" in + let oc = open_out path in + let st = rinit_st oc st in + write_preamble global_imports (global_opens) st; + Bindings.iter (fun i s -> write_fn i (lift_fsig s) st) tests; + close_out oc; + m + +let run (dfn : ident) (dfnsig : ty option * 'a * ident list * ident list * 'b * stmt list) (tests : (ty option * 'a * ident list * ident list * 'b * stmt list) Bindings.t) (fns : (ty option * 'a * ident list * ident list * 'b * stmt list) Bindings.t) (dir : typeid) = + let st = init_st in + let files = Bindings.fold (fun fn fnsig acc -> (write_instr_file fn (lift_fsig fnsig) dir st)::acc) fns [] in + let files = (write_test_file tests dir st)::files in + write_decoder_file dfn (lift_fsig dfnsig) files dir st |> ignore ; + () + diff --git a/libASL/symbolic.ml b/libASL/symbolic.ml index 7f09e43f..e076200f 100644 --- a/libASL/symbolic.ml +++ b/libASL/symbolic.ml @@ -254,16 +254,6 @@ let sym_eq_bits = prim_binop "eq_bits" let sym_eq_real = prim_binop "eq_real" -let sym_inmask loc v mask = - match v with - | Val x -> Val (VBool (prim_in_mask (to_bits loc x) mask)) - | Exp e -> - let n = mask.n in - let ne = Expr_LitInt (string_of_int n) in - let m = val_expr (VBits {v = mask.m; n}) in - let v = val_expr (VBits {v = mask.v; n}) in - Exp (Expr_TApply (FIdent ("eq_bits", 0), [ne], [(Expr_TApply (FIdent ("and_bits", 0), [ne], [e; m]));v])) - let sym_eq (loc: AST.l) (x: sym) (y: sym): sym = (match (x,y) with | (Val x,Val y) -> Val (from_bool (eval_eq loc x y)) @@ -421,6 +411,16 @@ let sym_and_bits loc w (x: sym) (y: sym) = | x, Val y when is_one_bits y -> x | _ -> Exp (Expr_TApply (FIdent ("and_bits", 0), [w], [sym_expr x; sym_expr y]) ) +let sym_inmask loc v mask = + match v with + | Val x -> Val (VBool (prim_in_mask (to_bits loc x) mask)) + | Exp e -> + let n = mask.n in + let ne = Expr_LitInt (string_of_int n) in + let m = Val (VBits {v = mask.m; n}) in + let v = Val (VBits {v = mask.v; n}) in + sym_eq_bits loc (sym_and_bits loc ne (Exp e) m) v + let sym_or_bits loc w (x: sym) (y: sym) = match x, y with | Val x, Val y -> Val (VBits (prim_or_bits (to_bits loc x) (to_bits loc y))) diff --git a/libASL/symbolic_lifter.ml b/libASL/symbolic_lifter.ml index a40355f0..636a946f 100644 --- a/libASL/symbolic_lifter.ml +++ b/libASL/symbolic_lifter.ml @@ -12,15 +12,7 @@ open Visitor symbolic_lifter: - Remove unsupported_set with overrides.asl instead - - Remove unsupported globals, including partial record removal - - ocaml_backend: - - Break output into many files, better comp + debugging - - Identities on gen_ prims rather immediately building expressions - - Cleaner tuple unpacking - - offline: - - Reduce the number of runtime temporaries generated by offline_transform + - Move supported globals to backend *) (* Set of functions we do not want to analyse / inline due to their complexity *) @@ -32,22 +24,25 @@ let unsupported_set = IdentSet.of_list [ FIdent ("AArch64.SetExclusiveMonitors", 0); ] -(* Problematic instruction encoding names, due to various disassembly issues *) -let problematic_enc = [ - (* Need to extend RemoveUnsupported to remove all undesirable global variables & fields *) - "aarch64_system_register_system"; - "aarch64_system_register_cpsr"; +(* Backend specific: Globals we want to keep in the result *) +let supported_globals = IdentSet.of_list [ + Ident("PSTATE.C"); + Ident("PSTATE.Z"); + Ident("PSTATE.V"); + Ident("PSTATE.N"); + Ident("_PC"); + Ident("_R"); + Ident("_Z"); + Ident("SP_EL0"); + Ident("FPSR"); + Ident("FPCR"); ] -(* Model doesn't need these globals *) -(* Need to model these for coverage, but really should be excluded -let dead_globals = IdentSet.of_list [ - Ident "BTypeCompatible"; - Ident "__BranchTaken"; - Ident "BTypeNext"; - Ident "__ExclusiveLocal"; -] *) -let dead_globals = IdentSet.empty +(* Backend specific: Globals we are confident we can ignore *) +let ignored_globals = IdentSet.of_list [ + Ident("__BranchTaken"); + Ident("BTypeNext"); +] (** Trivial walk to replace unsupported calls with a corresponding throw *) module RemoveUnsupported = struct @@ -293,21 +288,41 @@ let unsupported_inst tests instrs f = let dis_wrapper fn fnsig env = let (lenv,globals) = Dis.build_env env in + let body = fnsig_get_body fnsig in + let args = fnsig_get_typed_args fnsig in + let config = {Dis.eval_env = env ; unroll_bound = Z.of_int64 Int64.max_int} in try - let body = fnsig_get_body fnsig in - let sym = Symbolic.Exp (Expr_Var (Decoder_program.enc)) in - let config = {Dis.eval_env = env ; unroll_bound = Z.of_int64 Int64.max_int} in - let (_,lenv,_) = (Dis.declare_assign_var Unknown (Type_Bits (Expr_LitInt "32")) (Ident "enc") sym) config lenv in - let ((),lenv',stmts) = (Dis.dis_stmts body) config lenv in - let globals = IdentSet.diff globals dead_globals in + (* Setup initial environment based on function arguments *) + let lenv = + (match args with + | [tenc, enc ; tpc, pc] -> + let (_,lenv,_) = Dis.declare_assign_var Unknown tenc enc (Symbolic.Exp (Expr_Var enc)) config lenv in + Dis.LocalEnv.setVar Unknown (Var (0, "_PC")) (Symbolic.Exp (Expr_Var pc)) lenv + | [tenc, enc] -> + let (_,lenv,_) = Dis.declare_assign_var Unknown tenc enc (Symbolic.Exp (Expr_Var enc)) config lenv in + lenv + | _ -> failwith @@ "Unexpected fn args: " ^ Utils.pp_list (fun (t,v) -> pp_type t ^ " " ^ pprint_ident v) args) in + + (* Run dis over the function body and extract the residual program *) + let ((),lenv',stmts) = Dis.dis_stmts body config lenv in let stmts = Dis.flatten stmts [] in - let stmts' = Transforms.RemoveUnused.remove_unused globals @@ stmts in + + (* Optional post-pass to prune unsupported globals and their fields *) + let stmts' = if false then + let flattened_globals = Transforms.UnsupportedVariables.flatten_vars (Eval.Env.readGlobals env) in + let unsupported_globals = IdentSet.diff flattened_globals supported_globals in + Transforms.UnsupportedVariables.do_transform ignored_globals unsupported_globals stmts + else stmts in + + (* Cleanup transforms *) + let stmts' = Transforms.RemoveUnused.remove_unused globals @@ stmts' in let stmts' = Transforms.RedundantSlice.do_transform Bindings.empty stmts' in let stmts' = Transforms.StatefulIntToBits.run (Dis.enum_types env) stmts' in let stmts' = Transforms.IntToBits.ints_to_bits stmts' in (*let stmts' = Transforms.CommonSubExprElim.do_transform stmts' in*) let stmts' = Transforms.CopyProp.copyProp stmts' in let stmts' = Transforms.RemoveUnused.remove_unused globals @@ stmts' in + let stmts' = Transforms.CaseSimp.do_transform stmts' in let stmts' = Transforms.RemoveRegisters.run stmts' in let stmts' = Cleanup.run false stmts' in let stmts' = Transforms.RemoveUnused.remove_unused globals @@ stmts' in @@ -320,11 +335,13 @@ let dis_wrapper fn fnsig env = Printf.printf "Error: %s %s\n" (name_of_FIdent fn) m; None +type offline_result = ident * Eval.fun_sig * Eval.fun_sig Bindings.t * Eval.fun_sig Bindings.t + (* Produce a lifter for the desired parts of the instruction set *) -let run iset pat env = +let run include_pc iset pat env : offline_result = Printf.printf "Stage 1: Mock decoder & instruction encoding definitions\n"; + let ((did,dsig),tests,instrs) = Decoder_program.run include_pc iset pat env in flush stdout; - let ((did,dsig),tests,instrs) = Decoder_program.run iset pat env problematic_enc in Printf.printf " Collected %d instructions\n\n" (Bindings.cardinal instrs); Printf.printf "Stage 2: Call graph construction\n"; @@ -354,11 +371,18 @@ let run iset pat env = let env' = Eval.Env.copy env in Bindings.iter (fun fn fnsig -> Eval.Env.addFun Unknown env' fn fnsig) fns; (* Run dis over the entry set identifiers with this new environment *) + let fns = Bindings.filter_map (fun fn fnsig -> - if not (Bindings.mem fn instrs) then None + if (not (Bindings.mem fn instrs)) then None else Option.map (fnsig_set_body fnsig) (dis_wrapper fn fnsig env')) fns in Printf.printf " Succeeded for %d instructions\n\n" (Bindings.cardinal fns); + let decoder = Eval.Env.getDecoder env (Ident iset) in + let decoderst : Transforms.DecoderChecks.st = Transforms.DecoderChecks.do_transform decoder in + let fns = Transforms.BDDSimp.transform_all fns decoderst in + let (_,globals) = Dis.build_env env in + let fns = Bindings.map (fnsig_upd_body (Transforms.RemoveUnused.remove_unused globals)) fns in + Printf.printf "Stmt Counts\n"; flush stdout; let l = Bindings.fold (fun fn fnsig acc -> (fn, stmts_count (fnsig_get_body fnsig))::acc) fns [] in @@ -376,10 +400,39 @@ let run iset pat env = Printf.printf "Stages 7-8: Offline Transform\n"; flush stdout; let offline_fns = Offline_transform.run fns env in - let offline_fns = Bindings.mapi (fun k -> fnsig_upd_body (Offline_opt.CopyProp.run k)) offline_fns in let offline_fns = Bindings.mapi (fun k -> fnsig_upd_body (Offline_opt.DeadContextSwitch.run k)) offline_fns in + + let freachable k = + let k = match k with + | FIdent (n, _) -> Ident n + | n -> n in + Bindings.find k decoderst.instrs + in + + let offline_fns = Bindings.mapi (fun k -> fnsig_upd_body (Offline_opt.RtCopyProp.run k (freachable k))) offline_fns in + Transforms.BDDSimp.print_unknown_prims (); + let dsig = fnsig_upd_body (DecoderCleanup.run (unsupported_inst tests offline_fns)) dsig in let dsig = fnsig_upd_body (Transforms.RemoveUnused.remove_unused IdentSet.empty) dsig in Printf.printf "\n"; (did,dsig,tests,offline_fns) + + +let run_marshal include_pc iset pat env : offline_result = + let fname = Printf.sprintf "marshalled-offline-lifter-%x" + (Hashtbl.seeded_hash 1234 (Printf.sprintf "%b %s %s" include_pc iset pat)) + in + if (Sys.file_exists fname) + then begin + Printf.printf "Using marshalled lifter (pc: %b iset: %s pat: %s): %s\n" include_pc iset pat fname; + let ic = open_in_bin fname in + let r: offline_result = Marshal.from_channel ic in + close_in ic; + r + end + else + let r: offline_result = run include_pc iset pat env in + let oc = open_out_bin fname in + Marshal.to_channel oc r []; close_out oc; + r diff --git a/libASL/transforms.ml b/libASL/transforms.ml index ed72b231..6ad43183 100644 --- a/libASL/transforms.ml +++ b/libASL/transforms.ml @@ -121,6 +121,18 @@ let infer_type (e: expr): ty option = (** Remove variables which are unused at the end of the statement list. *) module RemoveUnused = struct + let rec is_false = function + | Expr_Var (Ident "FALSE") -> true + | Expr_TApply (FIdent ("or_bool", 0), [], [a;b]) -> is_false a && is_false b + | Expr_TApply (FIdent ("and_bool", 0), [], [a;b]) -> is_false a || is_false b + | _ -> false + + let rec is_true = function + | Expr_Var (Ident "TRUE") -> true + | Expr_TApply (FIdent ("and_bool", 0), [], [a;b]) -> is_true a && is_true b + | Expr_TApply (FIdent ("or_bool", 0), [], [a;b]) -> is_true a || is_true b + | _ -> false + let rec remove_unused (globals: IdentSet.t) xs = fst (remove_unused' globals IdentSet.empty xs) and remove_unused' globals (used: IdentSet.t) (xs: stmt list): (stmt list * IdentSet.t) = @@ -152,10 +164,14 @@ module RemoveUnused = struct else pass (* Skip if structure if possible - often seen in decode tests *) - | Stmt_If(Expr_Var (Ident "TRUE"), tstmts, elsif, fstmts, loc) -> + | Stmt_If(c, tstmts, elsif, fstmts, loc) when is_true c -> let (tstmts',tused) = remove_unused' globals used tstmts in (tstmts'@acc,tused) + | Stmt_If(c, tstmts, [], fstmts, loc) when is_false c -> + let (fstmts',tused) = remove_unused' globals used fstmts in + (fstmts'@acc,tused) + | Stmt_If(c, tstmts, elsif, fstmts, loc) -> let (tstmts',tused) = remove_unused' globals used tstmts in let (fstmts',fused) = remove_unused' globals used fstmts in @@ -180,8 +196,9 @@ module RemoveUnused = struct let (body,used) = loop used in (Stmt_For(var, start, dir, stop, body, loc)::acc,used) + | Stmt_Assert (c, _) when is_true c -> pass (* Unreachable points *) - | Stmt_Assert (Expr_Var (Ident "FALSE"), _) + | Stmt_Assert (c, _) when is_false c -> halt stmt | Stmt_Throw _ -> halt stmt | x -> emit x @@ -237,6 +254,11 @@ module StatefulIntToBits = struct let l = Z.zero in (w, false, (u,l)) + let abs_of_interval (u: int) (l: int): abs = + let i = (Z.of_int u, Z.of_int l) in + let (w,s) = width_of_interval i in + (w, s, i) + (* Basic merge of abstract points *) let merge_abs ((lw,ls,(l1,l2)): abs) ((rw,rs,(r1,r2)): abs): abs = let s = ls || rs in @@ -292,6 +314,8 @@ module StatefulIntToBits = struct let width (n,_,_) = n let signed (_,s,_) = s let interval (_,_,i) = i + let lower (_,_,(_,l)) = l + let upper (_,_,(u,_)) = u (** Convert abstract point width into exprs & symbols *) let expr_of_abs a = @@ -526,49 +550,79 @@ module StatefulIntToBits = struct | Expr_TApply (FIdent ("eq_int", 0), [], [x;y]) -> let x = bv_of_int_expr st x in let y = bv_of_int_expr st y in - let w = merge_abs (snd x) (snd y) in - let ex = extend w in - sym_expr @@ sym_prim (FIdent ("eq_bits", 0)) [sym_of_abs w] [ex x; ex y] + (* If y is strictly greater, must be false *) + if Z.gt (lower (snd y)) (upper (snd x)) then expr_false + (* If x is strictly greater, must be false *) + else if Z.gt (lower (snd x)) (upper (snd y)) then expr_false + else + let w = merge_abs (snd x) (snd y) in + let ex = extend w in + sym_expr @@ sym_prim (FIdent ("eq_bits", 0)) [sym_of_abs w] [ex x; ex y] | Expr_TApply (FIdent ("ne_int", 0), [], [x;y]) -> let x = bv_of_int_expr st x in let y = bv_of_int_expr st y in - let w = merge_abs (snd x) (snd y) in - let ex = extend w in - sym_expr @@ sym_prim (FIdent ("ne_bits", 0)) [sym_of_abs w] [ex x; ex y] + (* If y is strictly greater, must be true *) + if Z.gt (lower (snd y)) (upper (snd x)) then expr_true + (* If x is strictly greater, must be true *) + else if Z.gt (lower (snd x)) (upper (snd y)) then expr_true + else + let w = merge_abs (snd x) (snd y) in + let ex = extend w in + sym_expr @@ sym_prim (FIdent ("ne_bits", 0)) [sym_of_abs w] [ex x; ex y] (* x >= y iff y <= x iff x - y >= 0*) | Expr_TApply (FIdent ("ge_int", 0), [], [x;y]) | Expr_TApply (FIdent ("le_int", 0), [], [y;x]) -> let x = force_signed (bv_of_int_expr st x) in let y = force_signed (bv_of_int_expr st y) in - let w = merge_abs (snd x) (snd y) in - let ex x = sym_expr (extend w x) in - expr_prim' "sle_bits" [expr_of_abs w] [ex y;ex x] + (* if largest y is smaller or equal than smallest x, must be true *) + if Z.leq (upper (snd y)) (lower (snd x)) then expr_true + (* if smallest y is greater than largest x, must be false *) + else if Z.gt (lower (snd y)) (upper (snd x)) then expr_false + else + let w = merge_abs (snd x) (snd y) in + let ex x = sym_expr (extend w x) in + expr_prim' "sle_bits" [expr_of_abs w] [ex y;ex x] (* x < y iff y > x iff x - y < 0 *) | Expr_TApply (FIdent ("lt_int", 0), [], [x;y]) | Expr_TApply (FIdent ("gt_int", 0), [], [y;x]) -> let x = force_signed (bv_of_int_expr st x) in let y = force_signed (bv_of_int_expr st y) in - let w = merge_abs (snd x) (snd y) in - let ex x = sym_expr (extend w x) in - expr_prim' "slt_bits" [expr_of_abs w] [ex x;ex y] + (* if largest y is smaller or equal than smallest x, must be true *) + if Z.lt (upper (snd x)) (lower (snd y)) then expr_true + (* if smallest y is greater than largest x, must be false *) + else if Z.geq (lower (snd x)) (upper (snd y)) then expr_false + else + let w = merge_abs (snd x) (snd y) in + let ex x = sym_expr (extend w x) in + expr_prim' "slt_bits" [expr_of_abs w] [ex x;ex y] (* Translation from enum to bit *) | Expr_TApply (FIdent ("eq_enum", n), [], [x;y]) when n > 0 -> let x = bv_of_int_expr st x in let y = bv_of_int_expr st y in - let w = merge_abs (snd x) (snd y) in - let ex = extend w in - (sym_expr @@ sym_prim (FIdent ("eq_bits", 0)) [sym_of_abs w] [ex x; ex y]) + (* If y is strictly greater, must be false *) + if Z.gt (lower (snd y)) (upper (snd x)) then expr_false + (* If x is strictly greater, must be false *) + else if Z.gt (lower (snd x)) (upper (snd y)) then expr_false + else + let w = merge_abs (snd x) (snd y) in + let ex = extend w in + (sym_expr @@ sym_prim (FIdent ("eq_bits", 0)) [sym_of_abs w] [ex x; ex y]) | Expr_TApply (FIdent ("ne_enum", n), [], [x;y]) when n > 0 -> let x = bv_of_int_expr st x in let y = bv_of_int_expr st y in - let w = merge_abs (snd x) (snd y) in - let ex = extend w in - (sym_expr @@ sym_prim (FIdent ("ne_bits", 0)) [sym_of_abs w] [ex x; ex y]) + (* If y is strictly greater, must be true *) + if Z.gt (lower (snd y)) (upper (snd x)) then expr_true + (* If x is strictly greater, must be true *) + else if Z.gt (lower (snd x)) (upper (snd y)) then expr_true + else + let w = merge_abs (snd x) (snd y) in + let ex = extend w in + (sym_expr @@ sym_prim (FIdent ("ne_bits", 0)) [sym_of_abs w] [ex x; ex y]) (* these functions take bits as first argument and integer as second. just coerce second to bits. *) (* TODO: primitive implementations of these expressions expect the shift amount to be signed, @@ -759,6 +813,7 @@ module StatefulIntToBits = struct | Stmt_VarDeclsNoInit _ | Stmt_Assign _ | Stmt_Assert _ + | Stmt_Throw _ | Stmt_TCall _ -> (st,stmt) | _ -> failwith "walk: invalid IR") in (st,acc@[stmt]) @@ -1285,6 +1340,7 @@ module CopyProp = struct let (body, _) = copyProp' body Bindings.empty in (acc@[Stmt_For (var, start, dir, stop, body, loc)], Bindings.empty) + | Stmt_Throw _ | Stmt_Assert (_, _) -> (* Statements that shouldn't clobber *) (acc@[subst_stmt copies stmt], copies) @@ -1571,6 +1627,7 @@ module CaseSimp = struct | Some (w, x', b), Some (r', c, w'), Some res when x' = x && r = r' -> Some (StringMap.add b c res) | _ -> None) | Stmt_Assert (Expr_Var(Ident "FALSE"), _) -> Some StringMap.empty + | Stmt_Throw _ -> Some StringMap.empty | _ -> None (* Match a chain of 'if X = BV_CONSTANT then R := BV_CONSTANT else if ... else assert FALSE', @@ -1690,6 +1747,7 @@ module type ScopedBindings = sig val add_bind : 'elt t -> ident -> 'elt -> unit val find_binding : 'elt t -> ident -> 'elt option val current_scope_bindings : 'elt t -> 'elt Bindings.t + val init: unit -> 'elt t end module ScopedBindings : ScopedBindings = struct @@ -1698,6 +1756,7 @@ module ScopedBindings : ScopedBindings = struct let pop_scope (b:'elt t) (_:unit) : unit = Stack.pop_opt b |> ignore let add_bind (b:'elt t) k v : unit = Stack.push (Bindings.add k v (Stack.pop b)) b let find_binding (b:'elt t) (i) : 'a option = Seq.find_map (fun s -> Bindings.find_opt i s) (Stack.to_seq b) + let init (u:unit) : 'elt t = let s = Stack.create () in Stack.push (Bindings.empty) s; s (** returns a flattened view of bindings accessible from the current (innermost) scope. *) @@ -1755,13 +1814,14 @@ module FixRedefinitions = struct this#add_bind b; DoChildren | Stmt_If (c, t, els, e, loc) -> let c' = visit_expr this c in - this#push_scope () ; + (* Don't push or pop scopes anymore so that variables are also unique across branches *) + (*this#push_scope () ; *) let t' = visit_stmts this t in - this#pop_scope (); this#push_scope () ; + (*this#pop_scope (); this#push_scope () ; *) let els' = mapNoCopy (visit_s_elsif this ) els in - this#pop_scope (); this#push_scope () ; + (*this#pop_scope (); this#push_scope () ; *) let e' = visit_stmts this e in - this#pop_scope (); + (*this#pop_scope (); *) ChangeTo (Stmt_If (c', t', els', e', loc)) | Stmt_For (var, start, dir, stop, body, loc) -> let start' = visit_expr this start in @@ -1788,7 +1848,6 @@ module FixRedefinitions = struct (match (this#existing_binding e) with | Some e -> ChangeTo (ident_for_v e) | None -> SkipChildren) - end let run (g: IdentSet.t) (s:stmt list) : stmt list = @@ -1796,6 +1855,850 @@ module FixRedefinitions = struct visit_stmts v s end +(* Ensure the program does not write or read a set of variables and fields. + Assumes all record accesses are fully flattened and no name collisions between + variable names and field accesses with '.' concatenation. + Reads and writes to unsupported variables are reduced to throws. + A set of variables and fields can be additionally nominated to be silently ignored, + such that their updates are removed, however, their reads will still become throws. + *) +module UnsupportedVariables = struct + type state = { + unsupported: IdentSet.t; + ignored: IdentSet.t; + debug: bool; + } + + let throw loc = Stmt_Throw(Ident ("UNSUPPORTED"), loc) + + let concat_ident a b = + match a, b with + | Ident a, Ident b -> Ident (a ^ "." ^ b) + | _ -> invalid_arg "concat_ident" + + (* Reduce a series of field accesses into a single ident *) + let rec reduce_expr e = + match e with + | Expr_Var v -> v + | Expr_Field (e, f) -> concat_ident (reduce_expr e) f + | _ -> invalid_arg @@ "reduce_expr: " ^ pp_expr e + let rec reduce_lexpr e = + match e with + | LExpr_Var (v) -> v + | LExpr_Field (e, f) -> concat_ident (reduce_lexpr e) f + | LExpr_Array (e, _) -> reduce_lexpr e + | _ -> invalid_arg @@ "reduce_lexpr: " ^ pp_lexpr e + + (* Test read/write sets, with logging *) + let unsupported_read name st = + let r = IdentSet.mem name st.unsupported || IdentSet.mem name st.ignored in + if r && st.debug then Printf.printf "Unsupported Read: %s\n" (pprint_ident name); + r + let ignored_write name st = + let r = IdentSet.mem name st.ignored in + if r && st.debug then Printf.printf "Ignored Write: %s\n" (pprint_ident name); + r + let unsupported_write name st = + let r = IdentSet.mem name st.unsupported in + if r && st.debug then Printf.printf "Unsupported Write: %s\n" (pprint_ident name); + r + + (* Search a stmt/expr for an unsupported load. + Assumes the load will be evaluated, i.e., no short-circuiting. + *) + class find_unsupported_read st = object + inherit nopAslVisitor + val mutable issue = false + method has_issue = issue + method! vexpr = function + | Expr_Var name -> + if unsupported_read name st then issue <- true; + SkipChildren + | Expr_Field _ as e -> + if unsupported_read (reduce_expr e) st then issue <- true; + SkipChildren + | _ -> DoChildren + end + + let unsupported_stmt stmt st = + let v = new find_unsupported_read st in + let _ = visit_stmt v stmt in + v#has_issue + + let unsupported_expr expr st = + let v = new find_unsupported_read st in + let _ = visit_expr v expr in + v#has_issue + + let rec walk stmts st = + List.fold_right (fun s acc -> + match s with + | Stmt_Assign(lexpr, e, loc) -> + let name = reduce_lexpr lexpr in + if ignored_write name st then acc + else if unsupported_write name st then [throw loc] + else if unsupported_stmt s st then [throw loc] + else s::acc + | Stmt_If(e, tstmts, [], fstmts, loc) when unsupported_expr e st -> + [throw loc] + | Stmt_If(e, tstmts, [], fstmts, loc) -> + let tstmts = walk tstmts st in + let fstmts = walk fstmts st in + Stmt_If(e, tstmts, [], fstmts, loc)::acc + | s -> + if unsupported_stmt s st then [throw (get_loc s)] + else s::acc) stmts [] + + (* Entry point to the transform *) + let do_transform ignored unsupported stmts = + let st = { ignored ; unsupported ; debug = false } in + walk stmts st + + (* Utility to convert a global state into flattened variable identifiers *) + let rec flatten_var (k: ident) (v: Value.value) = + match v with + | Value.VRecord bs -> + let fields = Bindings.bindings bs in + let vals = List.map (fun (f,v) -> flatten_var (concat_ident k f) v) fields in + List.flatten vals + | _ -> [k] + + let flatten_vars vars = + let globals = Bindings.bindings vars in + IdentSet.of_list (List.flatten (List.map (fun (k,v) -> flatten_var k v) globals)) + +end + +module DecoderChecks = struct + type sl = (int * int) + type st = { + ctx: MLBDD.man; + vars: sl Bindings.t; + cur_enc: MLBDD.t; + unpred: MLBDD.t; + unalloc: MLBDD.t; + nop: MLBDD.t; + instrs: MLBDD.t Bindings.t; + } + + let init_state = + let ctx = MLBDD.init ~cache:1024 () in + { + ctx ; + vars = Bindings.empty ; + cur_enc = MLBDD.dtrue ctx ; + unpred = MLBDD.dfalse ctx ; + unalloc = MLBDD.dfalse ctx ; + nop = MLBDD.dfalse ctx ; + instrs = Bindings.empty ; + } + + let get_slice s st = Bindings.find s st.vars + + let extract_field (IField_Field(f, lo, wd)) st = + { st with vars = Bindings.add f (lo,wd) st.vars } + + let add_unpred g st = + { st with unpred = MLBDD.dor st.unpred g } + + let add_unalloc g st = + { st with unalloc = MLBDD.dor st.unalloc g } + + let add_nop g st = + { st with nop = MLBDD.dor st.nop g } + + let add_instr k g st = + let existing = Option.value (Bindings.find_opt k st.instrs) ~default:(MLBDD.dfalse st.ctx) in + { st with instrs = Bindings.add k (MLBDD.dor existing g) st.instrs } + + let restrict_enc g st = + { st with cur_enc = MLBDD.dand st.cur_enc g } + + let set_enc g st = + { st with cur_enc = g } + + let bdd_of_mask bs lo ctx = + snd @@ String.fold_right (fun c (pos,e) -> + match c with + | ' ' -> (pos, e) + | 'x' -> (* No constraint *) + (pos + 1, e) + | '1' -> (* bit hi is true *) + let bit = MLBDD.ithvar ctx pos in + (pos + 1, MLBDD.dand bit e) + | '0' -> (* bit hi is true *) + let bit = MLBDD.dnot (MLBDD.ithvar ctx pos) in + (pos + 1, MLBDD.dand bit e) + | _ -> invalid_arg "bdd_of_mask") bs (lo,MLBDD.dtrue ctx) + + let implicant_to_mask m = + let chars = List.init 32 (fun i -> + if List.mem (true, i) m then '1' else + if List.mem (false, i) m then '0' else + 'x' + ) in + let buf = Buffer.create 32 in + List.iter (Buffer.add_char buf) (List.rev chars); + Buffer.contents buf + + let to_string bdd = + let imps = MLBDD.allprime bdd in + Utils.pp_list implicant_to_mask imps + + (* Represent slices in terms of their position in enc *) + let decode_slice s st = + match s with + | DecoderSlice_Slice(lo, wd) -> (lo,wd) + | DecoderSlice_FieldName f -> get_slice f st + | DecoderSlice_Concat fs -> failwith "DecoderSlice_Concat not expected" + + (* Convert decode patterns into BDDs *) + let rec decode_pattern (lo,wd) p ctx = + match p with + | DecoderPattern_Bits b + | DecoderPattern_Mask b -> bdd_of_mask b lo ctx + | DecoderPattern_Wildcard _ -> MLBDD.dtrue ctx + | DecoderPattern_Not p -> MLBDD.dnot (decode_pattern (lo,wd) p ctx) + + (* Combine the various tests due to a guard into one BDD *) + let decode_case_guard vs ps st = + List.fold_left2 (fun e s p -> MLBDD.dand e (decode_pattern s p st.ctx)) (st.cur_enc) vs ps + + (* Collect reachability for each instruction encoding IGNORING ordering on alts *) + let rec tf_decode_case b st = + match b with + | DecoderBody_UNPRED loc -> add_unpred st.cur_enc st + | DecoderBody_UNALLOC loc -> add_unalloc st.cur_enc st + | DecoderBody_NOP loc -> add_nop st.cur_enc st + | DecoderBody_Encoding(nm, loc) -> add_instr nm st.cur_enc st + | DecoderBody_Decoder(fs, c, loc) -> + tf_decoder c (List.fold_right extract_field fs st) + + and tf_decoder (DecoderCase_Case(ss, alts, loc)) st = + let vs = List.map (fun s -> decode_slice s st) ss in + let (st,_) = List.fold_left ( fun (st,prior) (DecoderAlt_Alt(ps,b))-> + let guard = decode_case_guard vs ps st in + let st' = tf_decode_case b (set_enc (MLBDD.dand prior guard) st) in + let prior = MLBDD.dand prior (MLBDD.dnot guard) in + let st = set_enc st.cur_enc st' in + (st,prior) ) (st,st.cur_enc) alts in + st + + let do_transform d : st = + tf_decoder d init_state + +end + +module type RTAnalysisLattice = sig + type rt (* RT lattice type *) + type olt (* LT lattice type *) + val xfer_stmt : olt -> rt -> stmt -> rt*stmt list + val join: olt -> olt -> olt -> rt -> rt -> rt +end + +module BDDSimp = struct + let log = false + + type abs = + Top | + Val of MLBDD.t list | + Bot + + type state = { + man: MLBDD.man; + vars: abs Bindings.t; + ctx: MLBDD.t; + stmts: stmt list; + } + + module type Lattice = RTAnalysisLattice with type olt = state + + module NopAnalysis = struct + type rt = unit + type olt = state + let xfer_stmt o r s = r,[s] + let join o c j r ro = () + let init _ = () + end + + + let init_state (ctx : MLBDD.t) = { + man = MLBDD.manager ctx; + vars = Bindings.empty ; + ctx ; + stmts = [] + } + + + let to_string bdd = + let imps = MLBDD.allprime bdd in + Utils.pp_list DecoderChecks.implicant_to_mask imps + + let pp_abs a = + match a with + | Top -> "Top" + | Bot -> "Bot" + | Val v -> Printf.sprintf "Val (%s)" (Utils.pp_list to_string v) + + let pp_state st = + Printf.sprintf "{ ctx = %s ; vars = %s }" (to_string st.ctx) (pp_bindings pp_abs st.vars) + + let is_true a st = + match a with + | Val [v] -> MLBDD.is_true (MLBDD.imply st.ctx v) + | _ -> false + + let is_false a st = + match a with + | Val [v] -> MLBDD.(is_true (imply st.ctx (dnot v))) + | _ -> false + + let halt st = + { st with ctx = MLBDD.dfalse st.man } + + let write s st = + { st with stmts = st.stmts @ [s] } + + let writeall stmts st = + { st with stmts = st.stmts @ stmts } + + let get_var v st = + match Bindings.find_opt v st.vars with + | Some v -> v + | _ -> if log then (Printf.printf "no var %s\n" (pprint_ident v)); Top (* logically this should be Bot, but need to init globals *) + + let add_var v abs st = + { st with vars = Bindings.add v abs st.vars } + + let restrict_ctx cond st = + match cond with + | Top -> st + | Bot -> st + | Val [cond] -> { st with ctx = MLBDD.dand st.ctx cond } + | _ -> invalid_arg "restrict_ctx" + + let to_bool abs st = + match abs with + | Top + | Bot -> MLBDD.dtrue st.man + | Val [v] -> v + | _ -> failwith "unexpected to_bool" + + let trivial_eq a b = + if List.length a <> List.length b then false + else List.fold_right2 (fun a b acc -> MLBDD.equal a b && acc) a b true + + let join_abs cond a b = + match cond, a, b with + | _, Top, _ + | _, _, Top -> Top + | _, Bot, a + | _, a, Bot -> a + | _, Val a, Val b when trivial_eq a b -> Val a + | Val [c], Val a, Val b when List.length a = List.length b -> + let a = List.map (MLBDD.dand c) a in + let ncond = MLBDD.dnot c in + let b = List.map (MLBDD.dand ncond) b in + Val (List.map2 MLBDD.dor a b) + | _, Val a, Val b -> Top + + let join_state cond a b = + let vars = Bindings.merge (fun k a b -> + match a, b with + | Some x, Some y -> Some (join_abs cond x y) + | Some x, _ -> Some x + | _, Some y -> Some y + | _ -> None) a.vars b.vars in + let ctx = MLBDD.dor a.ctx b.ctx in + { man = a.man ; vars ; ctx ; stmts = [] } + + let wrap_bop f a b = + match a, b with + | Bot, _ + | _, Bot -> Bot + | Top, _ + | _, Top -> Top + | Val a, Val b -> Val (f a b) + + let wrap_uop f a = + match a with + | Top -> Top + | Bot -> Bot + | Val a -> Val (f a) + + (****************************************************************) + (** Boolean Prims *) + (****************************************************************) + + let and_bool = wrap_bop (fun a b -> + match a, b with + | [a], [b] -> [MLBDD.dand a b] + | _ -> failwith "bad bool width") + + let or_bool = wrap_bop (fun a b -> + match a, b with + | [a], [b] -> [MLBDD.dor a b] + | _ -> failwith "bad bool width") + + let not_bool = wrap_uop (fun a -> + match a with + | [a] -> [MLBDD.dnot a] + | _ -> failwith "bad bool width") + + let eq_bool = wrap_bop (fun a b -> + match a, b with + | [a], [b] -> [MLBDD.eq a b] + | _ -> failwith "bad bool width") + + let ne_bool = wrap_bop (fun a b -> + match a, b with + | [a], [b] -> [MLBDD.(dnot (eq a b))] + | _ -> failwith "bad bool width") + + (****************************************************************) + (** Bitvector Prims *) + (****************************************************************) + + let and_bits = wrap_bop (List.map2 MLBDD.dand) + let or_bits = wrap_bop (List.map2 MLBDD.dor) + let eor_bits = wrap_bop (List.map2 MLBDD.xor) + + let not_bits = wrap_uop (List.map MLBDD.dnot) + + let eq_bits = wrap_bop (fun a b -> + let bits = List.map2 MLBDD.eq a b in + match bits with + | x::xs -> [List.fold_right MLBDD.dand xs x] + | _ -> failwith "bad bits width" + ) + let ne_bits a b = not_bool (eq_bits a b) + + let zero_extend_bits x nw st = + match x with + | Val v -> Val (List.init (nw - List.length v) (fun _ -> MLBDD.dfalse st.man) @ v) + | _ -> x + + let sign_extend_bits x nw st = + match x with + | Val (x::xs) -> Val (List.init (nw - List.length xs - 1) (fun _ -> x) @ (x::xs)) + | _ -> x + + let append_bits = wrap_bop (@) + + let rec sublist l start wd = + match l, start, wd with + | _, 0, 0 -> [] + | x::xs, 0, n -> x::(sublist xs 0 (n-1)) + | x::xs, n, _ -> sublist xs (n-1) wd + | _ -> invalid_arg "sublist" + + let extract_bits e lo wd = + match e with + | Top -> Top + | Bot -> Bot + | Val v -> + let start = List.length v - lo - wd in + Val (sublist v start wd) + + + let half_add_bit l r = MLBDD.dand l r, MLBDD.xor l r (* carry, sum *) + let full_add_bit l r carry = + let c1,s1 = half_add_bit l r in + let c2,o = half_add_bit s1 carry in + let ocarry = MLBDD.dor c1 c2 in + ocarry,o + + let twos_comp_add (xs : MLBDD.t list) (ys: MLBDD.t list) : MLBDD.t * (MLBDD.t list)= + let xs = List.rev xs in let ys = List.rev ys in + match xs,ys with + | hx::tlx,hy::tly -> + let lscarry,lsb = half_add_bit hx hy in + let bits,carry = List.fold_left2 + (fun (acc,carry) (l:MLBDD.t) (r:MLBDD.t) -> let carry,o = (full_add_bit l r carry) in o::acc , carry) + ([lsb], lscarry) tlx tly + in carry,bits + | _,_ -> failwith "invalid bit strings" + + let signed_add_wrap x y = let _,bits = twos_comp_add x y in bits + + + let addone m xs = let one = MLBDD.dtrue m in + let xs = List.rev xs in + let c,rs = match xs with + | hx::tlx -> + let lscarry,lsb = half_add_bit hx one in + let bits,carry = List.fold_left + (fun (acc,carry) (l:MLBDD.t) -> let carry,o = (half_add_bit l carry) in o::acc, carry) + ([lsb], lscarry) tlx + in carry,bits + | _ -> failwith "no" + in rs + + + let signed_negation m (x:MLBDD.t list) = addone m (List.map MLBDD.dnot x) + + let signed_sub_wrap m x y = let _,bits = twos_comp_add x (signed_negation m y) in bits + +(* + let signed_lt m x y = + + let signed_gt m x y = List.map MLBDD.dnot (signed_lt m x y) + *) + + + + let eq_bvs a b = + let bits = List.map2 MLBDD.eq a b in + match bits with + | x::xs -> List.fold_right MLBDD.dand xs x + | _ -> failwith "bad bits width" + + let sle_bits m x y = + MLBDD.dor + (MLBDD.dand (List.hd x) (MLBDD.dnot (List.hd y))) + (MLBDD.dnot (MLBDD.xor (List.hd x) (List.hd y)) ) + + (* https://cs.nyu.edu/pipermail/smt-lib/2007/000182.html *) + + let unknown_prims = ref Bindings.empty + let print_unknown_prims (c:unit) = if log then (Bindings.to_seq !unknown_prims |> List.of_seq |> List.sort (fun a b -> compare (snd a) (snd b)) + |> List.iter (fun (id,c) -> Printf.printf "%d \t : %s\n" c (pprint_ident id))) + + let eq_bit a b = MLBDD.dnot (MLBDD.xor a b) + + let bvugt m s t : MLBDD.t = let a, b = (List.fold_left2 (fun (gt, bnotsetfirst) a b -> + MLBDD.dor gt (MLBDD.dand (bnotsetfirst) ((MLBDD.dand a (MLBDD.dnot b)))), (* false until a > b*) + MLBDD.dand bnotsetfirst (MLBDD.dnot (MLBDD.dand (MLBDD.dnot gt) (MLBDD.dand b (MLBDD.dnot a)))) (* true until a < b*) + ) + (MLBDD.dfalse m, MLBDD.dtrue m) (s) (t)) + in (MLBDD.dand a b) + + let bvult m x y : MLBDD.t = bvugt m y x + let bvule m x y = MLBDD.dor (bvult m x y) (eq_bvs x y) + let bvuge m x y = MLBDD.dor (bvugt m x y) (eq_bvs x y) + + let bvslt m x y = MLBDD.dor + (MLBDD.dand (List.hd x) (MLBDD.dnot (List.hd y))) + (MLBDD.dand (eq_bit (List.hd x) (List.hd y)) (bvult m x y)) + + let bvsgt m x y = bvslt m y x + + let bvsle m x y = MLBDD.dor + (MLBDD.dand (List.hd x) (MLBDD.dnot (List.hd y))) + (MLBDD.dand (eq_bit (List.hd x) (List.hd y)) (bvule m x y)) + + let bvsge m x y = bvsle m y x + + let wrap_bv_bool f m x y = match x , y with + | Val x, Val y -> Val [(f m x y)] + | _,_ -> Top + + (* + let signed_gte_bits m x y = [MLBDD.dor (eq_bvs x y) (List.hd (signed_gt m x y))] + *) + + + let twos_comp_sub man (xs : MLBDD.t list) (ys: MLBDD.t list) = () + + let replicate_bits newlen bits = match bits with + | Val bits -> if Int.rem newlen (List.length bits) <> 0 then failwith "indivisible rep length" ; + let repeats = newlen / (List.length bits) in Val (List.concat (List.init repeats (fun i -> bits))) + | _ -> Top + + (****************************************************************) + (** Expr Walk *) + (****************************************************************) + + + let eval_prim f tes es st = + match f, tes, es with + | "and_bool", [], [x; y] -> and_bool x y + | "or_bool", [], [x; y] -> or_bool x y + | "eq_enum", [], [x; y] -> eq_bool x y + | "ne_enum", [], [x; y] -> ne_bool x y + | "not_bool", [], [x] -> not_bool x + + | "and_bits", [w], [x; y] -> and_bits x y + | "or_bits", [w], [x; y] -> or_bits x y + | "not_bits", [w], [x] -> not_bits x + | "eq_bits", [w], [x; y] -> eq_bits x y + | "ne_bits", [w], [x; y] -> ne_bits x y + | "eor_bits", [w], [x; y] -> eor_bits x y + + | "append_bits", [w;w'], [x; y] -> append_bits x y + (*| "replicate_bits", [w;Expr_LitInt nw], [x;times] -> replicate_bits (int_of_string nw) x *) + + | "ZeroExtend", [w;Expr_LitInt nw], [x; y] -> + zero_extend_bits x (int_of_string nw) st + | "SignExtend", [w;Expr_LitInt nw], [x; y] -> + sign_extend_bits x (int_of_string nw) st + + | "add_bits", [Expr_LitInt w], [x; y] -> (match x,y with + | Val x, Val y -> let r = (signed_add_wrap x y) in assert (List.length r == (int_of_string w)); Val r + | _,_ -> Top) + | "sub_bits", [w], [x; y] -> (match x,y with + | Val x, Val y -> Val (signed_add_wrap x (signed_negation st.man y)) + | _,_ -> Top) + + | "ule_bits", [w], [x; y] -> wrap_bv_bool bvule st.man x y + | "uge_bits", [w], [x; y] -> wrap_bv_bool bvuge st.man x y + | "sle_bits", [w], [x; y] -> wrap_bv_bool bvsle st.man x y + | "sge_bits", [w], [x; y] -> wrap_bv_bool bvsge st.man x y + | "slt_bits", [w], [x; y] -> wrap_bv_bool bvslt st.man x y + | "sgt_bits", [w], [x; y] -> wrap_bv_bool bvsgt st.man x y + + (* + + | "lsl_bits", [w], [x; y] -> Top + | "lsr_bits", [w], [x; y] -> Top + | "asr_bits", [w], [x; y] -> Top + | "mul_bits", _, [x; y] -> Top + *) + + | _, _, _ -> + unknown_prims := (Bindings.find_opt (Ident f) !unknown_prims) |> (function Some x -> x + 1 | None -> 0) + |> (fun x -> Bindings.add (Ident f) x !unknown_prims) ; + Top + + let rec eval_expr e st = + match e with + | Expr_Var (Ident "TRUE") -> Val ([ MLBDD.dtrue st.man ]) + | Expr_Var (Ident "FALSE") -> Val ([ MLBDD.dfalse st.man ]) + | Expr_LitBits b -> + Val (String.fold_right (fun c acc -> + match c with + | '1' -> (MLBDD.dtrue st.man)::acc + | '0' -> (MLBDD.dfalse st.man)::acc + | _ -> acc) b []) + | Expr_LitInt e -> Top + + | Expr_Var id -> get_var id st + + (* Simply not going to track these *) + | Expr_Field _ -> if log then Printf.printf "Overapprox field %s\n" (pp_expr e) ; Top + | Expr_Array _ -> if log then Printf.printf "Overapprox array %s\n" (pp_expr e); Top + + (* Prims *) + | Expr_TApply (FIdent (f, 0), tes, es) -> + let es = List.map (fun e -> eval_expr e st) es in + eval_prim f tes es st + | Expr_Slices(e, [Slice_LoWd(Expr_LitInt lo, Expr_LitInt wd)]) -> + let lo = int_of_string lo in + let wd = int_of_string wd in + let e = eval_expr e st in + extract_bits e lo wd + | Expr_Slices(e, [Slice_LoWd(lo,wd)]) -> if log then Printf.printf "Overapprox slice\n" ; Top + | Expr_Parens(e) -> eval_expr e st + | Expr_Fields _ -> if log then Printf.printf "unexpected Expr_Fields %s" (pp_expr e); Top + | Expr_In _ -> if log then Printf.printf "unexpected Expr_In %s" (pp_expr e); Top + | Expr_Unop _ -> if log then Printf.printf "unexpected Expr_Unop %s" (pp_expr e); Top + | Expr_Unknown _ -> if log then Printf.printf "unexpected Expr_Unkonwn %s" (pp_expr e); Top + | Expr_ImpDef _ -> if log then Printf.printf "unexpected Expr_ImpDef %s" (pp_expr e); Top + | Expr_LitString _ -> if log then Printf.printf "unexpected Expr_LitString %s" (pp_expr e); Top + | Expr_If _ -> if log then Printf.printf "unexpected Expr_If %s" (pp_expr e); Top + + | _ -> failwith @@ Printf.sprintf "BDDSimp eval_expr: unexpected expr: %s\n" (pp_expr e) + + (****************************************************************) + (** Stmt Walk *) + (****************************************************************) + + let join_imps a b = + List.filter (fun v -> List.mem v b) a + + let ctx_to_mask c = + let imps = MLBDD.allprime c in + match imps with + | x::xs -> List.fold_right join_imps xs x + | _ -> invalid_arg "ctx_to_mask" + + let clear_bits a c = + List.filter (fun (b,v) -> + if List.mem (b,v) c then false + else if List.mem (not b,v) c then false + else true) a + + + let bdd_to_expr cond st = + let bd_to_test b = + let bv = Value.to_mask Unknown (Value.from_maskLit b) in + sym_expr @@ sym_inmask Unknown (Exp (Expr_Var (Ident "enc"))) bv + in + match cond with + | Val [cond] -> + let imps = MLBDD.allprime cond in + let rebuild = List.fold_right (fun vars -> + MLBDD.dor + (List.fold_right (fun (b,v) -> + MLBDD.(dand (if b then ithvar st.man v else dnot (ithvar st.man v))) + ) vars (MLBDD.dtrue st.man)) + ) imps (MLBDD.dfalse st.man) in + let imps = MLBDD.allprime rebuild in + let masks = List.map DecoderChecks.implicant_to_mask imps in + (match masks with + | [] -> None + | [b] -> Some (bd_to_test b) + | b::bs -> + let try2 = MLBDD.dnot cond |> MLBDD.allprime |> List.map DecoderChecks.implicant_to_mask in + match try2 with + | [b] -> Some (Expr_TApply (FIdent ("not_bool", 0), [], [bd_to_test b])) + | _ -> (let r = (let tests = (List.map bd_to_test (b::bs)) in + let bool_or x y = Expr_TApply(FIdent("or_bool", 0), [], [x;y]) in + List.fold_left bool_or (List.hd tests) (List.tl tests)) in + Some r) + ) + | _ -> None + + let rebuild_expr e cond st = match bdd_to_expr cond st with + | Some x -> x + | None -> if log then Printf.printf "Unable to simplify expr" ; e + + + class nopvis = object(self) + method xf_stmt (x:stmt) (st:state) : stmt list = [x] + end + + let nop_transform = new nopvis + + module EvalWithXfer (Xf: Lattice) = struct + + let rec eval_stmt (xs:Xf.rt) (s:stmt) (st:state) = + (* (transfer : xs, s, st -> xs', s' ; eval : st -> s -> st' ; write s' : s' , st' -> st'' ) -> xs' s' st'' *) + let xs,ns = Xf.xfer_stmt st xs s in + match s with + | Stmt_VarDeclsNoInit(t, [v], loc) -> + let st = add_var v Bot st in + writeall ns st, xs + | Stmt_VarDecl(t, v, e, loc) -> + let abs = eval_expr e st in + let st = add_var v abs st in + writeall ns st, xs + | Stmt_ConstDecl(t, v, e, loc) -> + let abs = eval_expr e st in + let st = add_var v abs st in + writeall ns st,xs + | Stmt_Assign(LExpr_Var v, e, loc) -> + let abs = eval_expr e st in + let st = add_var v abs st in + writeall ns st,xs + + (* Eval the assert, attempt to discharge it & strengthen ctx *) + | Stmt_Assert(e, loc) -> + let abs = eval_expr e st in + if is_false abs st then st,xs + else + let e = rebuild_expr e abs st in + let st = write (Stmt_Assert(e,loc)) st in + restrict_ctx abs st, xs + + (* State becomes bot - unreachable *) + | Stmt_Throw _ -> + if log then Printf.printf "%s : %s\n" (pp_stmt s) (pp_state st); + let st = writeall ns st in + halt st,xs + + (* If we can reduce c to true/false, collapse *) + | Stmt_If(c, tstmts, [], fstmts, loc) -> + let cond = eval_expr c st in + + if is_true cond st then + eval_stmts xs tstmts st + else if is_false cond st then + eval_stmts xs fstmts st + else + let c = rebuild_expr c cond st in + let ncond = not_bool cond in + + let tst,xsa = eval_stmts xs tstmts (restrict_ctx cond {st with stmts = []}) in + let fst,xsb = eval_stmts xs fstmts (restrict_ctx ncond {st with stmts = []}) in + let st' = join_state cond tst fst in + let xs = Xf.join tst fst st' xsa xsb in + + let st' = writeall st.stmts st' in + let st' = write (Stmt_If (c, tst.stmts, [], fst.stmts, loc)) st' in + st',xs + + (* Can't do anything here *) + | Stmt_Assign _ + | Stmt_TCall _ -> + writeall ns st,xs + + | _ -> failwith "unknown stmt" + + and eval_stmts xs stmts st = + List.fold_left (fun (st,xs) s -> if MLBDD.is_false st.ctx then st,xs else (eval_stmt xs s st)) (st,xs) stmts + + end + + let set_enc st = + let enc = Val (List.rev (List.init 32 (MLBDD.ithvar st.man))) in + {st with vars = Bindings.add (Ident "enc") enc st.vars} + + module Eval = EvalWithXfer(NopAnalysis) + + let just_eval a b c = fst (Eval.eval_stmts (NopAnalysis.init ()) a b) + + let do_transform fn stmts reach = + let st = init_state reach in + let st = set_enc st in + let st',xs = Eval.eval_stmts (NopAnalysis.init ()) stmts st in + st'.stmts + + + let rec split_on_bit imps = + if List.length imps == 0 then begin + if log then Printf.printf "Dead end\n"; + 1 + end + else if List.length imps == 1 then begin + if log then Printf.printf "Match on %s\n" (match imps with [(k,e)] -> pprint_ident k | _ -> failwith "huh"); + 1 + end + else + (* rank bits by the frequency with which they are constrained *) + let bits = List.init 32 (fun i -> + let freq = List.length (List.filter (fun (k,e) -> List.exists (fun (_,j) -> i = j) e) imps) in + (i,freq)) in + let max = List.fold_right (fun (i,f) (j,m) -> if f > m then (i,f) else (j,m)) bits (-1,0) in + if fst max == -1 then begin + if log then Printf.printf "Ended up with %s\n" (Utils.pp_list (fun (k,s) -> pprint_ident k ^ ":" ^ DecoderChecks.implicant_to_mask s) imps); + failwith "huh" + end; + let set = List.filter (fun (k,e) -> not (List.mem (false,fst max) e)) imps in + let set = List.map (fun (k,e) -> (k,List.filter (fun (f,i) -> i <> fst max) e)) set in + let clr = List.filter (fun (k,e) -> not (List.mem (true,fst max) e)) imps in + let clr = List.map (fun (k,e) -> (k,List.filter (fun (f,i) -> i <> fst max) e)) clr in + if log then Printf.printf "Splitting on %d, sub-lists %d %d of %d\n" (fst max) (List.length set) (List.length clr) (List.length imps); + if List.length set + List.length clr <> List.length imps then begin + if log then Printf.printf "Duplication for %s\n" (Utils.pp_list (fun (k,s) -> pprint_ident k ^ ":" ^ DecoderChecks.implicant_to_mask s) imps); + 1 + end + else begin + let d1 = split_on_bit set in + let d2 = split_on_bit clr in + 1 + (Int.max d1 d2) + end + + let transform_all instrs (st:DecoderChecks.st)= + (* get all prim implicants for each instruction, one list *) + let imps = Bindings.fold (fun k e acc -> + let imps = MLBDD.allprime e in + let entries = List.map (fun e -> (k,e)) imps in + acc@entries) st.instrs [] in + + let res = split_on_bit imps in + + if log then Printf.printf "Max depth of %d\n" res; + + + Bindings.mapi (fun nm fnsig -> + let i = match nm with FIdent(s,_) -> Ident s | s -> s in + match Bindings.find_opt i st.instrs with + | Some reach -> fnsig_upd_body (fun b -> + if log then Printf.printf "transforming %s\n" (pprint_ident nm); + do_transform nm b reach) fnsig + | None -> fnsig) instrs +end (* The analysis attempts to argue that all loop computations diff --git a/offlineASL-cpp/.gitignore b/offlineASL-cpp/.gitignore index ced121b0..5c0eccd6 100644 --- a/offlineASL-cpp/.gitignore +++ b/offlineASL-cpp/.gitignore @@ -1,3 +1,4 @@ +generated !.gitkeep build diff --git a/offlineASL-cpp/build.sh b/offlineASL-cpp/build.sh new file mode 100755 index 00000000..f062d62e --- /dev/null +++ b/offlineASL-cpp/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -o pipefail + +GEN_DIR="${GEN_DIR:-$(dirname $0)/../../aslp-lifter-cpp}" +set -xe + +[[ -d "$GEN_DIR" ]] +if [[ -z "$CXX" ]]; then + export CXX=$(command -v clang++) +fi + +echo ":gen A64 .+ cpp $GEN_DIR/subprojects/aslp-lifter" | dune exec asli + +cd $GEN_DIR +rm -rf build + +meson setup build $MESONFLAGS +meson compile -C build diff --git a/offlineASL-cpp/subprojects/aslp-lifter-llvm/include/aslp/llvm_interface.hpp b/offlineASL-cpp/subprojects/aslp-lifter-llvm/include/aslp/llvm_interface.hpp index 604d39e9..526454b2 100644 --- a/offlineASL-cpp/subprojects/aslp-lifter-llvm/include/aslp/llvm_interface.hpp +++ b/offlineASL-cpp/subprojects/aslp-lifter-llvm/include/aslp/llvm_interface.hpp @@ -167,6 +167,43 @@ class llvm_run_time_interface : virtual public lifter_interface=16', '<18']) +llvm_dep = dependency('llvm', version: ['>=16', '<19']) empty_dep = dependency('', required: false) lifter_dep = dependency('aslp-lifter', version: version, fallback: ['aslp-lifter', 'gen_dep']) diff --git a/offlineASL-cpp/subprojects/aslp-lifter/include/aslp/interface.hpp b/offlineASL-cpp/subprojects/aslp-lifter/include/aslp/interface.hpp index 2e1438b5..b8593419 100644 --- a/offlineASL-cpp/subprojects/aslp-lifter/include/aslp/interface.hpp +++ b/offlineASL-cpp/subprojects/aslp-lifter/include/aslp/interface.hpp @@ -41,6 +41,15 @@ template class lifter_interface : public Traits { virtual rt_lexpr v_SP_EL0() = 0; virtual rt_lexpr v_FPSR() = 0; virtual rt_lexpr v_FPCR() = 0; + virtual rt_lexpr v_PSTATE_UAO() = 0; + virtual rt_lexpr v_PSTATE_PAN() = 0; + virtual rt_lexpr v_PSTATE_DIT() = 0; + virtual rt_lexpr v_PSTATE_SSBS() = 0; + virtual rt_lexpr v_PSTATE_G() = 0; + virtual rt_lexpr v_PSTATE_A() = 0; + virtual rt_lexpr v_PSTATE_I() = 0; + virtual rt_lexpr v_PSTATE_F() = 0; + virtual rt_lexpr v_PSTATE_D() = 0; virtual rt_lexpr v_PSTATE_BTYPE() = 0; virtual rt_lexpr v_BTypeCompatible() = 0; diff --git a/offlineASL-scala/.gitignore b/offlineASL-scala/.gitignore new file mode 100644 index 00000000..cffb8e49 --- /dev/null +++ b/offlineASL-scala/.gitignore @@ -0,0 +1,4 @@ + +lifter/src/generated/* +.metals +out diff --git a/offlineASL-scala/build.sc b/offlineASL-scala/build.sc new file mode 100644 index 00000000..bffc3304 --- /dev/null +++ b/offlineASL-scala/build.sc @@ -0,0 +1,23 @@ +import mill._, scalalib._ + + + + +object lifter extends ScalaModule { + def scalaVersion = "3.3.1" +} + +object main extends ScalaModule { + def scalaVersion = "3.3.1" + + def moduleDeps = Seq(lifter) + + def ivyDeps = Agg( + ivy"com.lihaoyi::mainargs:0.6.2", + ivy"com.lihaoyi::sourcecode:0.3.0" + ) + + def mainClass = Some("main.Main") + + } + diff --git a/offlineASL-scala/lifter/src/interface.scala b/offlineASL-scala/lifter/src/interface.scala new file mode 100644 index 00000000..5a363fa2 --- /dev/null +++ b/offlineASL-scala/lifter/src/interface.scala @@ -0,0 +1,145 @@ +package lifter + +class Mutable[T](var v: T) + +trait LiftState[RTSym, RTLabel, BV <: RTSym] { + + /* Lift-time semantics */ + def mkBits(n: BigInt, y: BigInt): BV + def bvextract(e: BV, lo: BigInt, width: BigInt): BV + def f_eq_bits(t: BigInt, x: BV, y: BV): Boolean + def f_ne_bits(t: BigInt, x: BV, y: BV): Boolean + def f_add_bits(t: BigInt, x: BV, y: BV): BV + def f_sub_bits(t: BigInt, x: BV, y: BV): BV + def f_mul_bits(t: BigInt, x: BV, y: BV): BV + def f_and_bits(t: BigInt, x: BV, y: BV): BV + def f_or_bits(t: BigInt, x: BV, y: BV): BV + def f_eor_bits(t: BigInt, x: BV, y: BV): BV + def f_not_bits(t: BigInt, x: BV): BV + def f_slt_bits(t: BigInt, x: BV, y: BV): Boolean + def f_sle_bits(t: BigInt, x: BV, y: BV): Boolean + def f_zeros_bits(w: BigInt): BV + def f_ones_bits(w: BigInt): BV + def f_ZeroExtend(t0: BigInt, t1: BigInt, n: BV, x: BigInt): BV + def f_SignExtend(t0: BigInt, t1: BigInt, n: BV, x: BigInt): BV + def f_asr_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BV): BV + def f_lsl_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BV): BV + def f_lsr_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BV): BV + def f_decl_bool(arg0: String): RTSym + def f_decl_bv(arg0: String, arg1: BigInt): RTSym + def f_AtomicEnd(): RTSym + def f_AtomicStart(): RTSym + + def f_replicate_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BigInt): BV + def f_append_bits(targ0: BigInt, targ1: BigInt, a: BV, b: BV): BV + + /** Run-time IR program generation */ + + def f_gen_BFAdd(arg0: RTSym, arg1: RTSym): RTSym + def f_gen_BFMul(arg0: RTSym, arg1: RTSym): RTSym + def f_gen_FPAdd(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPCompare(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym + def f_gen_FPCompareEQ(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPCompareGE(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPCompareGT(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPConvert(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPConvertBF(arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPDiv(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPMax(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPMaxNum(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPMin(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPMinNum(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPMul(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPMulAdd(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym + def f_gen_FPMulAddH(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym + def f_gen_FPMulX(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPRSqrtStepFused(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_FPRecipEstimate(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_FPRecipStepFused(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_FPRecpX(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_FPRoundInt(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym + def f_gen_FPRoundIntN(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym + def f_gen_FPSqrt(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_FPSub(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FPToFixed(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym, arg4: RTSym): RTSym + def f_gen_FPToFixedJS_impl(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_FixedToFP(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym, arg4: RTSym): RTSym + def f_gen_bit_lit(targ0: BigInt, arg0: BV): RTSym + def f_gen_bool_lit(arg0: Boolean): RTSym + def f_gen_branch(arg0: RTSym): RTLabel + def f_cvt_bits_uint(targ0: BigInt, arg0: BV): BigInt + def f_gen_cvt_bits_uint(targ0: BigInt, arg0: RTSym): RTSym + def f_gen_cvt_bool_bv(arg0: RTSym): RTSym + def f_gen_eor_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_eq_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_eq_enum(arg0: RTSym, arg1: RTSym): RTSym + def f_gen_int_lit(arg0: BigInt): BV + def f_gen_store(lval: RTSym, e: RTSym): Unit + def f_gen_load(e: RTSym): RTSym + def f_gen_SignExtend(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: BV): RTSym + def f_gen_ZeroExtend(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: BV): RTSym + def f_gen_add_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_and_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_and_bool(arg0: RTSym, arg1: RTSym): RTSym + def f_gen_asr_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_lsl_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_lsr_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_mul_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_ne_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_not_bits(targ0: BigInt, arg0: RTSym): RTSym + def f_gen_not_bool(arg0: RTSym): RTSym + def f_gen_or_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_or_bool(arg0: RTSym, arg1: RTSym): RTSym + def f_gen_sdiv_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_sle_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_slt_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_sub_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_AArch64_MemTag_set(arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_Mem_read(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym + def f_gen_slice(e: RTSym, lo: BigInt, wd: BigInt): RTSym + def f_gen_replicate_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: BV): RTSym + def f_gen_append_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym + def f_gen_array_load(arg0: RTSym, arg1: BigInt): RTSym + def f_gen_array_store(arg0: RTSym, arg1: BigInt, arg2: RTSym): Unit + def f_gen_Mem_set(sz: BigInt, ptr: RTSym, width: BV, acctype: RTSym, value: RTSym): Unit + def f_gen_assert(arg0: RTSym): Unit + + def f_switch_context(arg0: RTLabel): Unit + def f_true_branch(arg0: RTLabel): RTLabel + def f_false_branch(arg0: RTLabel): RTLabel + def f_merge_branch(arg0: RTLabel): RTLabel + + + /** Global variable definitions * */ + + def rTLabelDefault : RTLabel + def rTSymDefault : RTSym + def rTExprDefault : RTSym + + def v_PSTATE_UAO: Mutable[RTSym] + def v_PSTATE_PAN: Mutable[RTSym] + def v_PSTATE_DIT: Mutable[RTSym] + def v_PSTATE_SSBS: Mutable[RTSym] + def v_PSTATE_G: Mutable[RTSym] + def v_PSTATE_A: Mutable[RTSym] + def v_PSTATE_I: Mutable[RTSym] + def v_PSTATE_F: Mutable[RTSym] + def v_PSTATE_D: Mutable[RTSym] + def v_PSTATE_C: Mutable[RTSym] + def v_PSTATE_Z: Mutable[RTSym] + def v_PSTATE_V: Mutable[RTSym] + def v_PSTATE_N: Mutable[RTSym] + def v__PC: Mutable[RTSym] + def v__R: Mutable[RTSym] + def v__Z: Mutable[RTSym] + def v_SP_EL0: Mutable[RTSym] + def v_FPSR: Mutable[RTSym] + def v_FPCR: Mutable[RTSym] + + def v_PSTATE_BTYPE: Mutable[RTSym] + def v_BTypeCompatible: Mutable[RTSym] + def v___BranchTaken: Mutable[RTSym] + def v_BTypeNext: Mutable[RTSym] + def v___ExclusiveLocal: Mutable[RTSym] + +} diff --git a/offlineASL-scala/main/src/Main.scala b/offlineASL-scala/main/src/Main.scala new file mode 100644 index 00000000..32e63c4f --- /dev/null +++ b/offlineASL-scala/main/src/Main.scala @@ -0,0 +1,20 @@ +// package scala + +package main +import mainargs.{main, arg, ParserForMethods, Flag} + +object Main { + @main + def run(@arg(short = 'o', name="opcode", doc = "Opcode in gcc (little-endian) format") + opc: String, + @arg(doc = "Program counter as decimal") + pcn: String = "0") = { + + val op_num = BigInt(opc.stripPrefix("0x"), 16); + val pc_num = BigInt(pcn); + + Lifter.liftOpcode(op_num, pc_num) + } + + def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args) +} diff --git a/offlineASL-scala/main/src/NoneLifter.scala b/offlineASL-scala/main/src/NoneLifter.scala new file mode 100644 index 00000000..1b2f61af --- /dev/null +++ b/offlineASL-scala/main/src/NoneLifter.scala @@ -0,0 +1,174 @@ +package main +import lifter._ + +/** + * User-provided implementation of the lift-time semantics (e.g. f_eq_bits) and IBI (e.g. f_gen_eq_bits). + */ + +sealed trait RExpr +case class BitVec(val value: BigInt, val size: BigInt) extends RExpr +case class OtherExpr() extends RExpr + +class NotImplementedLifter extends LiftState[RExpr, String, BitVec] { + type BV = BitVec /* Lift-time bitvector representation, must be BV <: RTSym */ + type RTSym = RExpr /* Run-time expression representation */ + type RTLabel = String /* Block/branch labels for gen_branch */ + + + /* Lift-time semantics */ + def mkBits(n: BigInt, y: BigInt): BV = throw NotImplementedError() + def bvextract(e: BV, lo: BigInt, width: BigInt): BV = throw NotImplementedError() + def f_eq_bits(t: BigInt, x: BV, y: BV): Boolean = throw NotImplementedError() + def f_ne_bits(t: BigInt, x: BV, y: BV): Boolean = throw NotImplementedError() + def f_add_bits(t: BigInt, x: BV, y: BV): BV = throw NotImplementedError() + def f_sub_bits(t: BigInt, x: BV, y: BV): BV = throw NotImplementedError() + def f_mul_bits(t: BigInt, x: BV, y: BV): BV = throw NotImplementedError() + def f_and_bits(t: BigInt, x: BV, y: BV): BV = throw NotImplementedError() + def f_or_bits(t: BigInt, x: BV, y: BV): BV = throw NotImplementedError() + def f_eor_bits(t: BigInt, x: BV, y: BV): BV = throw NotImplementedError() + def f_not_bits(t: BigInt, x: BV): BV = throw NotImplementedError() + def f_slt_bits(t: BigInt, x: BV, y: BV): Boolean = throw NotImplementedError() + def f_sle_bits(t: BigInt, x: BV, y: BV): Boolean = throw NotImplementedError() + def f_zeros_bits(w: BigInt): BV = throw NotImplementedError() + def f_ones_bits(w: BigInt): BV = throw NotImplementedError() + def f_ZeroExtend(t0: BigInt, t1: BigInt, n: BV, x: BigInt): BV = throw NotImplementedError() + def f_SignExtend(t0: BigInt, t1: BigInt, n: BV, x: BigInt): BV = throw NotImplementedError() + def f_asr_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BV): BV = throw NotImplementedError() + def f_lsl_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BV): BV = throw NotImplementedError() + def f_lsr_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BV): BV = throw NotImplementedError() + def f_decl_bool(arg0: String): RTSym = throw NotImplementedError() + def f_decl_bv(arg0: String, arg1: BigInt): RTSym = throw NotImplementedError() + def f_AtomicEnd(): RTSym = throw NotImplementedError() + def f_AtomicStart(): RTSym = throw NotImplementedError() + + def f_replicate_bits(targ0: BigInt, targ1: BigInt, arg0: BV, arg1: BigInt): BV = throw NotImplementedError() + def f_append_bits(targ0: BigInt, targ1: BigInt, a: BV, b: BV): BV = throw NotImplementedError() + + /** Run-time IR program generation */ + + def f_gen_BFAdd(arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_BFMul(arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPAdd(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPCompare(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPCompareEQ(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPCompareGE(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPCompareGT(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPConvert(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPConvertBF(arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPDiv(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMax(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMaxNum(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMin(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMinNum(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMul(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMulAdd(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMulAddH(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPMulX(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPRSqrtStepFused(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPRecipEstimate(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPRecipStepFused(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPRecpX(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPRoundInt(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPRoundIntN(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPSqrt(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPSub(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPToFixed(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym, arg4: RTSym): RTSym = throw NotImplementedError() + def f_gen_FPToFixedJS_impl(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_FixedToFP(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym, arg3: RTSym, arg4: RTSym): RTSym = throw NotImplementedError() + def f_gen_bit_lit(targ0: BigInt, arg0: BV): RTSym = throw NotImplementedError() + def f_gen_bool_lit(arg0: Boolean): RTSym = throw NotImplementedError() + def f_gen_branch(arg0: RTSym): RTLabel = throw NotImplementedError() + def f_cvt_bits_uint(targ0: BigInt, arg0: BV): BigInt = throw NotImplementedError() + def f_gen_cvt_bits_uint(targ0: BigInt, arg0: RTSym): RTSym = throw NotImplementedError() + def f_gen_cvt_bool_bv(arg0: RTSym): RTSym = throw NotImplementedError() + def f_gen_eor_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_eq_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_eq_enum(arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_int_lit(arg0: BigInt): BV = throw NotImplementedError() + def f_gen_store(lval: RTSym, e: RTSym): Unit = throw NotImplementedError() + def f_gen_load(e: RTSym): RTSym = throw NotImplementedError() + def f_gen_SignExtend(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: BV): RTSym = throw NotImplementedError() + def f_gen_ZeroExtend(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: BV): RTSym = throw NotImplementedError() + def f_gen_add_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_and_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_and_bool(arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_asr_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_lsl_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_lsr_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_mul_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_ne_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_not_bits(targ0: BigInt, arg0: RTSym): RTSym = throw NotImplementedError() + def f_gen_not_bool(arg0: RTSym): RTSym = throw NotImplementedError() + def f_gen_or_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_or_bool(arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_sdiv_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_sle_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_slt_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_sub_bits(targ0: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_AArch64_MemTag_set(arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_Mem_read(targ0: BigInt, arg0: RTSym, arg1: RTSym, arg2: RTSym): RTSym = throw NotImplementedError() + def f_gen_slice(e: RTSym, lo: BigInt, wd: BigInt): RTSym = throw NotImplementedError() + def f_gen_replicate_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: BV): RTSym = throw NotImplementedError() + def f_gen_append_bits(targ0: BigInt, targ1: BigInt, arg0: RTSym, arg1: RTSym): RTSym = throw NotImplementedError() + def f_gen_array_load(arg0: RTSym, arg1: BigInt): RTSym = throw NotImplementedError() + def f_gen_array_store(arg0: RTSym, arg1: BigInt, arg2: RTSym): Unit = throw NotImplementedError() + def f_gen_Mem_set(sz: BigInt, ptr: RTSym, width: BV, acctype: RTSym, value: RTSym): Unit = throw NotImplementedError() + def f_gen_assert(arg0: RTSym): Unit = throw NotImplementedError() + + def f_switch_context(arg0: RTLabel): Unit = throw NotImplementedError() + def f_true_branch(arg0: RTLabel): RTLabel = throw NotImplementedError() + def f_false_branch(arg0: RTLabel): RTLabel = throw NotImplementedError() + def f_merge_branch(arg0: RTLabel): RTLabel = throw NotImplementedError() + + + /** Global variable definitions * */ + + def rTLabelDefault : RTLabel = throw NotImplementedError() + def rTSymDefault : RTSym = throw NotImplementedError() + def rTExprDefault : RTSym = throw NotImplementedError() + + def v_PSTATE_UAO: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_PAN: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_DIT: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_SSBS: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_G: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_A: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_I: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_F: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_D: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_C: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_Z: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_V: Mutable[RTSym] = throw NotImplementedError() + def v_PSTATE_N: Mutable[RTSym] = throw NotImplementedError() + def v__PC: Mutable[RTSym] = throw NotImplementedError() + def v__R: Mutable[RTSym] = throw NotImplementedError() + def v__Z: Mutable[RTSym] = throw NotImplementedError() + def v_SP_EL0: Mutable[RTSym] = throw NotImplementedError() + def v_FPSR: Mutable[RTSym] = throw NotImplementedError() + def v_FPCR: Mutable[RTSym] = throw NotImplementedError() + + def v_PSTATE_BTYPE: Mutable[RTSym] = throw NotImplementedError() + def v_BTypeCompatible: Mutable[RTSym] = throw NotImplementedError() + def v___BranchTaken: Mutable[RTSym] = throw NotImplementedError() + def v_BTypeNext: Mutable[RTSym] = throw NotImplementedError() + def v___ExclusiveLocal: Mutable[RTSym] = throw NotImplementedError() + +} + + +object Lifter { + + def liftOpcode(op: BigInt, sp: BigInt) = { + var liftState = NotImplementedLifter() + /* Invoking the lifter */ + val dec = f_A64_decoder[RExpr, String, BitVec](liftState, BitVec(op, 32), BitVec(sp, 64)) + } + + + def liftOpcode(op: BigInt) = { + var liftState = NotImplementedLifter() + /* Invoking the lifter */ + val dec = f_A64_decoder[RExpr, String, BitVec](liftState, BitVec(op, 32), BitVec(0, 64)) + } + +} diff --git a/offlineASL-scala/readme.md b/offlineASL-scala/readme.md new file mode 100644 index 00000000..6246252c --- /dev/null +++ b/offlineASL-scala/readme.md @@ -0,0 +1,9 @@ +Build standalone Scala lifter interface + +``` +# (in parent direictory) +~ echo ':gen A64 aarch64.+ scala true scalaOfflineASL/lifter/generated' | dune exec asli +~ cd scalaOfflineASL +~ ./mill lifter.assembly +~ ./mill main.run +``` diff --git a/offlineASL/offline_utils.ml b/offlineASL/offline_utils.ml index cab91bf3..74e84992 100644 --- a/offlineASL/offline_utils.ml +++ b/offlineASL/offline_utils.ml @@ -57,10 +57,20 @@ let v_SP_EL0 = Expr_Var(Ident "SP_EL0") let v_FPSR = Expr_Var(Ident "FPSR") let v_FPCR = Expr_Var(Ident "FPCR") -let v_PSTATE_BTYPE = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "BTYPE") -let v_BTypeCompatible = Expr_Var (Ident "BTypeCompatible") -let v___BranchTaken = Expr_Var (Ident "__BranchTaken") -let v_BTypeNext = Expr_Var (Ident "BTypeNext") +let v_PSTATE_A = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "A") +let v_PSTATE_D = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "D") +let v_PSTATE_DIT = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "DIT") +let v_PSTATE_F = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "F") +let v_PSTATE_I = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "I") +let v_PSTATE_PAN = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "PAN") +let v_PSTATE_SP = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "SP") +let v_PSTATE_SSBS = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "SSBS") +let v_PSTATE_TCO = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "TCO") +let v_PSTATE_UAO = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "UAO") +let v_PSTATE_BTYPE = Expr_Field(Expr_Var(Ident "PSTATE"), Ident "BTYPE") +let v_BTypeCompatible = Expr_Var (Ident "BTypeCompatible") +let v___BranchTaken = Expr_Var (Ident "__BranchTaken") +let v_BTypeNext = Expr_Var (Ident "BTypeNext") let v___ExclusiveLocal = Expr_Var (Ident "__ExclusiveLocal") (**************************************************************** diff --git a/tests/aslt/test_antlr.t b/tests/aslt/test_antlr.t index 5bc56feb..8b718a4d 100644 --- a/tests/aslt/test_antlr.t +++ b/tests/aslt/test_antlr.t @@ -48,42 +48,42 @@ tests building and running of the antlr grammar. requires java (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr (bits '0000000000000000000000000000000000000000000000000000000000000000')) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse15__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse15__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse14__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse14__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 64))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse14__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr (integer 64)) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse13__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse13__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse12__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse12__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 48))) ; (targs (expr (integer 16))) ] , [ (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 16)) , (expr (integer 48)) )) ] )) ; (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 8))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse12__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse11__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse11__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse10__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse10__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 40))) ; (targs (expr (integer 24))) ] , [ (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 24)) , (expr (integer 40)) )) ] )) ; (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 16))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse10__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 16)) )) ] )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse9__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse9__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse8__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse8__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 32))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 32)) , (expr (integer 32)) )) ] )) ; (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 24))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse8__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 24)) )) ] )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse7__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse7__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse6__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse6__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 24))) ; (targs (expr (integer 40))) ] , [ (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 40)) , (expr (integer 24)) )) ] )) ; (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse6__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 32)) )) ] )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse5__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse5__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse4__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse4__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 48))) ] , [ (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 48)) , (expr (integer 16)) )) ] )) ; (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 40))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse4__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 40)) )) ] )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse3__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse3__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse2__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse2__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 56))) ] , [ (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 56)) , (expr (integer 8)) )) ] )) ; (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 48))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse2__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 48)) )) ] )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (conditional_stmt Stmt_If ( (expr Expr_TApply ( (ident " slt_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse1__5 ") )) ; (expr (bits '0000000000010000')) ] )) , (stmts [ - (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr (bits '0000000000000000')) ; (expr Expr_Var ( (ident " Cse1__5 ") )) ] )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse0__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; + (stmt (assignment_stmt Stmt_Assert ( (expr Expr_TApply ( (ident " and_bool.0 ") , [ ] , [ (expr Expr_Var ( (ident " TRUE ") )) ; (expr Expr_TApply ( (ident " sle_bits.0 ") , [ (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_TApply ( (ident " add_bits.0 ") , [ (targs (expr (integer 16))) ] , [ (expr Expr_Var ( (ident " Cse0__5 ") )) ; (expr (bits '0000000000001000')) ] )) ; (expr (integer 32)) ] )) ; (expr (bits '00000000000000000000000010000000')) ] )) ] )) ))) ; (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Var ( (ident " result__4 ") )) , (expr Expr_TApply ( (ident " append_bits.0 ") , [ (targs (expr (integer 8))) ; (targs (expr (integer 56))) ] , [ (expr Expr_Slices ( (expr Expr_TApply ( (ident " lsr_bits.0 ") , [ (targs (expr (integer 128))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Array ( (expr Expr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) ; (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 16))) ; (targs (expr (integer 32))) ] , [ (expr Expr_Var ( (ident " Cse0__5 ") )) ; (expr (integer 32)) ] )) ] )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 8)) )) ] )) ; (expr Expr_Slices ( (expr Expr_Var ( (ident " result__4 ") )) , [ (slice Slice_LoWd ( (expr (integer 0)) , (expr (integer 56)) )) ] )) ] )) ))) ]) , [ ] , (stmts [ ]) ))) (stmt (assignment_stmt Stmt_Assign ( (lexpr LExpr_Array ( (lexpr LExpr_Var ( (ident " _Z ") )) , (expr (integer 0)) )) , (expr Expr_TApply ( (ident " ZeroExtend.0 ") , [ (targs (expr (integer 64))) ; (targs (expr (integer 128))) ] , [ (expr Expr_Var ( (ident " result__4 ") )) ; (expr (integer 128)) ] )) ))) diff --git a/tests/aslt/test_cntlm.t b/tests/aslt/test_cntlm.t index c5df31bc..35d09f25 100644 --- a/tests/aslt/test_cntlm.t +++ b/tests/aslt/test_cntlm.t @@ -43392,67 +43392,67 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(256),"Cse29__5",Expr_TApply("append_bits.0",[128;128],[Expr_Array(Expr_Var("_Z"),3);Expr_Array(Expr_Var("_Z"),2)])) Stmt_Assign(LExpr_Var("result__4"),'00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000') Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse32__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse32__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse31__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse31__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("ZeroExtend.0",[8;128],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse31__5");32])]),[Slice_LoWd(0,8)]);128])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse30__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse30__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse28__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse28__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[112;16],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(16,112)]);Expr_TApply("append_bits.0",[8;8],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse28__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,8)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse27__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse27__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse26__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse26__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[104;24],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(24,104)]);Expr_TApply("append_bits.0",[8;16],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse26__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,16)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse25__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse25__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse24__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse24__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[96;32],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(32,96)]);Expr_TApply("append_bits.0",[8;24],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse24__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,24)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse23__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse23__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse22__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse22__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[88;40],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(40,88)]);Expr_TApply("append_bits.0",[8;32],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse22__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,32)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse21__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse21__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse20__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse20__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[80;48],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(48,80)]);Expr_TApply("append_bits.0",[8;40],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse20__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,40)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse19__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse19__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse18__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse18__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[72;56],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(56,72)]);Expr_TApply("append_bits.0",[8;48],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse18__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,48)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse17__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse17__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse16__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse16__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[64;64],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(64,64)]);Expr_TApply("append_bits.0",[8;56],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse16__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,56)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse15__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse15__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse14__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse14__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[56;72],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(72,56)]);Expr_TApply("append_bits.0",[8;64],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse14__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,64)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse13__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse13__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse12__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse12__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[48;80],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(80,48)]);Expr_TApply("append_bits.0",[8;72],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse12__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,72)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse11__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse11__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse10__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse10__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[40;88],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(88,40)]);Expr_TApply("append_bits.0",[8;80],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse10__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,80)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse9__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse9__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse8__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse8__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[32;96],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(96,32)]);Expr_TApply("append_bits.0",[8;88],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse8__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,88)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse7__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse7__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse6__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse6__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[24;104],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(104,24)]);Expr_TApply("append_bits.0",[8;96],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse6__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,96)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse5__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse5__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse4__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse4__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[16;112],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(112,16)]);Expr_TApply("append_bits.0",[8;104],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse4__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,104)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse3__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse3__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse2__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse2__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[8;120],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(120,8)]);Expr_TApply("append_bits.0",[8;112],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse2__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,112)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse1__5");'0000000000100000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse1__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse0__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse0__5");'0000000000001000']);32]);'00000000000000000000000100000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[8;120],[Expr_Slices(Expr_TApply("lsr_bits.0",[256;32],[Expr_Var("Cse29__5");Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse0__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,120)])])) ],[],[]) Stmt_Assign(LExpr_Array(LExpr_Var("_Z"),2),Expr_Var("result__4")) @@ -80437,133 +80437,133 @@ strip opcode information before passing to antlr. "0x7100001f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100003f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),1),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),1),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100005f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100007f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),3),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),3),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100009f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),4),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),4),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710000bf" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),5),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),5),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710000df" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),6),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),6),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710000ff" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),7),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),7),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100013f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),9),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),9),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710001bf" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),13),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),13),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710001df" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),14),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),14),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710001ff" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),15),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),15),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100027f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),19),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),19),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100029f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),20),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),20),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710002bf" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),21),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),21),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710002df" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),22),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),22),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x710002ff" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),23),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),23),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100031f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),24),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),24),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100033f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),25),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),25),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100035f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),26),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),26),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100037f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),27),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),27),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x7100039f" Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),28),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),28),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) "0x71000400" @@ -85502,7 +85502,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85515,7 +85515,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),1),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),1),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85528,7 +85528,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85541,7 +85541,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),4),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),4),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85554,7 +85554,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),20),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),20),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85567,7 +85567,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),21),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),21),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85580,7 +85580,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),23),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),23),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85607,7 +85607,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85620,7 +85620,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85633,7 +85633,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),1),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),1),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85646,7 +85646,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85659,7 +85659,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),2),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85672,7 +85672,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),3),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),3),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85685,7 +85685,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),4),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),4),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85698,7 +85698,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),19),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),19),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85711,7 +85711,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),20),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),20),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85724,7 +85724,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),22),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),22),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85737,7 +85737,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),23),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),23),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85806,7 +85806,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),21),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("and_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"C");'1']);Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'0'])])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),21),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85847,7 +85847,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),27),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"N");Expr_Field(Expr_Var("PSTATE"),"V")]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),27),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -85860,7 +85860,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(32),"Cse0__5",Expr_TApply("add_bits.0",[32],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);'00000000000000000000000000000000'])) Stmt_If(Expr_TApply("and_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"N");Expr_Field(Expr_Var("PSTATE"),"V")]);Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'0'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");Expr_Var("Cse0__5")])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Var("Cse0__5");64]);Expr_TApply("add_bits.0",[64],[Expr_TApply("ZeroExtend.0",[32;64],[Expr_Slices(Expr_Array(Expr_Var("_R"),0),[Slice_LoWd(0,32)]);64]);'0000000000000000000000000000000100000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[32],[Expr_Var("Cse0__5");'00000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(31,1)])) ],[],[ @@ -150465,91 +150465,91 @@ strip opcode information before passing to antlr. "0xf100001f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),0);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),0);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),0);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100003f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),1);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),1);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),1);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100005f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),2);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),2);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),2);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100007f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),3);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100009f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),4);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),4);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),4);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf10000df" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),6);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),6);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),6);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100011f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),8);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),8);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),8);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100027f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),19);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),19);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),19);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100029f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),20);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),20);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),20);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf10002bf" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),21);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),21);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),21);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf10002df" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),22);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),22);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),22);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf10002ff" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),23);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),23);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),23);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100031f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),24);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),24);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),24);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100033f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),25);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),25);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),25);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100037f" Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),27);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),27);'0000000000000000000000000000000000000000000000000000000000000000'])])])])) - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),27);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])) + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])) Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) "0xf100041f" @@ -157011,7 +157011,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),1);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),1);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),1);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157024,7 +157024,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),2);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),2);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),2);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157037,7 +157037,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),3);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157050,7 +157050,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),19);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),19);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),19);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157063,7 +157063,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),20);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),20);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),20);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157076,7 +157076,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),21);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),21);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),21);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157089,7 +157089,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),24);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1']),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),24);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),24);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157116,7 +157116,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),0);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),0);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),0);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157129,7 +157129,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),1);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),1);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),1);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157142,7 +157142,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),2);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),2);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),2);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157155,7 +157155,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),3);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157168,7 +157168,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),20);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),20);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),20);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157181,7 +157181,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),21);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),21);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),21);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157194,7 +157194,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),22);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),22);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),22);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157207,7 +157207,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),23);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),23);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),23);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157220,7 +157220,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),25);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("not_bool.0",[],[Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"Z");'1'])]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),25);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),25);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157261,7 +157261,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),0);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"N");Expr_Field(Expr_Var("PSTATE"),"V")]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),0);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),0);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ @@ -157274,7 +157274,7 @@ strip opcode information before passing to antlr. Stmt_ConstDecl(Type_Bits(64),"Cse0__5",Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])) Stmt_If(Expr_TApply("eq_bits.0",[1],[Expr_Field(Expr_Var("PSTATE"),"N");Expr_Field(Expr_Var("PSTATE"),"V")]),[ Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"V"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");Expr_TApply("add_bits.0",[64],[Expr_Array(Expr_Var("_R"),3);'0000000000000000000000000000000000000000000000000000000000000000'])])])])); - Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("Cse0__5");128]);Expr_TApply("add_bits.0",[128],[Expr_TApply("ZeroExtend.0",[64;128],[Expr_Array(Expr_Var("_R"),3);128]);'00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000'])])])])); + Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"C"),Expr_TApply("not_bits.0",[1],[Expr_TApply("cvt_bool_bv.0",[],[Expr_Var("FALSE")])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"Z"),Expr_TApply("cvt_bool_bv.0",[],[Expr_TApply("eq_bits.0",[64],[Expr_Var("Cse0__5");'0000000000000000000000000000000000000000000000000000000000000000'])])); Stmt_Assign(LExpr_Field(LExpr_Var("PSTATE"),"N"),Expr_Slices(Expr_Var("Cse0__5"),[Slice_LoWd(63,1)])) ],[],[ diff --git a/tests/aslt/test_dis.t b/tests/aslt/test_dis.t index aef4d245..aa1812cb 100644 --- a/tests/aslt/test_dis.t +++ b/tests/aslt/test_dis.t @@ -92,35 +92,35 @@ run asli with these commands bits ( 64 ) result__4 ; result__4 = '0000000000000000000000000000000000000000000000000000000000000000' ; if slt_bits.0 {{ 16 }} ( Cse15__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse15__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse14__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse14__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = ZeroExtend.0 {{ 8,64 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse14__5,32 ) ) [ 0 +: 8 ],64 ) ; } if slt_bits.0 {{ 16 }} ( Cse13__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse13__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse12__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse12__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 48,16 }} ( result__4 [ 16 +: 48 ],append_bits.0 {{ 8,8 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse12__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 8 ] ) ) ; } if slt_bits.0 {{ 16 }} ( Cse11__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse11__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse10__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse10__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 40,24 }} ( result__4 [ 24 +: 40 ],append_bits.0 {{ 8,16 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse10__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 16 ] ) ) ; } if slt_bits.0 {{ 16 }} ( Cse9__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse9__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse8__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse8__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 32,32 }} ( result__4 [ 32 +: 32 ],append_bits.0 {{ 8,24 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse8__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 24 ] ) ) ; } if slt_bits.0 {{ 16 }} ( Cse7__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse7__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse6__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse6__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 24,40 }} ( result__4 [ 40 +: 24 ],append_bits.0 {{ 8,32 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse6__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 32 ] ) ) ; } if slt_bits.0 {{ 16 }} ( Cse5__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse5__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse4__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse4__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 16,48 }} ( result__4 [ 48 +: 16 ],append_bits.0 {{ 8,40 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse4__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 40 ] ) ) ; } if slt_bits.0 {{ 16 }} ( Cse3__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse3__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse2__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse2__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 8,56 }} ( result__4 [ 56 +: 8 ],append_bits.0 {{ 8,48 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse2__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 48 ] ) ) ; } if slt_bits.0 {{ 16 }} ( Cse1__5,'0000000000010000' ) then { - assert and_bool.0 {{ }} ( sle_bits.0 {{ 16 }} ( '0000000000000000',Cse1__5 ),sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse0__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; + assert and_bool.0 {{ }} ( TRUE,sle_bits.0 {{ 32 }} ( ZeroExtend.0 {{ 16,32 }} ( add_bits.0 {{ 16 }} ( Cse0__5,'0000000000001000' ),32 ),'00000000000000000000000010000000' ) ) ; result__4 = append_bits.0 {{ 8,56 }} ( lsr_bits.0 {{ 128,32 }} ( __array _Z [ 0 ],ZeroExtend.0 {{ 16,32 }} ( Cse0__5,32 ) ) [ 0 +: 8 ],result__4 [ 0 +: 56 ] ) ; } __array _Z [ 0 ] = ZeroExtend.0 {{ 64,128 }} ( result__4,128 ) ; @@ -144,35 +144,35 @@ run asli with these commands Stmt_VarDeclsNoInit(Type_Bits(64),["result__4"]) Stmt_Assign(LExpr_Var("result__4"),'0000000000000000000000000000000000000000000000000000000000000000') Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse15__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse15__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse14__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse14__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("ZeroExtend.0",[8;64],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse14__5");32])]),[Slice_LoWd(0,8)]);64])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse13__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse13__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse12__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse12__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[48;16],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(16,48)]);Expr_TApply("append_bits.0",[8;8],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse12__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,8)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse11__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse11__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse10__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse10__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[40;24],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(24,40)]);Expr_TApply("append_bits.0",[8;16],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse10__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,16)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse9__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse9__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse8__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse8__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[32;32],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(32,32)]);Expr_TApply("append_bits.0",[8;24],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse8__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,24)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse7__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse7__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse6__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse6__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[24;40],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(40,24)]);Expr_TApply("append_bits.0",[8;32],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse6__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,32)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse5__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse5__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse4__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse4__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[16;48],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(48,16)]);Expr_TApply("append_bits.0",[8;40],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse4__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,40)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse3__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse3__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse2__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse2__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[8;56],[Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(56,8)]);Expr_TApply("append_bits.0",[8;48],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse2__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,48)])])])) ],[],[]) Stmt_If(Expr_TApply("slt_bits.0",[16],[Expr_Var("Cse1__5");'0000000000010000']),[ - Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_TApply("sle_bits.0",[16],['0000000000000000';Expr_Var("Cse1__5")]);Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse0__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); + Stmt_Assert(Expr_TApply("and_bool.0",[],[Expr_Var("TRUE");Expr_TApply("sle_bits.0",[32],[Expr_TApply("ZeroExtend.0",[16;32],[Expr_TApply("add_bits.0",[16],[Expr_Var("Cse0__5");'0000000000001000']);32]);'00000000000000000000000010000000'])])); Stmt_Assign(LExpr_Var("result__4"),Expr_TApply("append_bits.0",[8;56],[Expr_Slices(Expr_TApply("lsr_bits.0",[128;32],[Expr_Array(Expr_Var("_Z"),0);Expr_TApply("ZeroExtend.0",[16;32],[Expr_Var("Cse0__5");32])]),[Slice_LoWd(0,8)]);Expr_Slices(Expr_Var("result__4"),[Slice_LoWd(0,56)])])) ],[],[]) Stmt_Assign(LExpr_Array(LExpr_Var("_Z"),0),Expr_TApply("ZeroExtend.0",[64;128],[Expr_Var("result__4");128])) diff --git a/tests/bdd_ops.ml b/tests/bdd_ops.ml new file mode 100644 index 00000000..f59d5ffa --- /dev/null +++ b/tests/bdd_ops.ml @@ -0,0 +1,73 @@ +open LibASL +open Asl_utils +open AST +open LibASL.Primops +open LibASL.Utils + +module TC = Tcheck +module AST = Asl_ast + +let man = MLBDD.init ~cache:1024 () + + +let from_bitsLit x = + let x' = Value.drop_chars x ' ' in + (Primops.mkBits (String.length x') (Z.of_string_base 2 x')) + +let it i = assert (MLBDD.is_true i || MLBDD.is_false i ) ; MLBDD.is_true i + +let bdd_to_bv (b:MLBDD.t list) = let l = List.map (fun i -> + assert (MLBDD.is_true i || MLBDD.is_false i ) ; MLBDD.is_true i) b + in let l = List.map (function + | true -> '1' + | false -> '0') l |> List.to_seq |> String.of_seq in + from_bitsLit l + +let prim_cvt_bits_str (x: bitvector): string = + let n = Z.of_int x.n in + if Z.equal n Z.zero then begin + "''" + end else begin + let s = Z.format "%0b" x.v in + let pad = String.make (Z.to_int n - String.length s) '0' in + pad ^ s + end + + +let bv_to_bdd (bv:bitvector) = + let l = prim_cvt_bits_str bv in + let l = String.to_seq l |> List.of_seq in + List.map (function + | '1' -> MLBDD.dtrue man + | '0' -> MLBDD.dfalse man + | x -> failwith (Printf.sprintf "no %c" x) ) l + +let ppbit = prim_cvt_bits_str + + + +let test_add = + let width = 8 in + let cases = List.init 256 (fun i -> (i - 128)) in + let cases_bits = List.map (fun i -> mkBits width (Z.of_int i)) cases in + let cases_bdd = List.map bv_to_bdd cases_bits in + let compar = List.concat_map (fun i -> List.map (fun j -> i , j) cases_bits) cases_bits in + let to_check = List.concat_map (fun i -> List.map (fun j -> i , j) cases_bdd) cases_bdd in + let res_add = List.map2 (fun (i,j) (i', j') -> (i, j), prim_add_bits i j, bdd_to_bv (LibASL.Transforms.BDDSimp.signed_add_wrap i' j')) compar to_check in + List.iter (fun ((i,j),c,r) -> Alcotest.(check string) (Printf.sprintf "%s + %s = %s" (ppbit i) (ppbit j) (ppbit c)) (prim_cvt_bits_str c) (prim_cvt_bits_str r)) res_add ; + + let res_sub = List.map2 (fun (i,j) (i', j') -> (i, j), prim_sub_bits i j, bdd_to_bv (LibASL.Transforms.BDDSimp.signed_sub_wrap man i' j')) compar to_check in + List.iter (fun ((i,j),c,r) -> Alcotest.(check string) (Printf.sprintf "%s - %s = %s" (ppbit i) (ppbit j) (ppbit c)) (prim_cvt_bits_str c) (prim_cvt_bits_str r)) res_sub ; + + let compare_binop format f1 f2 = + let res = List.map2 (fun (i,j) (i', j') -> (i, j), f1 i j, (f2 i' j')) compar to_check in + List.iter (fun ((i,j),c,r) -> Alcotest.(check bool) (Printf.sprintf format (ppbit i) (ppbit j) (c)) (c) r) res in + compare_binop "%s > %s = %b" (fun x y -> prim_gt_int (Primops.prim_cvt_bits_uint x) (Primops.prim_cvt_bits_uint y)) (fun x y -> it (LibASL.Transforms.BDDSimp.bvugt man x y)) ; + compare_binop "%s < %s = %b" (fun x y -> prim_lt_int (Primops.prim_cvt_bits_sint x) (Primops.prim_cvt_bits_sint y)) (fun x y -> it (LibASL.Transforms.BDDSimp.bvslt man x y)) ; + compare_binop "%s <= %s = %b" (fun x y -> prim_le_int (Primops.prim_cvt_bits_sint x) (Primops.prim_cvt_bits_sint y)) (fun x y -> it (LibASL.Transforms.BDDSimp.bvsle man x y)) ; + + + + + + diff --git a/tests/dune b/tests/dune index 0c1c3027..9ebb56a6 100644 --- a/tests/dune +++ b/tests/dune @@ -1,4 +1,12 @@ (test (name test_asl) (modes exe) (flags (-cclib -lstdc++)) + (modules test_asl) + (libraries alcotest asli.libASL)) + + +(test (name bdd_ops) + (modes exe) + (flags (-cclib -lstdc++)) +(modules bdd_ops) (libraries alcotest asli.libASL))