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

« back to all changes in this revision

Viewing changes to lib/hipe/rtl/hipe_rtl_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:
 
1
%% -*- erlang-indent-level: 2 -*-
 
2
%%----------------------------------------------------------------------
 
3
%% File    : hipe_rtl_ssa.erl
 
4
%% Author  : Kostis Sagonas <kostis@it.uu.se>
 
5
%% Created : 30 Jan 2004
 
6
%% Purpose : Provides interface functions for converting RTL code into
 
7
%%           SSA form and back using the generic SSA converter.
 
8
%%----------------------------------------------------------------------
 
9
 
 
10
-module(hipe_rtl_ssa).
 
11
 
 
12
%% The following defines are needed by the included file below
 
13
-define(CODE, hipe_rtl).
 
14
-define(CFG,  hipe_rtl_cfg).
 
15
-define(LIVENESS, hipe_rtl_liveness).
 
16
-export([uses_to_rename/1]).    %% needed by hipe_rtl_ssa_const_prop
 
17
 
 
18
-include("../ssa/hipe_ssa.inc").
 
19
     
 
20
%%----------------------------------------------------------------------
 
21
%% Auxiliary operations which seriously differ between Icode and RTL.
 
22
%%----------------------------------------------------------------------
 
23
 
 
24
defs_to_rename(Statement) ->
 
25
  Defs = hipe_rtl:defines(Statement),
 
26
  lists:filter(fun(X) -> not hipe_rtl_arch:is_precoloured(X) end, Defs).
 
27
 
 
28
uses_to_rename(Statement) ->
 
29
  Uses = hipe_rtl:uses(Statement),
 
30
  lists:filter(fun(X) -> not hipe_rtl_arch:is_precoloured(X) end, Uses).
 
31
 
 
32
liveout_no_succ() ->
 
33
  hipe_rtl_arch:live_at_return().
 
34
 
 
35
%-----------------------------------------------------------------------
 
36
 
 
37
reset_var_indx() ->
 
38
  hipe_gensym:set_var(rtl, hipe_rtl_arch:first_virtual_reg()).
 
39
 
 
40
%%----------------------------------------------------------------------
 
41
 
 
42
is_fp_temp(Temp) ->
 
43
  hipe_rtl:is_fpreg(Temp).
 
44
 
 
45
mk_new_fp_temp() ->
 
46
  hipe_rtl:mk_new_fpreg().
 
47
 
 
48
%-----------------------------------------------------------------------
 
49
%% Procedure : makePhiMove 
 
50
%% Purpose   : Create an RTL-specific version of a move instruction
 
51
%%             depending on the type of the arguments.
 
52
%% Arguments : Dst, Src - the arguments of a Phi instruction that is
 
53
%%                        to be moved up the predecessor block as part
 
54
%%                        of the SSA un-convert phase.
 
55
%% Returns   : Code
 
56
%% Note      : ?CODE here is hipe_rtl
 
57
%%----------------------------------------------------------------------
 
58
 
 
59
makePhiMove(Dst, Src) ->
 
60
  case hipe_rtl:is_fpreg(Dst) of
 
61
    false ->
 
62
      case hipe_rtl:is_fpreg(Src) of %% this test is just a sanity check
 
63
        false ->
 
64
          hipe_rtl:mk_move(Dst, Src)
 
65
      end;
 
66
    true ->
 
67
      case hipe_rtl:is_fpreg(Src) of %% this test is just a sanity check
 
68
        true ->
 
69
          hipe_rtl:mk_fmove(Dst, Src)
 
70
      end
 
71
  end.
 
72
 
 
73
%-----------------------------------------------------------------------