diff options
author | Magnus Lång <[email protected]> | 2017-03-16 14:55:23 +0100 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2017-03-16 20:49:42 +0100 |
commit | dbe626aa7beb0f04403f6782443f3a78d0f1fdb0 (patch) | |
tree | 80624d8951ff6ab6f0dc665d5fa606ae7d3c38ae /lib/hipe/regalloc/hipe_ppc_specific_fp.erl | |
parent | 040f6e240a80cb8576ddb3e7b2b49fd7f98aa3dc (diff) | |
download | otp-dbe626aa7beb0f04403f6782443f3a78d0f1fdb0.tar.gz otp-dbe626aa7beb0f04403f6782443f3a78d0f1fdb0.tar.bz2 otp-dbe626aa7beb0f04403f6782443f3a78d0f1fdb0.zip |
hipe: Add basic range splitting ra callbacks
In addition to the temporary name rewriting that hipe_regalloc_prepass
does, range splitters also need to be able to insert move instructions,
as well as inserting new basic blocks in the control flow graph. The
following four callbacks are added for that purpose:
* Target:mk_move(Src, Dst, Context)
Returns a move instruction from the temporary (not just register
number) Src to Dst.
* Target:mk_goto(Label, Context)
Returns a unconditional control flow instruction that branches to the
label with name Label.
* Target:redirect_jmp(Instr, ToOld, ToNew, Context)
Modifies the control flow instruction Instr so that any control flow
that would go to a label with name ToOld instead goes to the label
with name ToNew.
* Target:new_label(Context)
Returns a fresh label name that does not belong to any existing block
in the current function, and is to be used to create a new basic
block in the control flow graph by calling Target:update_bb/4 with
this new name.
Diffstat (limited to 'lib/hipe/regalloc/hipe_ppc_specific_fp.erl')
-rw-r--r-- | lib/hipe/regalloc/hipe_ppc_specific_fp.erl | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/hipe/regalloc/hipe_ppc_specific_fp.erl b/lib/hipe/regalloc/hipe_ppc_specific_fp.erl index 23cb6c0318..3aab14f061 100644 --- a/lib/hipe/regalloc/hipe_ppc_specific_fp.erl +++ b/lib/hipe/regalloc/hipe_ppc_specific_fp.erl @@ -46,8 +46,12 @@ %% callbacks for hipe_regalloc_loop -export([check_and_rewrite/3]). -%% callbacks for hipe_regalloc_prepass --export([new_reg_nr/1, +%% callbacks for hipe_regalloc_prepass, hipe_range_split +-export([mk_move/3, + mk_goto/2, + redirect_jmp/4, + new_label/1, + new_reg_nr/1, update_reg_nr/3, update_bb/4, subst_temps/3]). @@ -128,6 +132,18 @@ is_move(I, _) -> reg_nr(Reg, _) -> hipe_ppc:temp_reg(Reg). +mk_move(Src, Dst, _) -> + hipe_ppc:mk_pseudo_fmove(Dst, Src). + +mk_goto(Label, _) -> + hipe_ppc:mk_b_label(Label). + +redirect_jmp(Jmp, ToOld, ToNew, _) when is_integer(ToOld), is_integer(ToNew) -> + hipe_ppc_cfg:redirect_jmp(Jmp, ToOld, ToNew). + +new_label(_) -> + hipe_gensym:get_next_label(ppc). + new_reg_nr(_) -> hipe_gensym:get_next_var(ppc). |