aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/icode/hipe_beam_to_icode.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-09-11 14:34:56 +0200
committerBjörn-Egil Dahlberg <[email protected]>2017-03-24 10:53:14 +0100
commit27e3f9b56c0cdfcd5d04aa4d91cbe774eae6854c (patch)
treef20f293e8ce9e3482c099414ec1d21efffacf694 /lib/hipe/icode/hipe_beam_to_icode.erl
parent14d709b0e07e899161a40bb43fc43fd6916f59ab (diff)
downloadotp-27e3f9b56c0cdfcd5d04aa4d91cbe774eae6854c.tar.gz
otp-27e3f9b56c0cdfcd5d04aa4d91cbe774eae6854c.tar.bz2
otp-27e3f9b56c0cdfcd5d04aa4d91cbe774eae6854c.zip
hipe: Transform is_tagged_tuple instruction
Diffstat (limited to 'lib/hipe/icode/hipe_beam_to_icode.erl')
-rw-r--r--lib/hipe/icode/hipe_beam_to_icode.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_beam_to_icode.erl b/lib/hipe/icode/hipe_beam_to_icode.erl
index 610578dfbc..2abecf7f18 100644
--- a/lib/hipe/icode/hipe_beam_to_icode.erl
+++ b/lib/hipe/icode/hipe_beam_to_icode.erl
@@ -513,6 +513,19 @@ trans_fun([{test,test_arity,{f,Lbl},[Reg,N]}|Instructions], Env) ->
I = hipe_icode:mk_type([trans_arg(Reg)],{tuple,N},
hipe_icode:label_name(True),map_label(Lbl)),
[I,True | trans_fun(Instructions,Env)];
+%%--- test_is_tagged_tuple ---
+trans_fun([{test,is_tagged_tuple,{f,Lbl},[Reg,N,Atom]}|Instructions], Env) ->
+ TrueArity = mk_label(new),
+ IArity = hipe_icode:mk_type([trans_arg(Reg)],{tuple,N},
+ hipe_icode:label_name(TrueArity),map_label(Lbl)),
+ Var = hipe_icode:mk_new_var(),
+ IGet = hipe_icode:mk_primop([Var],
+ #unsafe_element{index=1},
+ [trans_arg(Reg)]),
+ TrueAtom = mk_label(new),
+ IEQ = hipe_icode:mk_type([Var], Atom, hipe_icode:label_name(TrueAtom),
+ map_label(Lbl)),
+ [IArity,TrueArity,IGet,IEQ,TrueAtom | trans_fun(Instructions,Env)];
%%--- is_map ---
trans_fun([{test,is_map,{f,Lbl},[Arg]}|Instructions], Env) ->
{Code,Env1} = trans_type_test(map,Lbl,Arg,Env),