aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/x86
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-03-17 21:48:55 +0100
committerMagnus Lång <[email protected]>2016-08-30 17:17:59 +0200
commitc7a0cd1b5710178878d9b240f634e9eda7e68d96 (patch)
treeb287178ec0495d089857287df7e78b1ca119422c /lib/hipe/x86
parentdc4e9384c6f2f733ab0d12727ab53238bda3fbca (diff)
downloadotp-c7a0cd1b5710178878d9b240f634e9eda7e68d96.tar.gz
otp-c7a0cd1b5710178878d9b240f634e9eda7e68d96.tar.bz2
otp-c7a0cd1b5710178878d9b240f634e9eda7e68d96.zip
hipe: Reuse liveness info for spillmin
For x86, additionally reuse liveness from float LSRA for the GP LSRA.
Diffstat (limited to 'lib/hipe/x86')
-rw-r--r--lib/hipe/x86/hipe_x86_ra.erl8
-rw-r--r--lib/hipe/x86/hipe_x86_ra_ls.erl27
2 files changed, 21 insertions, 14 deletions
diff --git a/lib/hipe/x86/hipe_x86_ra.erl b/lib/hipe/x86/hipe_x86_ra.erl
index 2e97b07e5d..3af333ab4b 100644
--- a/lib/hipe/x86/hipe_x86_ra.erl
+++ b/lib/hipe/x86/hipe_x86_ra.erl
@@ -49,7 +49,11 @@ code_size(CFG) ->
ra(CFG0, Options) ->
%% hipe_x86_cfg:pp(CFG0),
- {CFG1, Coloring_fp, SpillIndex} = ra_fp(CFG0, Options),
+ {CFG1, Coloring_fp, SpillIndex, Liveness} =
+ case ra_fp(CFG0, Options) of
+ {G, C, I} -> {G, C, I, undefined};
+ {_,_,_,_}=T -> T
+ end,
%% hipe_x86_cfg:pp(CFG1),
?start_ra_instrumentation(Options,
code_size(CFG1),
@@ -63,7 +67,7 @@ ra(CFG0, Options) ->
graph_color ->
ra(CFG1, SpillIndex, Options, hipe_graph_coloring_regalloc);
linear_scan ->
- ?HIPE_X86_RA_LS:ra(CFG1, SpillIndex, Options);
+ ?HIPE_X86_RA_LS:ra(CFG1, Liveness, SpillIndex, Options);
naive ->
?HIPE_X86_RA_NAIVE:ra(CFG1, Coloring_fp, Options);
_ ->
diff --git a/lib/hipe/x86/hipe_x86_ra_ls.erl b/lib/hipe/x86/hipe_x86_ra_ls.erl
index 29097f492c..9f019f9561 100644
--- a/lib/hipe/x86/hipe_x86_ra_ls.erl
+++ b/lib/hipe/x86/hipe_x86_ra_ls.erl
@@ -35,15 +35,15 @@
-endif.
-module(?HIPE_X86_RA_LS).
--export([ra/3,ra_fp/3,regalloc/7]).
+-export([ra/4,ra_fp/3]).
-define(HIPE_INSTRUMENT_COMPILER, true). %% Turn on instrumentation.
-include("../main/hipe.hrl").
-ra(CFG, SpillIndex, Options) ->
+ra(CFG, Liveness, SpillIndex, Options) ->
SpillLimit = ?HIPE_X86_SPECIFIC:number_of_temporaries(
CFG),
?inc_counter(bbs_counter, length(hipe_x86_cfg:labels(CFG))),
- alloc(CFG, SpillIndex, SpillLimit, Options).
+ alloc(CFG, Liveness, SpillIndex, SpillLimit, Options).
ra_fp(CFG, Options, TargetMod) ->
?inc_counter(ra_calls_counter,1),
@@ -55,8 +55,9 @@ ra_fp(CFG, Options, TargetMod) ->
?inc_counter(ra_iteration_counter,1),
%% ?HIPE_X86_PP:pp(Defun),
- {Coloring,NewSpillIndex} =
+ {Coloring,NewSpillIndex,Liveness} =
regalloc(CFG,
+ undefined,
TargetMod:allocatable('linearscan'),
[hipe_x86_cfg:start_label(CFG)],
SpillIndex, SpillLimit, Options,
@@ -66,19 +67,20 @@ ra_fp(CFG, Options, TargetMod) ->
TargetMod:check_and_rewrite(CFG, Coloring, 'linearscan'),
TempMap = hipe_temp_map:cols2tuple(Coloring, TargetMod),
{TempMap2, NewSpillIndex2} =
- hipe_spillmin:stackalloc(CFG, [], SpillIndex, Options,
+ hipe_spillmin:stackalloc(CFG, Liveness, [], SpillIndex, Options,
TargetMod, TempMap),
Coloring2 =
hipe_spillmin:mapmerge(hipe_temp_map:to_substlist(TempMap), TempMap2),
?add_spills(Options, NewSpillIndex),
- {NewCFG, Coloring2, NewSpillIndex2}.
+ {NewCFG, Coloring2, NewSpillIndex2, Liveness}.
-alloc(CFG, SpillIndex, SpillLimit, Options) ->
+alloc(CFG, Liveness0, SpillIndex, SpillLimit, Options) ->
?inc_counter(ra_iteration_counter,1),
%% ?HIPE_X86_PP:pp(Defun),
- {Coloring, NewSpillIndex} =
+ {Coloring, NewSpillIndex, Liveness} =
regalloc(
CFG,
+ Liveness0,
?HIPE_X86_REGISTERS:allocatable()--
[?HIPE_X86_REGISTERS:temp1(),
?HIPE_X86_REGISTERS:temp0()],
@@ -90,8 +92,8 @@ alloc(CFG, SpillIndex, SpillLimit, Options) ->
CFG, Coloring, 'linearscan'),
%% ?HIPE_X86_PP:pp(NewDefun),
TempMap = hipe_temp_map:cols2tuple(Coloring, ?HIPE_X86_SPECIFIC),
- {TempMap2,NewSpillIndex2} =
- hipe_spillmin:stackalloc(CFG, [], SpillIndex, Options,
+ {TempMap2,NewSpillIndex2} =
+ hipe_spillmin:stackalloc(CFG, Liveness, [], SpillIndex, Options,
?HIPE_X86_SPECIFIC, TempMap),
Coloring2 =
hipe_spillmin:mapmerge(hipe_temp_map:to_substlist(TempMap), TempMap2),
@@ -104,6 +106,7 @@ alloc(CFG, SpillIndex, SpillLimit, Options) ->
?add_spills(Options, NewSpillIndex),
{NewCFG, Coloring2}.
-regalloc(CFG,PhysRegs,Entrypoints, SpillIndex, DontSpill, Options, Target) ->
- hipe_ls_regalloc:regalloc(CFG,PhysRegs,Entrypoints, SpillIndex,
+regalloc(CFG,Liveness,PhysRegs,Entrypoints, SpillIndex, DontSpill, Options,
+ Target) ->
+ hipe_ls_regalloc:regalloc(CFG,Liveness,PhysRegs,Entrypoints, SpillIndex,
DontSpill, Options, Target).