2
%%% Linear Scan register allocator for x86
5
%% hipe:c({len,len,2},[late_frames,{regalloc,lfls},pp_sparc]).
6
%% hipe:c( {random_test,mergel,2},[pp_sparc,late_frames,{regalloc,lfls},pp_rtl]).
7
%% hipe:c({barnes2,resolve_body_conflict,9},[time,o2,late_frames,{regalloc,lfls},verbose,pp_rtl]).
9
-module(hipe_sparc_ra_lfls).
11
-define(HIPE_INSTRUMENT_COMPILER, true). %% Turn on instrumentation.
13
-include("../main/hipe.hrl").
15
alloc(CFG, Options) ->
16
?inc_counter(ra_calls_counter,1),
19
hipe_sparc_specific:number_of_temporaries(
22
?inc_counter(bbs_counter, length(hipe_sparc_cfg:labels(CFG))),
23
alloc(CFG, 0, SpillLimit, Options).
26
alloc(SparcCfg, SpillIndex, SpillLimit, Options) ->
27
?inc_counter(ra_iteration_counter,1),
28
%% hipe_sparc_cfg:pp(SparcCfg),
30
{Map, NewSpillIndex} =
31
hipe_ls_regalloc:regalloc(
33
hipe_sparc_registers:allocatable() --
34
[hipe_sparc_registers:temp1(),hipe_sparc_registers:temp2()],
35
%% hipe_sparc_registers:temp3()],
36
[hipe_sparc_cfg:start(SparcCfg)],
41
%% io:format("Spill ~w\n",[NewSpillIndex]),
42
TempMap = hipe_temp_map:cols2tuple(Map, hipe_sparc_specific),
45
hipe_sparc_ra_post_ls:rewrite(
46
SparcCfg, TempMap, [], Options),
50
?add_spills(Options, NewSpillIndex),
51
%% {SparcCfg2, NextPos} = hipe_sparc_caller_saves:rewrite(
52
%% NewCfg, TempMap, NewSpillIndex, Options),
53
%% io:format("Spill+caller_saves ~w\n",[NextPos]),
54
%%{SparcCfg2, TempMap, NextPos};
55
{NewCfg, TempMap, NewSpillIndex};
57
%% Since SpillLimit is used as a low-water-mark
58
%% the list of temps not to spill is uninteresting.
59
exit(i_did_not_want_this)