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

« back to all changes in this revision

Viewing changes to lib/hipe/icode/hipe_icode_ssa.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:
2
2
%%----------------------------------------------------------------------
3
3
%% File    : hipe_icode_ssa.erl
4
4
%% Author  : 
5
 
%% Purpose : 
6
5
%% Created : 
 
6
%% Purpose : Provides interface functions for converting Icode into
 
7
%%           SSA form and back using the generic SSA converter.
7
8
%%----------------------------------------------------------------------
8
9
 
9
10
-module(hipe_icode_ssa).
 
11
 
 
12
%% The following defines are needed by the included file below
 
13
-define(CODE, hipe_icode).
 
14
-define(CFG,  hipe_icode_cfg).
 
15
-define(LIVENESS, hipe_icode_liveness).
 
16
-define(LIVENESS_NEEDED, true).
 
17
 
10
18
-include("../ssa/hipe_ssa.inc").
11
 
     
12
 
place_phi(CFG, DominanceFrontier) ->
13
 
  hipe_icode_ssa_phi:place(CFG, DominanceFrontier).
14
 
 
15
 
rename(CFG, DominatorTree) ->
16
 
  hipe_icode_ssa_rename:rename(CFG, DominatorTree).
17
 
 
18
 
label_range(CFG) ->
19
 
  hipe_icode_cfg:label_range(CFG).
20
 
 
21
 
start_label(CFG) ->
22
 
  hipe_icode_cfg:start_label(CFG).
23
 
 
24
 
mk_goto(L) ->
25
 
  hipe_icode:mk_goto(L).
26
 
 
27
 
bb_add(CFG, Label, BB) ->
28
 
  hipe_icode_cfg:bb_add(CFG, Label, BB).
29
 
 
30
 
start_label_update(CFG, NewStartLabel) ->
31
 
  hipe_icode_cfg:start_label_update(CFG, NewStartLabel).
32
 
 
33
 
label_range_update(CFG, Range) ->
34
 
  hipe_icode_cfg:label_range_update(CFG, Range).
35
 
 
36
 
succ_map(CFG) ->
37
 
  hipe_icode_cfg:succ_map(CFG).
 
19
 
 
20
%%----------------------------------------------------------------------
 
21
%% Auxiliary operations which seriously differ between Icode and RTL.
 
22
%%----------------------------------------------------------------------
 
23
 
 
24
defs_to_rename(Statement) ->
 
25
  hipe_icode:defines(Statement).
 
26
 
 
27
uses_to_rename(Statement) ->
 
28
  hipe_icode:uses(Statement).
 
29
 
 
30
liveout_no_succ() ->
 
31
  [].
 
32
 
 
33
%%----------------------------------------------------------------------
 
34
 
 
35
reset_var_indx() ->
 
36
  hipe_gensym:set_var(icode, 0).
 
37
 
 
38
%%----------------------------------------------------------------------
 
39
 
 
40
is_fp_temp(Temp) ->
 
41
  hipe_icode:is_fvar(Temp).
 
42
 
 
43
mk_new_fp_temp() ->
 
44
  hipe_icode:mk_new_fvar().
 
45
 
 
46
%%----------------------------------------------------------------------
 
47
%% Procedure : makePhiMove 
 
48
%% Purpose   : Create an ICode-specific version of a move instruction
 
49
%%             depending on the type of the arguments.
 
50
%% Arguments : Dst, Src - the arguments of a Phi instruction that is
 
51
%%                        to be moved up the predecessor block as part
 
52
%%                        of the SSA un-convert phase.
 
53
%% Returns   : Code
 
54
%% Note      : ?CODE here is hipe_icode
 
55
%%----------------------------------------------------------------------
 
56
 
 
57
makePhiMove(Dst, Src) ->
 
58
  case hipe_icode:is_fvar(Dst) of
 
59
    false ->
 
60
      case hipe_icode:is_fvar(Src) of
 
61
        false ->
 
62
          hipe_icode:mk_move(Dst, Src);
 
63
        true ->
 
64
          hipe_icode:mk_primop([Dst],unsafe_tag_float,[Src])
 
65
      end;
 
66
    true ->
 
67
      case hipe_icode:is_fvar(Src) of
 
68
        true ->
 
69
          hipe_icode:mk_fmove(Dst, Src);
 
70
        false ->
 
71
          hipe_icode:mk_primop([Dst],conv_to_float,[Src])
 
72
      end
 
73
  end.
 
74
 
 
75
%%----------------------------------------------------------------------