aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-03-12 01:32:35 +0100
committerMagnus Lång <[email protected]>2016-08-30 17:02:40 +0200
commitcd8b3708db582a7735bb357c0783d8ebdb3b6b2e (patch)
tree2dfab24f68377ef7e67784e837846558f601ee72 /lib
parent8acd1a0d56e4ba33d07cdac0b6a829a701145003 (diff)
downloadotp-cd8b3708db582a7735bb357c0783d8ebdb3b6b2e.tar.gz
otp-cd8b3708db582a7735bb357c0783d8ebdb3b6b2e.tar.bz2
otp-cd8b3708db582a7735bb357c0783d8ebdb3b6b2e.zip
hipe_rtl_binary:get_word_integer/4: Handle imms
Immediate arguments to get_word_integer/4 would lead to bad but unreachable RTL being generated. We omit its generation by testing for immediates and performing the logic at compile time.
Diffstat (limited to 'lib')
-rw-r--r--lib/hipe/rtl/hipe_rtl_binary.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/hipe/rtl/hipe_rtl_binary.erl b/lib/hipe/rtl/hipe_rtl_binary.erl
index fb9c0c196d..ad23df80d2 100644
--- a/lib/hipe/rtl/hipe_rtl_binary.erl
+++ b/lib/hipe/rtl/hipe_rtl_binary.erl
@@ -106,10 +106,20 @@ create_lbls(0) ->
%%------------------------------------------------------------------------------
get_word_integer(Var, Register, SystemLimitLblName, FalseLblName) ->
- [EndLbl] = create_lbls(1),
- EndName = hipe_rtl:label_name(EndLbl),
- get_word_integer(Var, Register,SystemLimitLblName, FalseLblName, EndName, EndName,
- [EndLbl]).
+ case hipe_rtl:is_imm(Var) of
+ true ->
+ TaggedVal = hipe_rtl:imm_value(Var),
+ true = hipe_tagscheme:is_fixnum(TaggedVal),
+ Val = hipe_tagscheme:fixnum_val(TaggedVal),
+ if Val < 0 -> [hipe_rtl:mk_goto(FalseLblName)];
+ true -> [hipe_rtl:mk_move(Register, hipe_rtl:mk_imm(Val))]
+ end;
+ false ->
+ [EndLbl] = create_lbls(1),
+ EndName = hipe_rtl:label_name(EndLbl),
+ get_word_integer(Var, Register,SystemLimitLblName, FalseLblName,
+ EndName, EndName, [EndLbl])
+ end.
get_word_integer(Var, Register, SystemLimitLblName, FalseLblName, TrueLblName,
BigLblName, Tail) ->