diff options
author | Magnus Lång <[email protected]> | 2016-03-17 21:53:19 +0100 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-07-11 17:57:47 +0200 |
commit | 3f1fe056ba8673920a536093b23117f7d287cba7 (patch) | |
tree | 5ad2c0cb3d44c869ed0951d4f4ba3f564d9a2de3 /lib/hipe/ssa | |
parent | ab4062063727d713a8eca8cf09b8a0f50744bc9b (diff) | |
download | otp-3f1fe056ba8673920a536093b23117f7d287cba7.tar.gz otp-3f1fe056ba8673920a536093b23117f7d287cba7.tar.bz2 otp-3f1fe056ba8673920a536093b23117f7d287cba7.zip |
hipe_ssa_liveness: Use map as liveness ADT
Diffstat (limited to 'lib/hipe/ssa')
-rw-r--r-- | lib/hipe/ssa/hipe_ssa_liveness.inc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/hipe/ssa/hipe_ssa_liveness.inc b/lib/hipe/ssa/hipe_ssa_liveness.inc index 78488c65fc..46df8b66ad 100644 --- a/lib/hipe/ssa/hipe_ssa_liveness.inc +++ b/lib/hipe/ssa/hipe_ssa_liveness.inc @@ -40,6 +40,15 @@ ssa_liveness__livein/2]). %% ssa_liveness__livein/3], %% ssa_liveness__liveout/2]). +-type set(E) :: gb_sets:set(E). +-type liveness(Label, Var) :: + #{Label => {{Gen :: set(Var), + Kill :: set(Var), + {TotalDirGen :: set(Var), + DirGen :: gb_trees:tree(Label, set(Var))}}, + LiveIn :: set(Var), + LiveOut :: set(Var), + Successors :: [Label]}}. -endif. %% -ifdef(DEBUG_LIVENESS). %% -export([pp_liveness/1]). @@ -262,21 +271,15 @@ update_directed_gen({Pred, Var}, Map)-> %% %% liveness %% +-compile({inline, [liveness_lookup/2, liveness_update/3]}). liveness_init(List) -> - liveness_init1(List, gb_trees:empty()). + maps:from_list(List). -liveness_init1([{Label, Info}|Left], Map) -> - liveness_init1(Left, gb_trees:insert(Label, Info, Map)); -liveness_init1([], Map) -> - Map. - -liveness_lookup(Label, Map) -> - {value, Info} = gb_trees:lookup(Label, Map), - Info. - -liveness_update(Label, NewInfo, Map) -> - gb_trees:update(Label, NewInfo, Map). +liveness_lookup(Label, Liveness) -> + maps:get(Label, Liveness). +liveness_update(Label, Val, Liveness) -> + maps:update(Label, Val, Liveness). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |