aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/rtl/hipe_rtl_cfg.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-11-09 18:46:19 +0100
committerMagnus Lång <[email protected]>2016-11-15 14:58:59 +0100
commitca0fbe891d0f8278b4824d6b2c5db4cd01fcef5c (patch)
tree0c15bfa89f041c3faa2763a400eb3392e0da10fc /lib/hipe/rtl/hipe_rtl_cfg.erl
parentbd898fab5d86ff44ce3129db9a06a5c709719392 (diff)
downloadotp-ca0fbe891d0f8278b4824d6b2c5db4cd01fcef5c.tar.gz
otp-ca0fbe891d0f8278b4824d6b2c5db4cd01fcef5c.tar.bz2
otp-ca0fbe891d0f8278b4824d6b2c5db4cd01fcef5c.zip
hipe_rtl: unify branch and alub
branch and alub overlap in their use cases, but the backends rely on knowing that the result is unused in their lowering of branch. By extending alub so that the destination is optional, it can fully replace branch. This simplifies rtl by reducing code duplication and the number of instructions. Also, in the x86 and arm backends, we can now use 'test' and {'tst','mvn','teq'} to lower some alubs without destinations. This is particularly good for x86, as sequences such as 'is_boxed' type tests now get shorter (both from not needing a mov to copy the variable, but also from the fact that 'testb' encodes shorter than 'andq').
Diffstat (limited to 'lib/hipe/rtl/hipe_rtl_cfg.erl')
-rw-r--r--lib/hipe/rtl/hipe_rtl_cfg.erl7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/hipe/rtl/hipe_rtl_cfg.erl b/lib/hipe/rtl/hipe_rtl_cfg.erl
index f49e8f815f..e802b320c2 100644
--- a/lib/hipe/rtl/hipe_rtl_cfg.erl
+++ b/lib/hipe/rtl/hipe_rtl_cfg.erl
@@ -83,9 +83,7 @@ mk_goto(Name) ->
branch_successors(Instr) ->
case Instr of
- #branch{} -> [hipe_rtl:branch_true_label(Instr),
- hipe_rtl:branch_false_label(Instr)];
- #alub{} -> [hipe_rtl:alub_true_label(Instr),
+ #alub{} -> [hipe_rtl:alub_true_label(Instr),
hipe_rtl:alub_false_label(Instr)];
#switch{} -> hipe_rtl:switch_labels(Instr);
#call{} ->
@@ -106,7 +104,6 @@ fails_to(Instr) ->
is_branch(Instr) ->
case Instr of
- #branch{} -> true;
#alub{} -> true;
#switch{} -> true;
#goto{} -> true;
@@ -127,7 +124,7 @@ is_branch(Instr) ->
is_pure_branch(Instr) ->
case Instr of
- #branch{} -> true;
+ #alub{} -> not hipe_rtl:alub_has_dst(Instr);
#switch{} -> true;
#goto{} -> true;
_ -> false