aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2013-03-10 19:06:07 +0100
committerKostis Sagonas <[email protected]>2013-03-10 19:06:07 +0100
commit3d98819b66ed080bea199a5f33984d3213ef97f2 (patch)
treec31a1dd50f10afd95aa7737e6097649dad8fb8a7 /lib/hipe
parent0df9dd3ea4c26731dc18d33cc9ef41c2de5f6361 (diff)
downloadotp-3d98819b66ed080bea199a5f33984d3213ef97f2.tar.gz
otp-3d98819b66ed080bea199a5f33984d3213ef97f2.tar.bz2
otp-3d98819b66ed080bea199a5f33984d3213ef97f2.zip
Fix handling of bs_match_string translation
Prior to R16B, the bs_match_string instruction worked only for cases that had a destination variable. As shown by the example below, this is not always the case and the Dst list can be empty. test(<<42, _/bits>> = B) -> B. This fixes a bug reported by Loïc Hoguin (02/12/2013); the original post used a different code example to illustrate the problem. While revising the code, a significant clean up was also performed.
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/rtl/hipe_rtl_binary_match.erl166
1 files changed, 92 insertions, 74 deletions
diff --git a/lib/hipe/rtl/hipe_rtl_binary_match.erl b/lib/hipe/rtl/hipe_rtl_binary_match.erl
index d147bed6d8..8831199244 100644
--- a/lib/hipe/rtl/hipe_rtl_binary_match.erl
+++ b/lib/hipe/rtl/hipe_rtl_binary_match.erl
@@ -2,7 +2,7 @@
%%%
%%% %CopyrightBegin%
%%%
-%%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
+%%% Copyright Ericsson AB 2007-2013. All Rights Reserved.
%%%
%%% The contents of this file are subject to the Erlang Public License,
%%% Version 1.1, (the "License"); you may not use this file except in
@@ -42,6 +42,7 @@
%%--------------------------------------------------------------------
+%% ----- bs_start_match -----
gen_rtl({bs_start_match, 0}, [Ms], [Binary], TrueLblName, FalseLblName) ->
ReInitLbl = hipe_rtl:mk_new_label(),
BinaryLbl = hipe_rtl:mk_new_label(),
@@ -62,7 +63,7 @@ gen_rtl({bs_start_match, Max}, [Ms], [Binary], TrueLblName, FalseLblName) ->
TestCode =
[hipe_rtl:mk_move(Ms,Binary),
hipe_tagscheme:test_matchstate(Binary,
- hipe_rtl:label_name(MatchStateLbl),
+ hipe_rtl:label_name(MatchStateLbl),
hipe_rtl:label_name(BinaryLbl),
0.99)],
MatchStateTestCode =
@@ -86,7 +87,7 @@ gen_rtl({{bs_start_match, bitstr}, Max}, [Ms], [Binary],
gen_rtl({{bs_start_match, bitstr}, _Max}, [], [_Binary],
TrueLblName, _FalseLblName) ->
[hipe_rtl:mk_goto(TrueLblName)];
-gen_rtl({{bs_start_match,ok_matchstate}, Max}, [Ms], [Binary],
+gen_rtl({{bs_start_match, ok_matchstate}, Max}, [Ms], [Binary],
TrueLblName, FalseLblName) ->
MatchStateLbl = hipe_rtl:mk_new_label(),
BinaryLbl = hipe_rtl:mk_new_label(),
@@ -106,12 +107,13 @@ gen_rtl({{bs_start_match, ok_matchstate}, _Max}, [], [Binary],
hipe_rtl:label_name(MatchStateLbl), 0.99),
MatchStateLbl,
hipe_tagscheme:test_matchstate(Binary, TrueLblName, FalseLblName, 0.99)];
-gen_rtl({bs_get_integer, 0, _Flags}, [Dst, NewMs], [Ms],
+%% ----- bs_get_integer -----
+gen_rtl({bs_get_integer, 0, _Flags}, [Dst, NewMs], [Ms],
TrueLblName, _FalseLblName) ->
update_ms(NewMs, Ms) ++
[hipe_rtl:mk_move(Dst, hipe_rtl:mk_imm(15)),
hipe_rtl:mk_goto(TrueLblName)];
-gen_rtl({bs_get_integer,Size,Flags}, [Dst,NewMs], Args,
+gen_rtl({bs_get_integer, Size, Flags}, [Dst, NewMs], Args,
TrueLblName, FalseLblName) ->
case is_illegal_const(Size) of
true ->
@@ -123,15 +125,14 @@ gen_rtl({bs_get_integer,Size,Flags}, [Dst,NewMs], Args,
UnSafe = unsafe(Flags),
case Args of
[Ms] ->
- CCode= int_get_c_code(Dst, Ms, hipe_rtl:mk_imm(Size),
- Flags, TrueLblName, FalseLblName),
+ CCode = int_get_c_code(Dst, Ms, hipe_rtl:mk_imm(Size),
+ Flags, TrueLblName, FalseLblName),
update_ms(NewMs, Ms) ++
get_static_int(Dst, Ms, Size, CCode,
Signed, LittleEndian, Aligned, UnSafe,
TrueLblName, FalseLblName);
[Ms, Arg] ->
- {SizeCode1, SizeReg1} =
- make_size(Size, Arg, FalseLblName),
+ {SizeCode1, SizeReg1} = make_size(Size, Arg, FalseLblName),
CCode = int_get_c_code(Dst, Ms, SizeReg1, Flags,
TrueLblName, FalseLblName),
InCode = get_dynamic_int(Dst, Ms, SizeReg1, CCode,
@@ -140,7 +141,8 @@ gen_rtl({bs_get_integer,Size,Flags}, [Dst,NewMs], Args,
update_ms(NewMs, Ms) ++ SizeCode1 ++ InCode
end
end;
-gen_rtl({bs_get_float,Size,Flags}, [Dst1,NewMs], Args,
+%% ----- bs_get_float -----
+gen_rtl({bs_get_float,Size,Flags}, [Dst1, NewMs], Args,
TrueLblName, FalseLblName) ->
case is_illegal_const(Size) of
true ->
@@ -152,24 +154,26 @@ gen_rtl({bs_get_float,Size,Flags}, [Dst1,NewMs], Args,
CCode = float_get_c_code(Dst1, Ms, hipe_rtl:mk_imm(Size), Flags,
TrueLblName, FalseLblName),
update_ms(NewMs, Ms) ++ CCode;
- [Ms,Arg] ->
- {SizeCode, SizeReg} = make_size(Size, Arg,
- FalseLblName),
+ [Ms, Arg] ->
+ {SizeCode, SizeReg} = make_size(Size, Arg, FalseLblName),
CCode = float_get_c_code(Dst1, Ms, SizeReg, Flags,
TrueLblName, FalseLblName),
update_ms(NewMs, Ms) ++ SizeCode ++ CCode
end
end;
+%% ----- bs_get_binary_all -----
gen_rtl({bs_get_binary_all, Unit, _Flags}, [Dst], [Ms],
TrueLblName, FalseLblName) ->
[hipe_rtl:mk_gctest(?SUB_BIN_WORDSIZE)] ++
get_binary_all(Dst, Unit, Ms, TrueLblName,FalseLblName);
-gen_rtl({bs_get_binary_all_2, Unit, _Flags}, [Dst,NewMs], [Ms],
+%% ----- bs_get_binary_all_2 -----
+gen_rtl({bs_get_binary_all_2, Unit, _Flags}, [Dst, NewMs], [Ms],
TrueLblName, FalseLblName) ->
[hipe_rtl:mk_gctest(?SUB_BIN_WORDSIZE)] ++
update_ms(NewMs, Ms) ++
get_binary_all(Dst, Unit, Ms, TrueLblName, FalseLblName);
-gen_rtl({bs_get_binary,Size,Flags}, [Dst,NewMs], Args,
+%% ----- bs_get_binary -----
+gen_rtl({bs_get_binary, Size, Flags}, [Dst, NewMs], Args,
TrueLblName, FalseLblName) ->
case is_illegal_const(Size) of
true ->
@@ -188,65 +192,78 @@ gen_rtl({bs_get_binary,Size,Flags}, [Dst,NewMs], Args,
[hipe_rtl:mk_gctest(?SUB_BIN_WORDSIZE)] ++
update_ms(NewMs, Ms) ++ SizeCode ++ InCode
end;
-gen_rtl(bs_get_utf8, [Dst,NewMs], [Ms], TrueLblName, FalseLblName) ->
+%% ----- bs_get_utf8 -----
+gen_rtl(bs_get_utf8, [Dst, NewMs], [Ms], TrueLblName, FalseLblName) ->
update_ms(NewMs, Ms) ++ utf8_get_c_code(Dst, Ms, TrueLblName, FalseLblName);
-gen_rtl({bs_get_utf16,Flags}, [Dst,NewMs], [Ms], TrueLblName, FalseLblName) ->
- update_ms(NewMs, Ms) ++ utf16_get_c_code(Flags, Dst, Ms, TrueLblName, FalseLblName);
-gen_rtl(bs_validate_unicode_retract, [NewMs], [Src,Ms], TrueLblName, FalseLblName) ->
- update_ms(NewMs, Ms) ++ validate_unicode_retract_c_code(Src, Ms, TrueLblName, FalseLblName);
+%% ----- bs_get_utf16 -----
+gen_rtl({bs_get_utf16, Flags}, [Dst, NewMs], [Ms], TrueLblName, FalseLblName) ->
+ update_ms(NewMs, Ms) ++
+ utf16_get_c_code(Flags, Dst, Ms, TrueLblName, FalseLblName);
+%% ----- bs_validate_unicode_retract -----
+gen_rtl(bs_validate_unicode_retract, [NewMs], [Src, Ms],
+ TrueLblName, FalseLblName) ->
+ update_ms(NewMs, Ms) ++
+ validate_unicode_retract_c_code(Src, Ms, TrueLblName, FalseLblName);
+%% ----- bs_test_tail -----
gen_rtl({bs_test_tail, NumBits}, [NewMs], [Ms], TrueLblName, FalseLblName) ->
{[Offset,BinSize], ExCode} = extract_matchstate_vars([offset,binsize], Ms),
update_ms(NewMs, Ms) ++ ExCode ++
[add_to_offset(Offset, Offset, hipe_rtl:mk_imm(NumBits), FalseLblName),
hipe_rtl:mk_branch(Offset, eq, BinSize, TrueLblName, FalseLblName)];
+%% ----- bs_test_unit -----
gen_rtl({bs_test_unit, Unit}, [], [Ms], TrueLblName, FalseLblName) ->
- {[Offset,BinSize], ExCode} = extract_matchstate_vars([offset,binsize], Ms),
+ {[Offset, BinSize], ExCode} = extract_matchstate_vars([offset, binsize], Ms),
SizeReg = hipe_rtl:mk_new_reg(),
ExCode ++
[hipe_rtl:mk_alu(SizeReg, BinSize, sub, Offset)|
test_alignment_code(SizeReg, Unit, TrueLblName, FalseLblName)];
gen_rtl({bs_test_tail, NumBits}, [], [Ms], TrueLblName, FalseLblName) ->
- {[Offset,BinSize], ExCode} = extract_matchstate_vars([offset,binsize], Ms),
+ {[Offset, BinSize], ExCode} = extract_matchstate_vars([offset, binsize], Ms),
ExCode ++
[add_to_offset(Offset, Offset, hipe_rtl:mk_imm(NumBits), FalseLblName),
hipe_rtl:mk_branch(Offset, eq, BinSize, TrueLblName, FalseLblName)];
-gen_rtl({bs_skip_bits_all, Unit, _Flags}, Dst, [Ms],
+%% ----- bs_skip_bits_all -----
+gen_rtl({bs_skip_bits_all, Unit, _Flags}, Dst, [Ms],
TrueLblName, FalseLblName) ->
opt_update_ms(Dst, Ms) ++
skip_bits_all(Unit, Ms, TrueLblName, FalseLblName);
+%% ----- bs_skip_bits -----
gen_rtl({bs_skip_bits, Bits}, Dst, [Ms|Args], TrueLblName, FalseLblName) ->
- opt_update_ms(Dst,Ms) ++
- case Args of
- [] ->
- skip_bits2(Ms, hipe_rtl:mk_imm(Bits), TrueLblName, FalseLblName);
- [Arg] ->
- {SizeCode, SizeReg} = make_size(Bits, Arg, FalseLblName),
- InCode = skip_bits2(Ms, SizeReg, TrueLblName, FalseLblName),
- SizeCode ++ InCode
- end;
+ opt_update_ms(Dst, Ms) ++
+ case Args of
+ [] ->
+ skip_bits2(Ms, hipe_rtl:mk_imm(Bits), TrueLblName, FalseLblName);
+ [Arg] ->
+ {SizeCode, SizeReg} = make_size(Bits, Arg, FalseLblName),
+ InCode = skip_bits2(Ms, SizeReg, TrueLblName, FalseLblName),
+ SizeCode ++ InCode
+ end;
+%% ----- bs_restore -----
gen_rtl({bs_restore, Slot}, [NewMs], [Ms], TrueLblName, _FalseLblName) ->
Tmp1 = hipe_rtl:mk_new_reg_gcsafe(),
update_ms(NewMs, Ms) ++
[get_field_from_term({matchstate, {saveoffset, Slot}}, Ms, Tmp1),
set_field_from_term({matchstate, {matchbuffer, offset}}, Ms, Tmp1),
hipe_rtl:mk_goto(TrueLblName)];
+%% ----- bs_save -----
gen_rtl({bs_save, Slot}, [NewMs], [Ms], TrueLblName, _FalseLblName) ->
{Offset, Instr} = extract_matchstate_var(offset, Ms),
update_ms(NewMs, Ms) ++
[Instr,
set_field_from_term({matchstate, {saveoffset, Slot}}, Ms, Offset),
hipe_rtl:mk_goto(TrueLblName)];
-gen_rtl({bs_match_string, String, ByteSize}, [NewMs],
- [Ms], TrueLblName, FalseLblName) ->
+%% ----- bs_match_string -----
+gen_rtl({bs_match_string, String, ByteSize}, Dst, [Ms],
+ TrueLblName, FalseLblName) ->
{[Offset, BinSize, Base], Instrs} =
extract_matchstate_vars([offset, binsize, base], Ms),
[SuccessLbl, ALbl, ULbl] = create_lbls(3),
- [NewOffset,BitOffset] = create_gcsafe_regs(2),
+ [NewOffset, BitOffset] = create_gcsafe_regs(2),
Unit = hipe_rtl_arch:word_size() - 1,
Loops = ByteSize div Unit,
Init =
[Instrs,
- update_ms(NewMs,Ms),
+ opt_update_ms(Dst, Ms),
check_size(Offset, hipe_rtl:mk_imm(ByteSize*?BYTE_SIZE), BinSize,
NewOffset, hipe_rtl:label_name(SuccessLbl), FalseLblName),
SuccessLbl],
@@ -255,10 +272,10 @@ gen_rtl({bs_match_string, String, ByteSize}, [NewMs],
hipe_rtl:label_name(ALbl), hipe_rtl:label_name(ULbl))],
Loops = ByteSize div Unit,
SkipSize = Loops * Unit,
- {ACode1,UCode1} =
+ {ACode1, UCode1} =
case Loops of
0 ->
- {[],[]};
+ {[], []};
_ ->
create_loops(Loops, Unit, String, Base,
Offset, BitOffset, FalseLblName)
@@ -267,12 +284,17 @@ gen_rtl({bs_match_string, String, ByteSize}, [NewMs],
{ACode2, UCode2} =
case ByteSize rem Unit of
0 ->
- {[],[]};
+ {[], []};
Rem ->
create_rests(Rem, RestString, Base, Offset, BitOffset, FalseLblName)
end,
- End = [update_offset(NewOffset, NewMs), hipe_rtl:mk_goto(TrueLblName)],
- [Init, SplitCode, ALbl, ACode1, ACode2, End, ULbl, UCode1, UCode2,End];
+ GoTo = hipe_rtl:mk_goto(TrueLblName),
+ End = case Dst of
+ [] -> [GoTo];
+ [NewMs] -> [update_offset(NewOffset, NewMs), GoTo]
+ end,
+ [Init, SplitCode, ALbl, ACode1, ACode2, End, ULbl, UCode1, UCode2, End];
+%% ----- bs_context_to_binary -----
gen_rtl(bs_context_to_binary, [Bin], [Var], TrueLblName, _FalseLblName) ->
MSLabel = hipe_rtl:mk_new_label(),
[hipe_rtl:mk_move(Bin, Var),
@@ -304,9 +326,7 @@ get_c_code(Func, Dst1, Ms, Size, Flags, TrueLblName, FalseLblName) ->
hipe_rtl_arch:call_bif([Dst1], Func, [SizeReg, FlagsReg, MatchBuf],
hipe_rtl:label_name(RetLabel), FalseLblName),
RetLabel,
- hipe_rtl:mk_branch(Dst1, eq, NonVal,
- FalseLblName,
- TrueLblName, 0.01)].
+ hipe_rtl:mk_branch(Dst1, eq, NonVal, FalseLblName, TrueLblName, 0.01)].
utf8_get_c_code(Dst, Ms, TrueLblName, FalseLblName) ->
MatchBuf = hipe_rtl:mk_new_reg(),
@@ -330,7 +350,7 @@ validate_unicode_retract_c_code(Src, Ms, TrueLblName, FalseLblName) ->
Tmp = hipe_rtl:mk_new_reg(),
[hipe_tagscheme:extract_matchbuffer(MatchBuf, Ms),
hipe_rtl_arch:call_bif([Tmp], bs_validate_unicode_retract,
- [MatchBuf,Src], [], []),
+ [MatchBuf, Src], [], []),
hipe_rtl:mk_branch(Tmp, eq, Zero, FalseLblName, TrueLblName, 0.01)].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Int Code %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -464,9 +484,9 @@ get_int_from_unaligned_bin(Ms, Size, Dst1, Signed,
{[Base,Offset,BinSize], ExCode} =
extract_matchstate_vars([base,offset,binsize], Ms),
ExCode ++
- [check_size(Offset, hipe_rtl:mk_imm(Size), BinSize, NewOffset,
- UnSafe, hipe_rtl:label_name(SuccessLbl), FalseLblName),
- SuccessLbl] ++
+ [check_size(Offset, hipe_rtl:mk_imm(Size), BinSize, NewOffset,
+ UnSafe, hipe_rtl:label_name(SuccessLbl), FalseLblName),
+ SuccessLbl] ++
[update_offset(NewOffset, Ms)] ++
get_unaligned_int(Dst1, Size, Base, Offset, Shiftr, Type, TrueLblName).
@@ -499,7 +519,7 @@ make_matchstate(Binary, Max, Ms, TrueLblName, FalseLblName) ->
Offset = hipe_rtl:mk_new_reg_gcsafe(),
Lbl = hipe_rtl:mk_new_label(),
[hipe_rtl:mk_gctest(?MS_MIN_SIZE+Max),
- get_binary_bytes(Binary, BinSize, Base, Offset,
+ get_binary_bytes(Binary, BinSize, Base, Offset,
Orig, hipe_rtl:label_name(Lbl), FalseLblName),
Lbl,
hipe_tagscheme:create_matchstate(Max, BinSize, Base, Offset, Orig, Ms),
@@ -551,24 +571,22 @@ get_binary_all(Dst1, Unit, Ms, TrueLblName, FalseLblName) ->
hipe_rtl:mk_goto(TrueLblName)],
ExCode ++ MakeCode.
-get_binary(Dst1, Ms, SizeReg,
- UnSafe, TrueLblName, FalseLblName) ->
+get_binary(Dst1, Ms, SizeReg, UnSafe, TrueLblName, FalseLblName) ->
[SuccessLbl] = create_lbls(1),
[EndOffset] = create_gcsafe_regs(1),
{[Offset,BinSize,Orig], ExCode} =
extract_matchstate_vars([offset,binsize,orig], Ms),
CheckCode =
- [check_size(Offset, SizeReg, BinSize, EndOffset,
- UnSafe, hipe_rtl:label_name(SuccessLbl),
- FalseLblName),
+ [check_size(Offset, SizeReg, BinSize, EndOffset, UnSafe,
+ hipe_rtl:label_name(SuccessLbl), FalseLblName),
SuccessLbl],
MakeCode =
- construct_subbin(Dst1,SizeReg,Offset,Orig)
+ construct_subbin(Dst1, SizeReg, Offset, Orig)
++ [update_offset(EndOffset, Ms),
hipe_rtl:mk_goto(TrueLblName)],
ExCode ++ CheckCode ++ MakeCode.
-construct_subbin(Dst,Size,Offset,Orig) ->
+construct_subbin(Dst, Size, Offset, Orig) ->
[BitOffset, ByteOffset, BitSize, ByteSize] = create_gcsafe_regs(4),
[hipe_rtl:mk_alu(ByteSize, Size, srl, hipe_rtl:mk_imm(?BYTE_SHIFT)),
hipe_rtl:mk_alu(BitSize, Size, 'and', hipe_rtl:mk_imm(?LOW_BITS)),
@@ -579,12 +597,10 @@ construct_subbin(Dst,Size,Offset,Orig) ->
%%%%%%%%%%%%%%%%%%%%%%%%% Skip Bits %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-skip_bits_all(1, Ms, TrueLblName,_FalseLblName) ->
+skip_bits_all(1, Ms, TrueLblName, _FalseLblName) ->
{[BinSize], ExCode} = extract_matchstate_vars([binsize], Ms),
- ExCode ++
- [update_offset(BinSize,Ms),
- hipe_rtl:mk_goto(TrueLblName)];
-skip_bits_all(Unit,Ms, TrueLblName,FalseLblName) ->
+ ExCode ++ [update_offset(BinSize,Ms), hipe_rtl:mk_goto(TrueLblName)];
+skip_bits_all(Unit,Ms, TrueLblName, FalseLblName) ->
[Size] = create_gcsafe_regs(1),
[SuccessLbl] = create_lbls(1),
SLblName = hipe_rtl:label_name(SuccessLbl),
@@ -597,7 +613,7 @@ skip_bits_all(Unit,Ms, TrueLblName,FalseLblName) ->
update_offset(BinSize,Ms),
hipe_rtl:mk_goto(TrueLblName)].
-test_alignment_code(Size,Unit,SLblName,FalseLblName) ->
+test_alignment_code(Size, Unit, SLblName, FalseLblName) ->
case Unit of
1 -> [hipe_rtl:mk_goto(SLblName)];
2 -> get_fast_test_code(Size,1,SLblName,FalseLblName);
@@ -608,13 +624,13 @@ test_alignment_code(Size,Unit,SLblName,FalseLblName) ->
_ -> get_slow_test_code(Size,Unit,SLblName,FalseLblName)
end.
-get_fast_test_code(Size,AndTest,SLblName,FalseLblName) ->
+get_fast_test_code(Size, AndTest, SLblName, FalseLblName) ->
[Tmp] = create_gcsafe_regs(1),
- [hipe_rtl:mk_alub(Tmp,Size,'and',hipe_rtl:mk_imm(AndTest),
- eq,SLblName,FalseLblName)].
+ [hipe_rtl:mk_alub(Tmp, Size, 'and', hipe_rtl:mk_imm(AndTest),
+ 'eq', SLblName, FalseLblName)].
%% This is really slow
-get_slow_test_code(Size,Unit,SLblName,FalseLblName) ->
+get_slow_test_code(Size, Unit, SLblName, FalseLblName) ->
[Tmp] = create_gcsafe_regs(1),
[LoopLbl,Lbl1,Lbl2] = create_lbls(3),
LoopLblName = hipe_rtl:label_name(LoopLbl),
@@ -638,7 +654,7 @@ skip_bits2(Ms, NoOfBits, TrueLblName, FalseLblName) ->
[hipe_rtl:mk_branch(BinSize, 'ltu', NewOffset, FalseLblName,
hipe_rtl:label_name(TempLbl), 0.01),
TempLbl,
- update_offset(NewOffset,Ms),
+ update_offset(NewOffset, Ms),
hipe_rtl:mk_goto(TrueLblName)].
add_to_offset(Result, Extra, Original, FalseLblName) ->
@@ -685,7 +701,7 @@ get_base(Orig,Base) ->
[hipe_tagscheme:test_heap_binary(Orig, hipe_rtl:label_name(HeapLbl),
hipe_rtl:label_name(REFCLbl)),
HeapLbl,
- hipe_rtl:mk_alu(Base, Orig, add, hipe_rtl:mk_imm(?HEAP_BIN_DATA-2)),
+ hipe_rtl:mk_alu(Base, Orig, 'add', hipe_rtl:mk_imm(?HEAP_BIN_DATA-2)),
hipe_rtl:mk_goto(hipe_rtl:label_name(EndLbl)),
REFCLbl,
hipe_rtl:mk_load(Base, Orig, hipe_rtl:mk_imm(?PROC_BIN_BYTES-2)),
@@ -761,8 +777,7 @@ unsafe(Flags) ->
end.
update_offset(NewOffset, Ms) ->
- set_field_from_term({matchstate,{matchbuffer,offset}},
- Ms, NewOffset).
+ set_field_from_term({matchstate, {matchbuffer, offset}}, Ms, NewOffset).
opt_update_ms([NewMs], OldMs) ->
[hipe_rtl:mk_move(NewMs, OldMs)];
@@ -774,7 +789,7 @@ update_ms(NewMs, OldMs) ->
create_lbls(0) ->
[];
-create_lbls(X) when X > 0->
+create_lbls(X) when X > 0 ->
[hipe_rtl:mk_new_label()|create_lbls(X-1)].
make_dyn_prep(SizeReg, CCode) ->
@@ -1101,9 +1116,12 @@ multiply_code(List=[Head|_Tail], Variable, Result, FalseLblName) ->
multiply_code([ShiftSize|Rest], Register, Result, FalseLblName, Tmp1, OldCode) ->
SuccessLbl = hipe_rtl:mk_new_label(),
- Code = OldCode ++ [hipe_rtl:mk_alu(Tmp1, Register, sll, hipe_rtl:mk_imm(ShiftSize)),
- hipe_rtl:mk_alub(Result, Tmp1, 'add', Result, not_overflow, hipe_rtl:label_name(SuccessLbl), FalseLblName, 0.99),
- SuccessLbl],
+ Code =
+ OldCode ++
+ [hipe_rtl:mk_alu(Tmp1, Register, sll, hipe_rtl:mk_imm(ShiftSize)),
+ hipe_rtl:mk_alub(Result, Tmp1, 'add', Result, not_overflow,
+ hipe_rtl:label_name(SuccessLbl), FalseLblName, 0.99),
+ SuccessLbl],
multiply_code(Rest, Register, Result, FalseLblName, Tmp1, Code);
multiply_code([], _Register, _Result, _FalseLblName, _Tmp1, Code) ->
Code.