aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/x86/hipe_x86_ra_ls.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hipe/x86/hipe_x86_ra_ls.erl')
-rw-r--r--lib/hipe/x86/hipe_x86_ra_ls.erl31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/hipe/x86/hipe_x86_ra_ls.erl b/lib/hipe/x86/hipe_x86_ra_ls.erl
index 3e34433111..8cd51481dd 100644
--- a/lib/hipe/x86/hipe_x86_ra_ls.erl
+++ b/lib/hipe/x86/hipe_x86_ra_ls.erl
@@ -35,7 +35,7 @@
-endif.
-module(?HIPE_X86_RA_LS).
--export([ra/3,regalloc/7]).
+-export([ra/3,ra_fp/3,regalloc/7]).
-define(HIPE_INSTRUMENT_COMPILER, true). %% Turn on instrumentation.
-include("../main/hipe.hrl").
@@ -48,6 +48,35 @@ ra(Defun, SpillIndex, Options) ->
?inc_counter(bbs_counter, length(hipe_x86_cfg:labels(CFG))),
alloc(NewDefun, SpillIndex, SpillLimit, Options).
+ra_fp(Defun, Options, TargetMod) ->
+ ?inc_counter(ra_calls_counter,1),
+ CFG = hipe_x86_cfg:init(Defun),
+ %% ?inc_counter(ra_caller_saves_counter,count_caller_saves(CFG)),
+ SpillIndex = 0,
+ SpillLimit = TargetMod:number_of_temporaries(CFG),
+ ?inc_counter(bbs_counter, length(hipe_x86_cfg:labels(CFG))),
+
+ ?inc_counter(ra_iteration_counter,1),
+ %% ?HIPE_X86_PP:pp(Defun),
+ Cfg = hipe_x86_cfg:init(Defun), % XXX: didn't we just compute this above?
+
+ {Coloring,NewSpillIndex} =
+ regalloc(Cfg,
+ TargetMod:allocatable('linearscan'),
+ [hipe_x86_cfg:start_label(Cfg)],
+ SpillIndex, SpillLimit, Options,
+ TargetMod),
+
+ {NewDefun, _DidSpill} =
+ TargetMod:check_and_rewrite(Defun, Coloring, 'linearscan'),
+ TempMap = hipe_temp_map:cols2tuple(Coloring, TargetMod),
+ {TempMap2, NewSpillIndex2} =
+ hipe_spillmin:stackalloc(CFG, [], SpillIndex, Options,
+ TargetMod, TempMap),
+ Coloring2 =
+ hipe_spillmin:mapmerge(hipe_temp_map:to_substlist(TempMap), TempMap2),
+ ?add_spills(Options, NewSpillIndex),
+ {NewDefun, Coloring2, NewSpillIndex2}.
alloc(Defun, SpillIndex, SpillLimit, Options) ->
?inc_counter(ra_iteration_counter,1),