diff options
author | Björn Gustavsson <[email protected]> | 2016-06-15 11:51:09 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-06-15 11:51:09 +0200 |
commit | e1c29ff08596af72736d68c778398d7f423669d3 (patch) | |
tree | 93ae8e8d82a7efdfd68bd34f716ce1ed14bd3444 /lib/hipe/cerl/cerl_pmatch.erl | |
parent | 6739b802822b3ba750499b9dc6ac390932d75049 (diff) | |
parent | 34c83a54c3ef6c1a5e2657d4fa3f91622e9b58aa (diff) | |
download | otp-e1c29ff08596af72736d68c778398d7f423669d3.tar.gz otp-e1c29ff08596af72736d68c778398d7f423669d3.tar.bz2 otp-e1c29ff08596af72736d68c778398d7f423669d3.zip |
Merge branch 'kostis/hipe/cerl_pmatch/PR-1102'
* kostis/hipe/cerl_pmatch/PR-1102:
hipe: Pattern matching compilation of binaries and bistrings
Diffstat (limited to 'lib/hipe/cerl/cerl_pmatch.erl')
-rw-r--r-- | lib/hipe/cerl/cerl_pmatch.erl | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/hipe/cerl/cerl_pmatch.erl b/lib/hipe/cerl/cerl_pmatch.erl index 594f2bf81c..ca27fff1dd 100644 --- a/lib/hipe/cerl/cerl_pmatch.erl +++ b/lib/hipe/cerl/cerl_pmatch.erl @@ -231,12 +231,9 @@ match_typegroup(T, V, Vs, Gs, Else, Env) -> Else, Env), typetest_clause(T, V, Body, Env). -match_congroup({?binary_id, Segs}, Vs, Cs, _Else, Env) -> - Ref = get_unique(), - Guard = cerl:c_primop(cerl:c_atom(set_label), [cerl:c_int(Ref)]), - NewElse = cerl:c_primop(cerl:c_atom(goto_label), [cerl:c_int(Ref)]), - Body = match(Vs, Cs, NewElse, Env), - cerl:c_clause([make_pat(?binary_id, Segs)], Guard, Body); +match_congroup({?binary_id, Segs}, Vs, Cs, Else, Env) -> + Body = match(Vs, Cs, Else, Env), + cerl:c_clause([make_pat(?binary_id, Segs)], Body); match_congroup({D, A}, Vs, Cs, Else, Env) -> Vs1 = new_vars(A, Env), @@ -415,6 +412,15 @@ make_let(Vs, A, B) -> expr(E, Env) -> case cerl:type(E) of + binary -> + Es = expr_list(cerl:binary_segments(E), Env), + cerl:update_c_binary(E, Es); + bitstr -> + V = expr(cerl:bitstr_val(E), Env), + Sz = expr(cerl:bitstr_size(E), Env), + Unit = expr(cerl:bitstr_unit(E), Env), + Type = expr(cerl:bitstr_type(E), Env), + cerl:update_c_bitstr(E, V, Sz, Unit, Type, cerl:bitstr_flags(E)); literal -> E; var -> @@ -584,16 +590,6 @@ is_simple(E) -> end. -get_unique() -> - case get(unique_label) of - undefined -> - put(unique_label, 1), - 0; - N -> - put(unique_label, N+1), - N - end. - %% --------------------------------------------------------------------- %% Abstract datatype: environment() |