aboutsummaryrefslogtreecommitdiff
path: root/src/liblink
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-01-29 23:50:10 -0500
committerRuss Cox <rsc@golang.org>2015-02-11 20:36:27 +0000
commiteb1774fa19d1027a8c25a5030429bb162dace95d (patch)
treecddd95b85d74ac1d21c785384822527d9aca2b51 /src/liblink
parent81a3f291f0721fee5dee6cd012cfdc7e4ee41a04 (diff)
downloadgo-eb1774fa19d1027a8c25a5030429bb162dace95d.tar.xz
cmd/gc: factor newly-portable code into gc directory
This isn't everything, but it's a start. Still producing bit-identical compiler output. The semantics of the old back ends is preserved, even when they are probably buggy. There are some TODOs in gc/gsubr.c to remove special cases to preserve bugs in 5g and 8g. Change-Id: I28ae295fbfc94ef9df43e13ab96bd6fc2f194bc4 Reviewed-on: https://go-review.googlesource.com/3802 Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/liblink')
-rw-r--r--src/liblink/asm5.c9
-rw-r--r--src/liblink/go.c21
-rw-r--r--src/liblink/obj5.c10
-rw-r--r--src/liblink/obj6.c12
4 files changed, 23 insertions, 29 deletions
diff --git a/src/liblink/asm5.c b/src/liblink/asm5.c
index 3947a571e5..398b7841c2 100644
--- a/src/liblink/asm5.c
+++ b/src/liblink/asm5.c
@@ -96,6 +96,7 @@ static Optab optab[] =
{ ABL, C_NONE, C_NONE, C_SBRA, 5, 4, 0 },
{ ABX, C_NONE, C_NONE, C_SBRA, 74, 20, 0 },
{ ABEQ, C_NONE, C_NONE, C_SBRA, 5, 4, 0 },
+ { ABEQ, C_RCON, C_NONE, C_SBRA, 5, 4, 0 }, // prediction hinted form, hint ignored
{ AB, C_NONE, C_NONE, C_ROREG, 6, 4, 0, LPOOL },
{ ABL, C_NONE, C_NONE, C_ROREG, 7, 4, 0 },
@@ -353,14 +354,6 @@ static uchar xcmp[C_GOK+1][C_GOK+1];
static LSym *deferreturn;
-static void
-nocache(Prog *p)
-{
- p->optab = 0;
- p->from.class = 0;
- p->to.class = 0;
-}
-
/* size of a case statement including jump table */
static int32
casesz(Link *ctxt, Prog *p)
diff --git a/src/liblink/go.c b/src/liblink/go.c
index 754a7cc15e..08ce82b30c 100644
--- a/src/liblink/go.c
+++ b/src/liblink/go.c
@@ -133,3 +133,24 @@ double2ieee(uint64 *ieee, float64 f)
{
memmove(ieee, &f, 8);
}
+
+void
+nopout(Prog *p)
+{
+ p->as = ANOP;
+ p->scond = zprog.scond;
+ p->from = zprog.from;
+ p->from3 = zprog.from3;
+ p->reg = zprog.reg;
+ p->to = zprog.to;
+}
+
+void
+nocache(Prog *p)
+{
+ p->optab = 0;
+ p->from.class = 0;
+ p->from3.class = 0;
+ p->to.class = 0;
+}
+
diff --git a/src/liblink/obj5.c b/src/liblink/obj5.c
index 805d7a59c2..abddbc3c4f 100644
--- a/src/liblink/obj5.c
+++ b/src/liblink/obj5.c
@@ -185,14 +185,6 @@ linkcase(Prog *casep)
}
static void
-nocache5(Prog *p)
-{
- p->optab = 0;
- p->from.class = 0;
- p->to.class = 0;
-}
-
-static void
preprocess(Link *ctxt, LSym *cursym)
{
Prog *p, *pl, *p1, *p2, *q, *q1, *q2;
@@ -478,7 +470,7 @@ preprocess(Link *ctxt, LSym *cursym)
break;
case ARET:
- nocache5(p);
+ nocache(p);
if(cursym->text->mark & LEAF) {
if(!autosize) {
p->as = AB;
diff --git a/src/liblink/obj6.c b/src/liblink/obj6.c
index cddc723bf2..546c89d53c 100644
--- a/src/liblink/obj6.c
+++ b/src/liblink/obj6.c
@@ -35,18 +35,6 @@
#include "../cmd/6l/6.out.h"
#include "../runtime/stack.h"
-static void
-nopout(Prog *p)
-{
- p->as = ANOP;
- p->from.type = TYPE_NONE;
- p->from.reg = 0;
- p->from.name = 0;
- p->to.type = TYPE_NONE;
- p->to.reg = 0;
- p->to.name = 0;
-}
-
static void nacladdr(Link*, Prog*, Addr*);
static int