~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/hipe/sparc/hipe_sparc_ra_lfls.erl

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%%% $Id$
2
 
%%% Linear Scan register allocator for x86
3
 
 
4
 
%%
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]).
8
 
 
9
 
-module(hipe_sparc_ra_lfls).
10
 
-export([alloc/2]).
11
 
-define(HIPE_INSTRUMENT_COMPILER, true). %% Turn on instrumentation.
12
 
%-define(DEBUG,true).
13
 
-include("../main/hipe.hrl").
14
 
 
15
 
alloc(CFG, Options) ->
16
 
  ?inc_counter(ra_calls_counter,1), 
17
 
 
18
 
  SpillLimit = 
19
 
    hipe_sparc_specific:number_of_temporaries(
20
 
      CFG),
21
 
  
22
 
  ?inc_counter(bbs_counter, length(hipe_sparc_cfg:labels(CFG))),
23
 
  alloc(CFG, 0, SpillLimit, Options).
24
 
 
25
 
 
26
 
alloc(SparcCfg, SpillIndex, SpillLimit, Options) ->
27
 
  ?inc_counter(ra_iteration_counter,1), 
28
 
  %% hipe_sparc_cfg:pp(SparcCfg),
29
 
 
30
 
  {Map, NewSpillIndex} = 
31
 
    hipe_ls_regalloc:regalloc(
32
 
      SparcCfg,
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)],
37
 
      SpillIndex,
38
 
      SpillLimit,
39
 
      Options,
40
 
      hipe_sparc_specific),
41
 
%% io:format("Spill ~w\n",[NewSpillIndex]),
42
 
  TempMap = hipe_temp_map:cols2tuple(Map, hipe_sparc_specific),
43
 
 
44
 
  {NewCfg, DontSpill} =
45
 
    hipe_sparc_ra_post_ls:rewrite(
46
 
      SparcCfg, TempMap, [], Options),
47
 
 
48
 
  case DontSpill of
49
 
    [] -> 
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};
56
 
    _ -> 
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)
60
 
  end.
61