aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/regalloc/hipe_ppc_specific.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-06-23 17:55:12 +0200
committerMagnus Lång <[email protected]>2016-09-02 15:59:17 +0200
commit52964d9fbc8031298c977d5e4a9ef7b5605875ae (patch)
treedf2b2eec8d0f16f7767d1bd54162d2e7816a9011 /lib/hipe/regalloc/hipe_ppc_specific.erl
parent3f678056ab55ae4546c7943b894b70558e3eb26c (diff)
downloadotp-52964d9fbc8031298c977d5e4a9ef7b5605875ae.tar.gz
otp-52964d9fbc8031298c977d5e4a9ef7b5605875ae.tar.bz2
otp-52964d9fbc8031298c977d5e4a9ef7b5605875ae.zip
hipe_ppc: Add code rewrite RA callbacks
These will not only be useful for hipe_regalloc_prepass, but also, after the introduction of a mk_move/2 (or similar) callback, for the purpose of range splitting. Since the substitution needed to case over all the instructions, a new module, hipe_ppc_subst, was introduced to the ppc backend.
Diffstat (limited to 'lib/hipe/regalloc/hipe_ppc_specific.erl')
-rw-r--r--lib/hipe/regalloc/hipe_ppc_specific.erl26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/hipe/regalloc/hipe_ppc_specific.erl b/lib/hipe/regalloc/hipe_ppc_specific.erl
index 3811b972ba..d046567e79 100644
--- a/lib/hipe/regalloc/hipe_ppc_specific.erl
+++ b/lib/hipe/regalloc/hipe_ppc_specific.erl
@@ -53,6 +53,12 @@
%% callbacks for hipe_regalloc_loop
-export([check_and_rewrite/2]).
+%% callbacks for hipe_regalloc_prepass
+-export([new_reg_nr/0,
+ update_reg_nr/2,
+ update_bb/3,
+ subst_temps/2]).
+
check_and_rewrite(CFG, Coloring) ->
hipe_ppc_ra_postconditions:check_and_rewrite(CFG, Coloring, 'normal').
@@ -113,6 +119,9 @@ number_of_temporaries(_CFG) ->
bb(CFG,L) ->
hipe_ppc_cfg:bb(CFG,L).
+update_bb(CFG,L,BB) ->
+ hipe_ppc_cfg:bb_add(CFG,L,BB).
+
%% PowerPC stuff
def_use(Instruction) ->
@@ -145,6 +154,23 @@ is_move(Instruction) ->
reg_nr(Reg) ->
hipe_ppc:temp_reg(Reg).
+new_reg_nr() ->
+ hipe_gensym:get_next_var(ppc).
+
+update_reg_nr(Nr, Temp) ->
+ hipe_ppc:mk_temp(Nr, hipe_ppc:temp_type(Temp)).
+
+subst_temps(SubstFun, Instr) ->
+ hipe_ppc_subst:insn_temps(
+ fun(Op) ->
+ case hipe_ppc:temp_is_allocatable(Op)
+ andalso hipe_ppc:temp_type(Op) =/= 'double'
+ of
+ true -> SubstFun(Op);
+ false -> Op
+ end
+ end, Instr).
+
%%% Linear Scan stuff
new_spill_index(SpillIndex) when is_integer(SpillIndex) ->