diff options
author | Sverker Eriksson <[email protected]> | 2016-11-22 12:02:07 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-11-22 12:02:07 +0100 |
commit | 3d7b55f946162b5a129241dbe67397784a1ba1a5 (patch) | |
tree | 8a3809296bdfcdd16ebbf78975ea18034b22d62c /lib/hipe/icode/hipe_icode.erl | |
parent | 9491f6727f12e37241863bd5becbd1f336ff7659 (diff) | |
parent | fda3c9575d77bed0250f76f17e92d18836e15d0c (diff) | |
download | otp-3d7b55f946162b5a129241dbe67397784a1ba1a5.tar.gz otp-3d7b55f946162b5a129241dbe67397784a1ba1a5.tar.bz2 otp-3d7b55f946162b5a129241dbe67397784a1ba1a5.zip |
Merge branch 'margnus1/hipe/refactor-rtl/PR-1243'
* margnus1/hipe/refactor-rtl/PR-1243:
hipe_x86: Fix encoding of test instr w/ neg imm
hipe_tagscheme: Simplify test_two_fixnums with imm
hipe_icode: Always const-propagate if&call args
hipe_tagscheme: x86 lea+test for mask_and_compare
hipe_tagscheme: Improve fixnum_addsub with imm
hipe: Make realloc_binary fast case true branch
hipe_x86_postpass: Negate conditions in goto elim
hipe_tagscheme: Improve fixnum add on x86
hipe_rtl_to_x86: Use LEA only for immediate adds
hipe_x86: LeaToAdd peephole rule
hipe_sparc: move coalescing
hipe_ppc: better rlwinm pp
hipe_ppc: move coalescing
hipe_rtl: drop alub dest when unused
hipe_rtl: unify branch and alub
hipe_x86: Fix&activate ElimCmp0 peephole rule
hipe_{x86,amd64}: Finish test instr implementation
Diffstat (limited to 'lib/hipe/icode/hipe_icode.erl')
-rw-r--r-- | lib/hipe/icode/hipe_icode.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_icode.erl b/lib/hipe/icode/hipe_icode.erl index 78508dff22..d2d08e0253 100644 --- a/lib/hipe/icode/hipe_icode.erl +++ b/lib/hipe/icode/hipe_icode.erl @@ -438,6 +438,7 @@ if_true_label/1, if_false_label/1, if_args/1, + if_args_update/2, if_pred/1, %% is_if/1, @@ -594,6 +595,7 @@ uses/1, defines/1, is_safe/1, + reduce_unused/1, strip_comments/1, subst/2, subst_uses/2, @@ -713,6 +715,9 @@ if_op_update(IF, NewOp) -> IF#icode_if{op=NewOp}. -spec if_args(#icode_if{}) -> [icode_term_arg()]. if_args(#icode_if{args=Args}) -> Args. +-spec if_args_update(#icode_if{}, [icode_term_arg()]) -> #icode_if{}. +if_args_update(IF, Args) -> IF#icode_if{args=Args}. + -spec if_true_label(#icode_if{}) -> icode_lbl(). if_true_label(#icode_if{true_label=TrueLbl}) -> TrueLbl. @@ -1765,6 +1770,18 @@ is_safe(Instr) -> #icode_end_try{} -> false end. +%% @doc Produces a simplified instruction sequence that is equivalent to [Instr] +%% under the assumption that all results of Instr are unused, or 'false' if +%% there is no such sequence (other than [Instr] itself). + +-spec reduce_unused(icode_instr()) -> false | [icode_instr()]. + +reduce_unused(Instr) -> + case is_safe(Instr) of + true -> []; + false -> false + end. + %%----------------------------------------------------------------------- -spec highest_var(icode_instrs()) -> non_neg_integer(). |