2
2
%%----------------------------------------------------------------------
3
3
%% File : hipe_icode_ssa.erl
6
%% Purpose : Provides interface functions for converting Icode into
7
%% SSA form and back using the generic SSA converter.
7
8
%%----------------------------------------------------------------------
9
10
-module(hipe_icode_ssa).
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).
10
18
-include("../ssa/hipe_ssa.inc").
12
place_phi(CFG, DominanceFrontier) ->
13
hipe_icode_ssa_phi:place(CFG, DominanceFrontier).
15
rename(CFG, DominatorTree) ->
16
hipe_icode_ssa_rename:rename(CFG, DominatorTree).
19
hipe_icode_cfg:label_range(CFG).
22
hipe_icode_cfg:start_label(CFG).
25
hipe_icode:mk_goto(L).
27
bb_add(CFG, Label, BB) ->
28
hipe_icode_cfg:bb_add(CFG, Label, BB).
30
start_label_update(CFG, NewStartLabel) ->
31
hipe_icode_cfg:start_label_update(CFG, NewStartLabel).
33
label_range_update(CFG, Range) ->
34
hipe_icode_cfg:label_range_update(CFG, Range).
37
hipe_icode_cfg:succ_map(CFG).
20
%%----------------------------------------------------------------------
21
%% Auxiliary operations which seriously differ between Icode and RTL.
22
%%----------------------------------------------------------------------
24
defs_to_rename(Statement) ->
25
hipe_icode:defines(Statement).
27
uses_to_rename(Statement) ->
28
hipe_icode:uses(Statement).
33
%%----------------------------------------------------------------------
36
hipe_gensym:set_var(icode, 0).
38
%%----------------------------------------------------------------------
41
hipe_icode:is_fvar(Temp).
44
hipe_icode:mk_new_fvar().
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.
54
%% Note : ?CODE here is hipe_icode
55
%%----------------------------------------------------------------------
57
makePhiMove(Dst, Src) ->
58
case hipe_icode:is_fvar(Dst) of
60
case hipe_icode:is_fvar(Src) of
62
hipe_icode:mk_move(Dst, Src);
64
hipe_icode:mk_primop([Dst],unsafe_tag_float,[Src])
67
case hipe_icode:is_fvar(Src) of
69
hipe_icode:mk_fmove(Dst, Src);
71
hipe_icode:mk_primop([Dst],conv_to_float,[Src])
75
%%----------------------------------------------------------------------