aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2015-06-22 09:57:40 +0200
committerHenrik Nord <[email protected]>2015-06-22 09:57:40 +0200
commit84163010ab5bffb101cb004f8ef853c299c69162 (patch)
treebba7dbadfaba7cb94f8cde6ca3933ce80c970cc2 /lib/hipe
parent2be7b33f26fc950c2f807e1f9fbc19fde83facd0 (diff)
parent95c318bf220451d5e223dbb166e6c9da4c7d067f (diff)
downloadotp-84163010ab5bffb101cb004f8ef853c299c69162.tar.gz
otp-84163010ab5bffb101cb004f8ef853c299c69162.tar.bz2
otp-84163010ab5bffb101cb004f8ef853c299c69162.zip
Merge branch 'kostis/hipe-no-dial-warnings'
* kostis/hipe-no-dial-warnings: Eliminate a dialyzer warning Simplify handling of o2 and o3 option expansion
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/main/hipe.erl40
-rw-r--r--lib/hipe/rtl/hipe_tagscheme.erl15
2 files changed, 13 insertions, 42 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
diff --git a/lib/hipe/rtl/hipe_tagscheme.erl b/lib/hipe/rtl/hipe_tagscheme.erl
index c27c682915..e640a73a6e 100644
--- a/lib/hipe/rtl/hipe_tagscheme.erl
+++ b/lib/hipe/rtl/hipe_tagscheme.erl
@@ -20,7 +20,7 @@
%%========================================================================
%%
%% Filename : hipe_tagscheme.erl
-%% Note : This is specific to Erlang 5.* (i.e. starting with R9).
+%% Note : This is specific to Erlang >= 5.* (i.e. starting with R9).
%%
%% Modifications:
%% 020904: Happi - added support for external pids and ports.
@@ -141,7 +141,7 @@ mk_non_value() -> ?THE_NON_VALUE.
-spec is_fixnum(integer()) -> boolean().
is_fixnum(N) when is_integer(N) ->
Bits = ?bytes_to_bits(hipe_rtl_arch:word_size()) - ?TAG_IMMED1_SIZE,
- (N =< ((1 bsl (Bits - 1)) - 1)) and (N >= -(1 bsl (Bits - 1))).
+ (N =< ((1 bsl (Bits - 1)) - 1)) andalso (N >= -(1 bsl (Bits - 1))).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -973,11 +973,11 @@ get_one_word_pos_bignum(USize, Size, Fail) ->
-spec bignum_sizeneed(non_neg_integer()) -> non_neg_integer().
bignum_sizeneed(Size) ->
- WordSizeBits = hipe_rtl_arch:word_size() * 8,
case is_fixnum(1 bsl Size) of
true ->
0;
false ->
+ WordSizeBits = hipe_rtl_arch:word_size() * 8,
((Size + (WordSizeBits-1)) div WordSizeBits) + 1
end.
@@ -1116,14 +1116,11 @@ get_field_offset({matchbuffer, binsize}) ->
?MB_SIZE.
get_field_size(Field) ->
- size_to_atom(get_field_size1(Field)).
-
-size_to_atom(Bytes) ->
WordSize = hipe_rtl_arch:word_size(),
- case Bytes of
+ case get_field_size1(Field) of
WordSize -> word;
- 4 -> int32;
- %%2 -> int16; So far there are no 2 byte fields
+ %% 4 -> int32; Seems not needed: covered by the previous case
+ %% 2 -> int16; So far there are no 2 byte fields
1 -> byte
end.