diff options
author | Magnus Lång <[email protected]> | 2016-03-12 12:24:46 +0100 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-07-11 17:38:18 +0200 |
commit | ebc557f315c99c8e1e0563ae6111c06c7cb271dc (patch) | |
tree | 0d68cda0d9086275aea6145c1c2109fdb1eb0d7e /lib/hipe/x86/hipe_x86_frame.erl | |
parent | fe4f60994fc0a1329629d8c56a784ccd2f414f57 (diff) | |
download | otp-ebc557f315c99c8e1e0563ae6111c06c7cb271dc.tar.gz otp-ebc557f315c99c8e1e0563ae6111c06c7cb271dc.tar.bz2 otp-ebc557f315c99c8e1e0563ae6111c06c7cb271dc.zip |
hipe_x86_frame: speed up find_temps
Diffstat (limited to 'lib/hipe/x86/hipe_x86_frame.erl')
-rw-r--r-- | lib/hipe/x86/hipe_x86_frame.erl | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/hipe/x86/hipe_x86_frame.erl b/lib/hipe/x86/hipe_x86_frame.erl index 8851ead250..4cdc04007d 100644 --- a/lib/hipe/x86/hipe_x86_frame.erl +++ b/lib/hipe/x86/hipe_x86_frame.erl @@ -622,26 +622,31 @@ find_temps([I|Insns], S0) -> find_temps([], S) -> S. +-compile({inline, [tset_empty/0, tset_size/1, tset_insert/2, + tset_filter/2, tset_to_list/1]}). + tset_empty() -> - gb_sets:new(). + #{}. tset_size(S) -> - gb_sets:size(S). + map_size(S). tset_insert(S, T) -> - gb_sets:add_element(T, S). + S#{T => []}. -tset_add_list(S, Ts) -> - gb_sets:union(S, gb_sets:from_list(Ts)). +tset_add_list(S, []) -> S; +tset_add_list(S, [T|Ts]) -> + tset_add_list(S#{T => []}, Ts). -tset_del_list(S, Ts) -> - gb_sets:subtract(S, gb_sets:from_list(Ts)). +tset_del_list(S, []) -> S; +tset_del_list(S, [T|Ts]) -> + tset_del_list(maps:remove(T,S), Ts). tset_filter(S, F) -> - gb_sets:filter(F, S). + maps:filter(fun(K, _V) -> F(K) end, S). tset_to_list(S) -> - gb_sets:to_list(S). + maps:keys(S). %%% %%% Compute minimum permissible frame size, ignoring spilled temps. |