diff options
author | Magnus Lång <[email protected]> | 2016-06-22 19:10:55 +0200 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-09-02 15:59:17 +0200 |
commit | 3f678056ab55ae4546c7943b894b70558e3eb26c (patch) | |
tree | f7503c88288709728d1e7f44244a50914135b18f /lib/hipe/regalloc/hipe_sparc_specific_fp.erl | |
parent | 60b5deae9ca2cb3540c899b19151b7e3391d305d (diff) | |
download | otp-3f678056ab55ae4546c7943b894b70558e3eb26c.tar.gz otp-3f678056ab55ae4546c7943b894b70558e3eb26c.tar.bz2 otp-3f678056ab55ae4546c7943b894b70558e3eb26c.zip |
hipe_sparc: 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_sparc_subst, was introduced to the sparc backend.
Diffstat (limited to 'lib/hipe/regalloc/hipe_sparc_specific_fp.erl')
-rw-r--r-- | lib/hipe/regalloc/hipe_sparc_specific_fp.erl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/hipe/regalloc/hipe_sparc_specific_fp.erl b/lib/hipe/regalloc/hipe_sparc_specific_fp.erl index 18f4a6b684..040e1346a4 100644 --- a/lib/hipe/regalloc/hipe_sparc_specific_fp.erl +++ b/lib/hipe/regalloc/hipe_sparc_specific_fp.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_sparc_ra_postconditions_fp:check_and_rewrite(CFG, Coloring). @@ -106,6 +112,9 @@ number_of_temporaries(_CFG) -> bb(CFG, L) -> hipe_sparc_cfg:bb(CFG, L). +update_bb(CFG,L,BB) -> + hipe_sparc_cfg:bb_add(CFG,L,BB). + %% SPARC stuff def_use(I) -> @@ -126,6 +135,23 @@ is_move(I) -> reg_nr(Reg) -> hipe_sparc:temp_reg(Reg). +new_reg_nr() -> + hipe_gensym:get_next_var(sparc). + +update_reg_nr(Nr, _Temp) -> + hipe_sparc:mk_temp(Nr, 'double'). + +subst_temps(SubstFun, Instr) -> + hipe_sparc_subst:insn_temps( + fun(Op) -> + case hipe_sparc:temp_is_allocatable(Op) + andalso hipe_sparc:temp_type(Op) =:= 'double' + of + true -> SubstFun(Op); + false -> Op + end + end, Instr). + -ifdef(notdef). new_spill_index(SpillIndex)-> SpillIndex+1. |