aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/icode/hipe_icode.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-11-09 18:47:12 +0100
committerMagnus Lång <[email protected]>2016-11-15 14:58:59 +0100
commitc91c523f1ca58644267402325b6fb59d65049829 (patch)
treec355fdf2a07ff894cbb8f1cc1bea7abcb889dd0b /lib/hipe/icode/hipe_icode.erl
parentca0fbe891d0f8278b4824d6b2c5db4cd01fcef5c (diff)
downloadotp-c91c523f1ca58644267402325b6fb59d65049829.tar.gz
otp-c91c523f1ca58644267402325b6fb59d65049829.tar.bz2
otp-c91c523f1ca58644267402325b6fb59d65049829.zip
hipe_rtl: drop alub dest when unused
Diffstat (limited to 'lib/hipe/icode/hipe_icode.erl')
-rw-r--r--lib/hipe/icode/hipe_icode.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_icode.erl b/lib/hipe/icode/hipe_icode.erl
index 78508dff22..dce2fcb392 100644
--- a/lib/hipe/icode/hipe_icode.erl
+++ b/lib/hipe/icode/hipe_icode.erl
@@ -594,6 +594,7 @@
uses/1,
defines/1,
is_safe/1,
+ reduce_unused/1,
strip_comments/1,
subst/2,
subst_uses/2,
@@ -1765,6 +1766,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().