]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/5l, cmd/6l, cmd/8l: accept CALL reg, reg
authorRuss Cox <rsc@golang.org>
Fri, 22 Feb 2013 19:23:21 +0000 (14:23 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 22 Feb 2013 19:23:21 +0000 (14:23 -0500)
The new src argument is ignored during linking
(that is, CALL r1, r2 is identical to CALL r2 for linking),
but it serves as a hint to the 5g/6g/8g optimizer
that the src register is live on entry to the called
function and must be preserved.

It is possible to avoid exposing this fact to the rest of
the toolchain, keeping it entirely within 5g/6g/8g,
but I think it will help to be able to look in object files
and assembly listings and linker -a / -W output to
see CALL instructions are "Go func value" calls and
which are "C function pointer" calls.

R=ken2
CC=golang-dev
https://golang.org/cl/7364045

src/cmd/5l/optab.c
src/cmd/6l/optab.c
src/cmd/8l/optab.c

index 1e93a3113bdcde08d55f7cc9e35cabb639fff7f6..231071f20913f8290d4feb1f58448c385cc06f27 100644 (file)
@@ -63,6 +63,7 @@ Optab optab[] =
 
        { AB,           C_NONE, C_NONE, C_ROREG,         6, 4, 0,       LPOOL },
        { ABL,          C_NONE, C_NONE, C_ROREG,         7, 8, 0 },
+       { ABL,          C_REG,  C_NONE, C_ROREG,         7, 8, 0 },
        { ABX,          C_NONE, C_NONE, C_ROREG,         75, 12, 0 },
        { ABXRET,       C_NONE, C_NONE, C_ROREG,         76, 4, 0 },
 
index 43f34d9747ca6e41594749d5d80ddd106860c091..21b4784353fe4dd7966ff21ea7e0045dc38d942c 100644 (file)
@@ -326,7 +326,8 @@ uchar       yloop[] =
 };
 uchar  ycall[] =
 {
-       Ynone,  Yml,    Zo_m64, 2,
+       Ynone,  Yml,    Zo_m64, 0,
+       Yrx,    Yrx,    Zo_m64, 2,
        Ynone,  Ybr,    Zcall,  1,
        0
 };
index ae808ec77037d11ec8ab796bd6e7c262186b38ee..3ccdbfd22605949d553a43c752158899aded4f41 100644 (file)
@@ -266,7 +266,8 @@ uchar       yloop[] =
 };
 uchar  ycall[] =
 {
-       Ynone,  Yml,    Zo_m,   2,
+       Ynone,  Yml,    Zo_m,   0,
+       Yrx,    Yrx,    Zo_m,   2,
        Ynone,  Ycol,   Zcallind,       2,
        Ynone,  Ybr,    Zcall,  0,
        Ynone,  Yi32,   Zcallcon,       1,