diff options
| author | Alasdair | 2019-03-18 21:40:34 +0000 |
|---|---|---|
| committer | Alasdair | 2019-04-01 13:48:18 +0100 |
| commit | bee510755ecd32c600a27b9741c18cce1bd2ea4d (patch) | |
| tree | 59318bbbdc6f96adf2c62b7396d8b7d52994f1f0 /src/jib/c_backend.ml | |
| parent | 989c7f8ab0bf908d0cd26b58c542d264c63b72fe (diff) | |
C: Add identifier to end instruction
Allows us to track the last version of the return variable when the AST
in in SSA form.
Diffstat (limited to 'src/jib/c_backend.ml')
| -rw-r--r-- | src/jib/c_backend.ml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/jib/c_backend.ml b/src/jib/c_backend.ml index a784b08e..0e73fed8 100644 --- a/src/jib/c_backend.ml +++ b/src/jib/c_backend.ml @@ -624,7 +624,7 @@ let fix_early_heap_return ret ret_ctyp instrs = let end_function_label = label "end_function_" in let is_return_recur (I_aux (instr, _)) = match instr with - | I_if _ | I_block _ | I_end | I_funcall _ | I_copy _ | I_undefined _ -> true + | I_if _ | I_block _ | I_end _ | I_funcall _ | I_copy _ | I_undefined _ -> true | _ -> false in let rec rewrite_return instrs = @@ -646,7 +646,7 @@ let fix_early_heap_return ret ret_ctyp instrs = before @ [I_aux (I_copy (CL_addr (CL_id (ret, CT_ref ctyp)), cval), aux)] @ rewrite_return after - | before, I_aux ((I_end | I_undefined _), _) :: after -> + | before, I_aux ((I_end _ | I_undefined _), _) :: after -> before @ [igoto end_function_label] @ rewrite_return after @@ -661,7 +661,7 @@ let fix_early_heap_return ret ret_ctyp instrs = let fix_early_stack_return ret ret_ctyp instrs = let is_return_recur (I_aux (instr, _)) = match instr with - | I_if _ | I_block _ | I_end | I_funcall _ | I_copy _ -> true + | I_if _ | I_block _ | I_end _ | I_funcall _ | I_copy _ -> true | _ -> false in let rec rewrite_return instrs = @@ -683,7 +683,7 @@ let fix_early_stack_return ret ret_ctyp instrs = before @ [I_aux (I_copy (CL_id (ret, ctyp), cval), aux)] @ rewrite_return after - | before, I_aux (I_end, _) :: after -> + | before, I_aux (I_end _, _) :: after -> before @ [ireturn (F_id ret, ret_ctyp)] @ rewrite_return after @@ -1468,7 +1468,7 @@ let rec codegen_instr fid ctx (I_aux (instr, (_, l))) = | I_raw str -> string (" " ^ str) - | I_end -> assert false + | I_end _ -> assert false | I_match_failure -> string (" sail_match_failure(\"" ^ String.escaped (string_of_id fid) ^ "\");") |
