aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/opt
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-09-02 14:51:25 +0200
committerSverker Eriksson <[email protected]>2016-09-02 14:51:25 +0200
commitc2f8b61ca3682281752fa0984699214dfcbf7ccd (patch)
tree3f44fa5c58d0d0d845045c3c5535aefad333b6dd /lib/hipe/opt
parent87643cf92c061d7518299fdebb326e315c32e528 (diff)
parenta19e3f0e1e82b793d58f9ef0db907ba637793fb6 (diff)
downloadotp-c2f8b61ca3682281752fa0984699214dfcbf7ccd.tar.gz
otp-c2f8b61ca3682281752fa0984699214dfcbf7ccd.tar.bz2
otp-c2f8b61ca3682281752fa0984699214dfcbf7ccd.zip
Merge branch 'sverker/hipe-performance-o1/PR-1154/OTP-13862'
* sverker/hipe-performance-o1/PR-1154: hipe_sparc: Minimise CFG<->linear conversions hipe_ppc: Minimise CFG<->linear conversions hipe_arm: Minimise CFG<->linear conversions hipe_x86: Use lea instead of move+add hipe_arm: Improve peephole optimiser hipe_arm: Be resilient to crappy RTL hipe_ppc: Be resilient to crappy RTL hipe_sparc: Be resilient to crappy RTL hipe: Reuse liveness info for spillmin hipe_x86: Minimise CFG<->linear conversions hipe: Fix o0 and o1 hipe: Add o0 and o1 to tests hipe_rtl_binary:get_word_integer/4: Handle imms hipe_x86: Be resilient to crappy RTL hipe_x86: LSRA for SSE2
Diffstat (limited to 'lib/hipe/opt')
-rw-r--r--lib/hipe/opt/hipe_spillmin.erl16
-rw-r--r--lib/hipe/opt/hipe_spillmin_color.erl15
-rw-r--r--lib/hipe/opt/hipe_spillmin_scan.erl12
3 files changed, 22 insertions, 21 deletions
diff --git a/lib/hipe/opt/hipe_spillmin.erl b/lib/hipe/opt/hipe_spillmin.erl
index 4eeb1d71db..6bb6980ad5 100644
--- a/lib/hipe/opt/hipe_spillmin.erl
+++ b/lib/hipe/opt/hipe_spillmin.erl
@@ -49,7 +49,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-module(hipe_spillmin).
--export([stackalloc/6, mapmerge/2]).
+-export([stackalloc/6, stackalloc/7, mapmerge/2]).
%%-define(DEBUG, 1).
-define(HIPE_INSTRUMENT_COMPILER, true).
@@ -69,16 +69,24 @@
-spec stackalloc(#cfg{}, [_], non_neg_integer(),
comp_options(), module(), hipe_temp_map()) ->
- {hipe_spill_map(), non_neg_integer()}.
+ {hipe_spill_map(), non_neg_integer()}.
stackalloc(CFG, StackSlots, SpillIndex, Options, Target, TempMap) ->
+ Liveness = Target:analyze(CFG),
+ stackalloc(CFG, Liveness, StackSlots, SpillIndex, Options, Target, TempMap).
+
+-spec stackalloc(#cfg{}, _, [_], non_neg_integer(),
+ comp_options(), module(), hipe_temp_map()) ->
+ {hipe_spill_map(), non_neg_integer()}.
+
+stackalloc(CFG, Liveness, StackSlots, SpillIndex, Options, Target, TempMap) ->
case proplists:get_bool(spillmin_color, Options) of
false ->
- ?option_time(hipe_spillmin_scan:stackalloc(CFG, StackSlots, SpillIndex,
+ ?option_time(hipe_spillmin_scan:stackalloc(CFG, Liveness, StackSlots, SpillIndex,
Options, Target, TempMap),
"Spill minimize, linear scan", Options);
true ->
- ?option_time(hipe_spillmin_color:stackalloc(CFG, StackSlots, SpillIndex,
+ ?option_time(hipe_spillmin_color:stackalloc(CFG, Liveness, StackSlots, SpillIndex,
Options, Target, TempMap),
"Spill minimize, graph coloring", Options)
end.
diff --git a/lib/hipe/opt/hipe_spillmin_color.erl b/lib/hipe/opt/hipe_spillmin_color.erl
index 7c23de44b4..9c62fdf11a 100644
--- a/lib/hipe/opt/hipe_spillmin_color.erl
+++ b/lib/hipe/opt/hipe_spillmin_color.erl
@@ -41,7 +41,7 @@
-module(hipe_spillmin_color).
--export([stackalloc/6]).
+-export([stackalloc/7]).
%%-ifndef(DO_ASSERT).
%%-define(DO_ASSERT, true).
@@ -66,13 +66,13 @@
%% where Location is {spill,M}.
%% {spill,M} denotes the Mth spilled node
--spec stackalloc(#cfg{}, [_], non_neg_integer(),
+-spec stackalloc(#cfg{}, _, [_], non_neg_integer(),
comp_options(), module(), hipe_temp_map()) ->
{hipe_spill_map(), non_neg_integer()}.
-stackalloc(CFG, _StackSlots, SpillIndex, _Options, Target, TempMap) ->
+stackalloc(CFG, Live, _StackSlots, SpillIndex, _Options, Target, TempMap) ->
?report2("building IG~n", []),
- {IG, NumNodes} = build_ig(CFG, Target, TempMap),
+ {IG, NumNodes} = build_ig(CFG, Live, Target, TempMap),
{Cols, MaxColors} =
color_heuristic(IG, 0, NumNodes, NumNodes, NumNodes, Target, 1),
SortedCols = lists:sort(Cols),
@@ -167,8 +167,8 @@ remap_temp_map0(Cols, [_Y|Ys], SpillIndex) ->
%% Returns {Interference_graph, Number_Of_Nodes}
%%
-build_ig(CFG, Target, TempMap) ->
- try build_ig0(CFG, Target, TempMap)
+build_ig(CFG, Live, Target, TempMap) ->
+ try build_ig0(CFG, Live, Target, TempMap)
catch error:Rsn -> exit({regalloc, build_ig, Rsn})
end.
@@ -185,8 +185,7 @@ setup_ets0([X|Xs], Table, N) ->
ets:insert(Table, {X, N}),
setup_ets0(Xs, Table, N+1).
-build_ig0(CFG, Target, TempMap) ->
- Live = Target:analyze(CFG),
+build_ig0(CFG, Live, Target, TempMap) ->
TempMapping = map_spilled_temporaries(TempMap),
TempMappingTable = setup_ets(TempMapping),
NumSpilled = length(TempMapping),
diff --git a/lib/hipe/opt/hipe_spillmin_scan.erl b/lib/hipe/opt/hipe_spillmin_scan.erl
index 06b68e1934..53cbc0014b 100644
--- a/lib/hipe/opt/hipe_spillmin_scan.erl
+++ b/lib/hipe/opt/hipe_spillmin_scan.erl
@@ -60,7 +60,7 @@
-module(hipe_spillmin_scan).
--export([stackalloc/6]).
+-export([stackalloc/7]).
%%-define(DEBUG, 1).
-define(HIPE_INSTRUMENT_COMPILER, true).
@@ -85,15 +85,12 @@
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec stackalloc(#cfg{}, [_], non_neg_integer(),
+-spec stackalloc(#cfg{}, _, [_], non_neg_integer(),
comp_options(), module(), hipe_temp_map()) ->
{hipe_spill_map(), non_neg_integer()}.
-stackalloc(CFG, StackSlots, SpillIndex, Options, Target, TempMap) ->
+stackalloc(CFG, Liveness, StackSlots, SpillIndex, Options, Target, TempMap) ->
?debug_msg("LinearScan: ~w\n", [erlang:statistics(runtime)]),
- %% Step 1: Calculate liveness (Call external implementation.)
- Liveness = liveness(CFG, Target),
- ?debug_msg("liveness (done)~w\n", [erlang:statistics(runtime)]),
USIntervals = calculate_intervals(CFG, Liveness, Options,
Target, TempMap),
%% ?debug_msg("intervals (done) ~w\n", [erlang:statistics(runtime)]),
@@ -538,9 +535,6 @@ extend_interval(Pos, {Beginning, End})
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-liveness(CFG, Target) ->
- Target:analyze(CFG).
-
bb(CFG, L, Target) ->
Target:bb(CFG, L).