aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-02-01 15:59:02 +0100
committerGitHub <[email protected]>2018-02-01 15:59:02 +0100
commit18d9afbd5c62bb7b7237fe0d580fc05737a096c1 (patch)
treed68c29a4d077ce205982a114d65d738e600ec7ea /lib/hipe
parentbb0b3c7252119604cf3e8c9ba78d20000e06f4ea (diff)
parentfbcff5a137e37edd80aca9c5fe18ce6880648169 (diff)
downloadotp-18d9afbd5c62bb7b7237fe0d580fc05737a096c1.tar.gz
otp-18d9afbd5c62bb7b7237fe0d580fc05737a096c1.tar.bz2
otp-18d9afbd5c62bb7b7237fe0d580fc05737a096c1.zip
Merge pull request #1701 from bjorng/bjorn/get_hd_tl
Eliminate get_list/3 internally in the compiler
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/icode/hipe_beam_to_icode.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_beam_to_icode.erl b/lib/hipe/icode/hipe_beam_to_icode.erl
index 6e66ec057c..f429d40272 100644
--- a/lib/hipe/icode/hipe_beam_to_icode.erl
+++ b/lib/hipe/icode/hipe_beam_to_icode.erl
@@ -605,6 +605,16 @@ trans_fun([{get_list,List,Head,Tail}|Instructions], Env) ->
?error_msg("hd and tl regs identical in get_list~n",[]),
erlang:error(not_handled)
end;
+%%--- get_hd ---
+trans_fun([{get_hd,List,Head}|Instructions], Env) ->
+ TransList = [trans_arg(List)],
+ I = hipe_icode:mk_primop([mk_var(Head)],unsafe_hd,TransList),
+ [I | trans_fun(Instructions,Env)];
+%%--- get_tl ---
+trans_fun([{get_tl,List,Tail}|Instructions], Env) ->
+ TransList = [trans_arg(List)],
+ I = hipe_icode:mk_primop([mk_var(Tail)],unsafe_tl,TransList),
+ [I | trans_fun(Instructions,Env)];
%%--- get_tuple_element ---
trans_fun([{get_tuple_element,Xreg,Index,Dst}|Instructions], Env) ->
I = hipe_icode:mk_primop([mk_var(Dst)],