diff options
author | Sverker Eriksson <[email protected]> | 2016-08-12 17:41:38 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-08-12 17:41:38 +0200 |
commit | 650d0d075dfddf1bc3ebfa2cb9357d8311fd9645 (patch) | |
tree | d8b19d650a56706b25ac4c8589490e5d500d250a /lib/hipe/flow/liveness.inc | |
parent | 74357d43f887c93bc2f567d044cf2027585ecf46 (diff) | |
parent | fd97ddb2c3031140f12c98c93a31325b15ea8cb6 (diff) | |
download | otp-650d0d075dfddf1bc3ebfa2cb9357d8311fd9645.tar.gz otp-650d0d075dfddf1bc3ebfa2cb9357d8311fd9645.tar.bz2 otp-650d0d075dfddf1bc3ebfa2cb9357d8311fd9645.zip |
Merge branch 'sverker/hipe-performance-algorithms/PR-1124/OTP-13810'
Diffstat (limited to 'lib/hipe/flow/liveness.inc')
-rw-r--r-- | lib/hipe/flow/liveness.inc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/hipe/flow/liveness.inc b/lib/hipe/flow/liveness.inc index a1caa3e0ad..bffaa4e3df 100644 --- a/lib/hipe/flow/liveness.inc +++ b/lib/hipe/flow/liveness.inc @@ -49,6 +49,10 @@ -endif. -include("../flow/cfg.hrl"). +-include("../main/hipe.hrl"). + +-opaque liveness() :: map(). +-export_type([liveness/0]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% @@ -72,7 +76,7 @@ %% The generic liveness analysis %% --spec analyze(cfg()) -> gb_trees:tree(). +-spec analyze(cfg()) -> liveness(). -ifdef(HIPE_LIVENESS_CALC_LARGEST_LIVESET). analyze(CFG) -> @@ -188,6 +192,7 @@ update_livein(Label, NewLiveIn, Liveness) -> %% %% LiveOut for a block is the union of the successors LiveIn %% +-spec liveout(liveness(), _) -> [_]. liveout(Liveness, L) -> Succ = successors(L, Liveness), @@ -210,7 +215,7 @@ successors(L, Liveness) -> {_GK, _LiveIn, Successors} = liveness_lookup(L, Liveness), Successors. --spec livein(gb_trees:tree(), _) -> [_]. +-spec livein(liveness(), _) -> [_]. livein(Liveness, L) -> {_GK, LiveIn, _Successors} = liveness_lookup(L, Liveness), @@ -292,18 +297,15 @@ strip([{_,Y}|Xs]) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% +-compile({inline, [liveness_lookup/2, liveness_update/3]}). + liveness_init(List) -> - liveness_init(List, gb_trees:empty()). + maps:from_list(List). -liveness_init([{Lbl, Data}|Left], Acc) -> - liveness_init(Left, gb_trees:insert(Lbl, Data, Acc)); -liveness_init([], Acc) -> - Acc. - liveness_lookup(Label, Liveness) -> - gb_trees:get(Label, Liveness). + maps:get(Label, Liveness). liveness_update(Label, Val, Liveness) -> - gb_trees:update(Label, Val, Liveness). + maps:update(Label, Val, Liveness). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |