aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2015-06-13 15:16:00 +0200
committerKostis Sagonas <[email protected]>2015-06-13 15:16:00 +0200
commit9e67864235e2a9183746dc904f41d03743a77fd2 (patch)
tree8e5383c413805c1eb08094d97b8be5a8774584bc /lib/hipe
parent831aab8a46f9f659bc422fbbef4971e9e68b201f (diff)
downloadotp-9e67864235e2a9183746dc904f41d03743a77fd2.tar.gz
otp-9e67864235e2a9183746dc904f41d03743a77fd2.tar.bz2
otp-9e67864235e2a9183746dc904f41d03743a77fd2.zip
Simplify handling of o2 and o3 option expansion
A recent rewrite of some code in this file (commit 355f4b5) exposed some dialyzer warnings of some code which is unreachable. Indeed, checking whether one executes on an unsupported architecture when expanding the 'o2' and 'o3' hipe compiler options is unnecessary because that check is performed in the expansion of the 'o1' option anyway. While at it, simplified the code a bit not to have a very long case clause.
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/main/hipe.erl40
1 files changed, 7 insertions, 33 deletions
diff --git a/lib/hipe/main/hipe.erl b/lib/hipe/main/hipe.erl
index b614f5f1ab..52c1b28ad4 100644
--- a/lib/hipe/main/hipe.erl
+++ b/lib/hipe/main/hipe.erl
@@ -1392,41 +1392,15 @@ o2_opts(TargetArch) ->
spillmin_color, use_indexing, remove_comments,
concurrent_comp, binary_opt | o1_opts(TargetArch)],
case TargetArch of
- ultrasparc ->
- Common;
- powerpc ->
- Common;
- ppc64 ->
- Common;
- arm ->
- Common;
- x86 ->
- Common;
- % [rtl_ssapre | Common];
- amd64 ->
- [icode_range | Common]; % range analysis is effective on 64 bits
- Arch ->
- ?EXIT({executing_on_an_unsupported_architecture,Arch})
- end.
+ T when T =:= amd64 orelse T =:= ppc64 -> % 64-bit targets
+ [icode_range | Common];
+ _ -> % T \in [arm, powerpc, ultrasparc, x86]
+ Common % [rtl_ssapre | Common];
+ end.
o3_opts(TargetArch) ->
- Common = [icode_range, {regalloc,coalescing} | o2_opts(TargetArch)],
- case TargetArch of
- ultrasparc ->
- Common;
- powerpc ->
- Common;
- ppc64 ->
- Common;
- arm ->
- Common;
- x86 ->
- Common;
- amd64 ->
- Common;
- Arch ->
- ?EXIT({executing_on_an_unsupported_architecture,Arch})
- end.
+ %% no point checking for target architecture since this is checked in 'o1'
+ [icode_range, {regalloc,coalescing} | o2_opts(TargetArch)].
%% Note that in general, the normal form for options should be positive.
%% This is a good programming convention, so that tests in the code say