summaryrefslogtreecommitdiff
path: root/asmcomp/deadcode.ml
diff options
context:
space:
mode:
authorMark Shinwell <mshinwell@gmail.com>2016-07-07 10:15:36 +0100
committerGitHub <noreply@github.com>2016-07-07 10:15:36 +0100
commit5af8dc6ad6afd7d5a9c2b4aee2e46a1d2d9b3f7f (patch)
tree7a18cf5a50d717fe39ef952bbdf09589fe8415d9 /asmcomp/deadcode.ml
parent9d77b268edfb6ea614f3e497013255036aee2ba7 (diff)
downloadocaml-5af8dc6ad6afd7d5a9c2b4aee2e46a1d2d9b3f7f.tar.gz
Liveness and Deadcode refactoring (#670)
Diffstat (limited to 'asmcomp/deadcode.ml')
-rw-r--r--asmcomp/deadcode.ml11
1 files changed, 6 insertions, 5 deletions
diff --git a/asmcomp/deadcode.ml b/asmcomp/deadcode.ml
index abff69e01a..f6091c2771 100644
--- a/asmcomp/deadcode.ml
+++ b/asmcomp/deadcode.ml
@@ -22,32 +22,33 @@ open Mach
and a set of registers live "before" instruction [i]. *)
let rec deadcode i =
+ let arg = i.arg in
match i.desc with
| Iend | Ireturn | Iop(Itailcall_ind _) | Iop(Itailcall_imm _) | Iraise _ ->
- (i, Reg.add_set_array i.live i.arg)
+ (i, Reg.add_set_array i.live arg)
| Iop op ->
let (s, before) = deadcode i.next in
if Proc.op_is_pure op (* no side effects *)
&& Reg.disjoint_set_array before i.res (* results are not used after *)
- && not (Proc.regs_are_volatile i.arg) (* no stack-like hard reg *)
+ && not (Proc.regs_are_volatile arg) (* no stack-like hard reg *)
&& not (Proc.regs_are_volatile i.res) (* is involved *)
then begin
assert (Array.length i.res > 0); (* sanity check *)
(s, before)
end else begin
- ({i with next = s}, Reg.add_set_array i.live i.arg)
+ ({i with next = s}, Reg.add_set_array i.live arg)
end
| Iifthenelse(test, ifso, ifnot) ->
let (ifso', _) = deadcode ifso in
let (ifnot', _) = deadcode ifnot in
let (s, _) = deadcode i.next in
({i with desc = Iifthenelse(test, ifso', ifnot'); next = s},
- Reg.add_set_array i.live i.arg)
+ Reg.add_set_array i.live arg)
| Iswitch(index, cases) ->
let cases' = Array.map (fun c -> fst (deadcode c)) cases in
let (s, _) = deadcode i.next in
({i with desc = Iswitch(index, cases'); next = s},
- Reg.add_set_array i.live i.arg)
+ Reg.add_set_array i.live arg)
| Iloop(body) ->
let (body', _) = deadcode body in
let (s, _) = deadcode i.next in