Commit c010a9fb authored by Julian Kranz's avatar Julian Kranz

Liveness

parent dddab600
......@@ -9,10 +9,10 @@ val test-instructions-0 = do
t1 <- mktemp;
t2 <- mktemp;
mov 1 t0 (imm 3);
#mov 1 t0 (imm 3);
# mov 1 t1 (imm 4);
mov 8 t2 (imm 5);
mov 8 (at-offset t2 20) (imm 5);
#mov 8 t2 (imm 5);
#mov 8 (at-offset t2 20) (imm 5);
#_while (/d (var (at-offset t0 99))) __ do
# mov 1 (at-offset t0 33) (var (at-offset t1 33));
......@@ -21,18 +21,20 @@ val test-instructions-0 = do
# mov 32 t2 (imm 888)
#end;
mov 32 t2 (imm 888);
_if (/d (var t0)) _then do
mov 1 (at-offset t0 33) (var (at-offset t1 88));
mov 32 t2 (imm 888)
end _else do
mov 1 (at-offset t0 33) (var (at-offset t1 107));
mov 32 t1 (imm 888)
end;
#mov 32 t2 (imm 888);
#_if (/d (var t0)) _then do
# mov 1 (at-offset t0 33) (var (at-offset t1 88));
# mov 32 t2 (imm 888)
#end _else do
# mov 1 (at-offset t0 33) (var (at-offset t1 107));
# mov 32 t1 (imm 888)
#end;
cbranch (var t0) (address 99 (var t1)) (address 88 (var t2))
add 32 t0 (var t1) (var t2);
#add 32 t0 (var t1) (var t2);
mov 1 t0 (imm 42)
#mov 1 t0 (imm 42)
end
val tinsng = do
......
......@@ -82,8 +82,10 @@ val lv-gen gens stmt =
val visit-flow gens x =
lv-union
(visit-lin gens 1 x.cond)
(visit-lin gens x.size x.target)
(visit-lin gens 1 x.cond)
(lv-union
(visit-address gens x.target-true)
(visit-address gens x.target-false))
val visit-stmt gens stmt =
case stmt of
......@@ -92,6 +94,8 @@ val lv-gen gens stmt =
| SEM_STORE x: visit-address gens x.address
| SEM_WHILE x: visit-lin gens 1 x.cond
| SEM_ITE x: visit-lin gens 1 x.cond
| SEM_BRANCH x: visit-address gens x.target
| SEM_CBRANCH x: visit-flow gens x
# | SEM_LABEL x: gens
# | SEM_IF_GOTO_LABEL x: visit-lin gens 1 x.cond
# | SEM_IF_GOTO x: visit-flow gens x
......@@ -248,6 +252,14 @@ val lv-analyze stack =
state-new <- return (lvstate-union state (lvstate-union then-state else-state));
sweep x.tl (lvstate-eval state-new x.hd)
end
| SEM_CBRANCH y: do
lv-push-live x.hd;
sweep x.tl (lvstate-eval state x.hd)
end
| SEM_BRANCH y: do
lv-push-live x.hd;
sweep x.tl (lvstate-eval state x.hd)
end
# | SEM_IF_GOTO y:
# do lv-push-live x.hd;
# sweep x.tl (lvstate-eval state x.hd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment