aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/genop.tab
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-05-14 10:11:31 +0200
committerBjörn Gustavsson <[email protected]>2019-05-22 10:47:22 +0200
commit18dc9a8099d1ad8f52b9db7bd251bcbfd632ce5e (patch)
treecb7d2a6d3620c53cc098a2cb863bd3adf9427d0c /lib/compiler/src/genop.tab
parentfe2b1323a3866ed0a9712e9d12e1f8f84793ec47 (diff)
downloadotp-18dc9a8099d1ad8f52b9db7bd251bcbfd632ce5e.tar.gz
otp-18dc9a8099d1ad8f52b9db7bd251bcbfd632ce5e.tar.bz2
otp-18dc9a8099d1ad8f52b9db7bd251bcbfd632ce5e.zip
Make the swap instruction known to the compiler
BEAM has had a `swap` instruction for several releases, but it was not known to the compiler. The loader would translate a sequence of three `move` instructions to the `swap` instructions, but only when it was possible to determine that it would be safe. By making `swap` known to the compiler, it can be applied in more situations since it is easier for the compiler than for the loader to ensure that the usage is safe, and the loader shenanigans can be eliminated.
Diffstat (limited to 'lib/compiler/src/genop.tab')
-rwxr-xr-xlib/compiler/src/genop.tab4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/compiler/src/genop.tab b/lib/compiler/src/genop.tab
index 86590fad87..03507bafb3 100755
--- a/lib/compiler/src/genop.tab
+++ b/lib/compiler/src/genop.tab
@@ -596,3 +596,7 @@ BEAM_FORMAT_NUMBER=0
## @spec bs_set_positon Ctx Pos
## @doc Sets the current position of Ctx to Pos
168: bs_set_position/2
+
+## @spec swap Register1 Register2
+## @doc Swaps the contents of two registers.
+169: swap/2