aboutsummaryrefslogtreecommitdiff
path: root/src/liblink
diff options
context:
space:
mode:
authorAnthony Martin <ality@pbrane.org>2014-01-09 19:01:08 -0800
committerAnthony Martin <ality@pbrane.org>2014-01-09 19:01:08 -0800
commitd155f6a309feea100207cdf707b4bb349851b9e0 (patch)
tree78bb15ea6772692a23278a52799e9266fb6dd4ec /src/liblink
parentf739dae7db61e748c1a23e1fae32274e5431bbd2 (diff)
downloadgo-d155f6a309feea100207cdf707b4bb349851b9e0.tar.xz
liblink: adjust format verbs to avoid collisions
The %S and %N format verbs are used by cmd/gc to represent Sym and Node structures, respectively. In liblink, these two verbs are used only by the %D format routine and never referenced externally. This change will allow us to delete the duplicated code for the %A, %D, %P, and %R format routines in both the compiler and linker. R=golang-codereviews, rsc CC=golang-codereviews https://golang.org/cl/49720043
Diffstat (limited to 'src/liblink')
-rw-r--r--src/liblink/list5.c30
-rw-r--r--src/liblink/list6.c21
-rw-r--r--src/liblink/list8.c8
3 files changed, 36 insertions, 23 deletions
diff --git a/src/liblink/list5.c b/src/liblink/list5.c
index 5a50a9329e..ec954f6461 100644
--- a/src/liblink/list5.c
+++ b/src/liblink/list5.c
@@ -41,18 +41,18 @@ enum
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
-static int Nconv(Fmt *fp);
+static int Mconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
-static int Sconv(Fmt *fp);
+static int DSconv(Fmt *fp);
void
listinit5(void)
{
fmtinstall('A', Aconv);
fmtinstall('P', Pconv);
- fmtinstall('S', Sconv);
- fmtinstall('N', Nconv);
+ fmtinstall('$', DSconv);
+ fmtinstall('M', Mconv);
fmtinstall('D', Dconv);
fmtinstall('R', Rconv);
}
@@ -139,14 +139,14 @@ Dconv(Fmt *fp)
case D_NONE:
str[0] = 0;
if(a->name != D_NONE || a->reg != NREG || a->sym != nil)
- sprint(str, "%N(R%d)(NONE)", a, a->reg);
+ sprint(str, "%M(R%d)(NONE)", a, a->reg);
break;
case D_CONST:
if(a->reg != NREG)
- sprint(str, "$%N(R%d)", a, a->reg);
+ sprint(str, "$%M(R%d)", a, a->reg);
else
- sprint(str, "$%N", a);
+ sprint(str, "$%M", a);
break;
case D_CONST2:
@@ -166,27 +166,27 @@ Dconv(Fmt *fp)
case D_OREG:
if(a->reg != NREG)
- sprint(str, "%N(R%d)", a, a->reg);
+ sprint(str, "%M(R%d)", a, a->reg);
else
- sprint(str, "%N", a);
+ sprint(str, "%M", a);
break;
case D_REG:
sprint(str, "R%d", a->reg);
if(a->name != D_NONE || a->sym != nil)
- sprint(str, "%N(R%d)(REG)", a, a->reg);
+ sprint(str, "%M(R%d)(REG)", a, a->reg);
break;
case D_FREG:
sprint(str, "F%d", a->reg);
if(a->name != D_NONE || a->sym != nil)
- sprint(str, "%N(R%d)(REG)", a, a->reg);
+ sprint(str, "%M(R%d)(REG)", a, a->reg);
break;
case D_PSR:
sprint(str, "PSR");
if(a->name != D_NONE || a->sym != nil)
- sprint(str, "%N(PSR)(REG)", a);
+ sprint(str, "%M(PSR)(REG)", a);
break;
case D_BRANCH:
@@ -203,7 +203,7 @@ Dconv(Fmt *fp)
break;
case D_SCONST:
- sprint(str, "$\"%S\"", a->u.sval);
+ sprint(str, "$\"%$\"", a->u.sval);
break;
}
return fmtstrcpy(fp, str);
@@ -242,7 +242,7 @@ Rconv(Fmt *fp)
}
static int
-Sconv(Fmt *fp)
+DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;
@@ -289,7 +289,7 @@ Sconv(Fmt *fp)
}
static int
-Nconv(Fmt *fp)
+Mconv(Fmt *fp)
{
char str[STRINGSZ];
Addr *a;
diff --git a/src/liblink/list6.c b/src/liblink/list6.c
index c7761949ca..34a877e4ea 100644
--- a/src/liblink/list6.c
+++ b/src/liblink/list6.c
@@ -34,11 +34,24 @@
#include <link.h>
#include "../cmd/6l/6.out.h"
+//
+// Format conversions
+// %A int Opcodes (instruction mnemonics)
+//
+// %D Addr* Addresses (instruction operands)
+// Flags: "%lD": seperate the high and low words of a constant by "-"
+//
+// %P Prog* Instructions
+//
+// %R int Registers
+//
+// %$ char* String constant addresses (for internal use only)
+
static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
-static int Sconv(Fmt *fp);
+static int DSconv(Fmt *fp);
enum
{
@@ -50,7 +63,7 @@ listinit6(void)
{
fmtinstall('A', Aconv);
fmtinstall('P', Pconv);
- fmtinstall('S', Sconv);
+ fmtinstall('$', DSconv);
fmtinstall('D', Dconv);
fmtinstall('R', Rconv);
}
@@ -174,7 +187,7 @@ Dconv(Fmt *fp)
break;
case D_SCONST:
- sprint(str, "$\"%S\"", a->u.sval);
+ sprint(str, "$\"%$\"", a->u.sval);
break;
case D_ADDR:
@@ -337,7 +350,7 @@ Rconv(Fmt *fp)
}
static int
-Sconv(Fmt *fp)
+DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;
diff --git a/src/liblink/list8.c b/src/liblink/list8.c
index cdc97515b8..3d78d781d0 100644
--- a/src/liblink/list8.c
+++ b/src/liblink/list8.c
@@ -38,7 +38,7 @@ static int Aconv(Fmt *fp);
static int Dconv(Fmt *fp);
static int Pconv(Fmt *fp);
static int Rconv(Fmt *fp);
-static int Sconv(Fmt *fp);
+static int DSconv(Fmt *fp);
enum
{
@@ -50,7 +50,7 @@ listinit8(void)
{
fmtinstall('A', Aconv);
fmtinstall('P', Pconv);
- fmtinstall('S', Sconv);
+ fmtinstall('$', DSconv);
fmtinstall('D', Dconv);
fmtinstall('R', Rconv);
}
@@ -181,7 +181,7 @@ Dconv(Fmt *fp)
break;
case D_SCONST:
- sprint(str, "$\"%S\"", a->u.sval);
+ sprint(str, "$\"%$\"", a->u.sval);
break;
case D_ADDR:
@@ -298,7 +298,7 @@ Rconv(Fmt *fp)
}
static int
-Sconv(Fmt *fp)
+DSconv(Fmt *fp)
{
int i, c;
char str[STRINGSZ], *p, *a;