aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-05-22 11:28:19 +0200
committerGitHub <[email protected]>2019-05-22 11:28:19 +0200
commit48e1cc6a6f7bebacd5fb060bfd65ececbabfa6a1 (patch)
tree833fa41fe780cf9a5b9f03f5d64143e115d46b36 /lib/hipe
parent13833d876d103c03df4967e1fb249cdb8d30bc0b (diff)
parent18dc9a8099d1ad8f52b9db7bd251bcbfd632ce5e (diff)
downloadotp-48e1cc6a6f7bebacd5fb060bfd65ececbabfa6a1.tar.gz
otp-48e1cc6a6f7bebacd5fb060bfd65ececbabfa6a1.tar.bz2
otp-48e1cc6a6f7bebacd5fb060bfd65ececbabfa6a1.zip
Merge pull request #2242 from bjorng/bjorn/add-swap-instruction
Make the swap instruction known to the compiler
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/icode/hipe_beam_to_icode.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/hipe/icode/hipe_beam_to_icode.erl b/lib/hipe/icode/hipe_beam_to_icode.erl
index 8e7e56b6c4..42e4ead169 100644
--- a/lib/hipe/icode/hipe_beam_to_icode.erl
+++ b/lib/hipe/icode/hipe_beam_to_icode.erl
@@ -1204,6 +1204,17 @@ trans_fun([{bs_get_position=Name,_,_,_}|_Instructions], _Env) ->
trans_fun([{bs_set_position=Name,_,_}|_Instructions], _Env) ->
nyi(Name);
%%--------------------------------------------------------------------
+%% New instructions added in OTP 23.
+%%--------------------------------------------------------------------
+%%--- swap ---
+trans_fun([{swap,Reg1,Reg2}|Instructions], Env) ->
+ Var1 = mk_var(Reg1),
+ Var2 = mk_var(Reg2),
+ Temp = mk_var(new),
+ [hipe_icode:mk_move(Temp, Var1),
+ hipe_icode:mk_move(Var1, Var2),
+ hipe_icode:mk_move(Var2, Temp) | trans_fun(Instructions, Env)];
+%%--------------------------------------------------------------------
%%--- ERROR HANDLING ---
%%--------------------------------------------------------------------
trans_fun([X|_], _) ->