summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/8a/a.y7
-rw-r--r--utils/8c/list.c6
-rw-r--r--utils/8c/peep.c8
-rw-r--r--utils/8c/reg.c2
-rw-r--r--utils/8l/l.h1
-rw-r--r--utils/8l/span.c2
-rw-r--r--utils/NOTICE5
-rw-r--r--utils/cc/macbody46
-rw-r--r--utils/kc/cgen.c2
-rw-r--r--utils/kl/asm.c5
10 files changed, 71 insertions, 13 deletions
diff --git a/utils/8a/a.y b/utils/8a/a.y
index 167234b4..631344d3 100644
--- a/utils/8a/a.y
+++ b/utils/8a/a.y
@@ -236,6 +236,7 @@ rom:
}
| reg
| omem
+| imm
rim:
rem
@@ -386,6 +387,12 @@ omem:
$$ = nullgen;
$$.type = D_INDIR+D_SP;
}
+| con '(' LSREG ')'
+ {
+ $$ = nullgen;
+ $$.type = D_INDIR+$3;
+ $$.offset = $1;
+ }
| '(' LLREG '*' con ')'
{
$$ = nullgen;
diff --git a/utils/8c/list.c b/utils/8c/list.c
index 8ee83383..84466942 100644
--- a/utils/8c/list.c
+++ b/utils/8c/list.c
@@ -70,7 +70,7 @@ Aconv(Fmt *fp)
int
Dconv(Fmt *fp)
{
- char str[40], s[20];
+ char str[STRINGSZ], s[STRINGSZ];
Adr *a;
int i;
@@ -224,7 +224,7 @@ char* regstr[] =
int
Rconv(Fmt *fp)
{
- char str[20];
+ char str[STRINGSZ];
int r;
r = va_arg(fp->args, int);
@@ -240,7 +240,7 @@ int
Sconv(Fmt *fp)
{
int i, c;
- char str[30], *p, *a;
+ char str[STRINGSZ], *p, *a;
a = va_arg(fp->args, char*);
p = str;
diff --git a/utils/8c/peep.c b/utils/8c/peep.c
index ed3e6b78..3d98b771 100644
--- a/utils/8c/peep.c
+++ b/utils/8c/peep.c
@@ -639,10 +639,14 @@ copyu(Prog *p, Adr *v, Adr *s)
return 2;
goto caseread;
- case AMOVSL:
case AREP:
case AREPN:
- if(v->type == D_CX || v->type == D_DI || v->type == D_SI)
+ if(v->type == D_CX)
+ return 2;
+ goto caseread;
+
+ case AMOVSL:
+ if(v->type == D_DI || v->type == D_SI)
return 2;
goto caseread;
diff --git a/utils/8c/reg.c b/utils/8c/reg.c
index 12ad50ab..fe84f573 100644
--- a/utils/8c/reg.c
+++ b/utils/8c/reg.c
@@ -224,7 +224,9 @@ regopt(Prog *p)
*/
case AFMOVDP:
case AFMOVFP:
+ case AFMOVLP:
case AFMOVVP:
+ case AFMOVWP:
case ACALL:
for(z=0; z<BITS; z++)
addrs.b[z] |= bit.b[z];
diff --git a/utils/8l/l.h b/utils/8l/l.h
index 3affb6ae..e3be6b17 100644
--- a/utils/8l/l.h
+++ b/utils/8l/l.h
@@ -346,3 +346,4 @@ void zerosig(char*);
#pragma varargck type "P" Prog*
#pragma varargck type "R" int
#pragma varargck type "A" int
+#pragma varargck argpos diag 1
diff --git a/utils/8l/span.c b/utils/8l/span.c
index 0adecbb7..67ec929b 100644
--- a/utils/8l/span.c
+++ b/utils/8l/span.c
@@ -334,6 +334,8 @@ oclass(Adr *a)
return Yax;
case D_CL:
+ return Ycl;
+
case D_DL:
case D_BL:
case D_AH:
diff --git a/utils/NOTICE b/utils/NOTICE
index 7ffa9708..b36c8093 100644
--- a/utils/NOTICE
+++ b/utils/NOTICE
@@ -9,10 +9,11 @@ file such as NOTICE, LICENCE or COPYING.
Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
Portions Copyright © 1997-1999 Vita Nuova Limited
- Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com)
+ Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuova.com)
Portions Copyright © 2004,2006 Bruce Ellis
Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
- Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others
+ Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others
+ Portions Copyright © 2009 The Go Authors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/utils/cc/macbody b/utils/cc/macbody
index 91181875..e26dc427 100644
--- a/utils/cc/macbody
+++ b/utils/cc/macbody
@@ -1,3 +1,4 @@
+#define VARMAC 0x80
long
getnsn(void)
@@ -43,6 +44,27 @@ getsym(void)
return lookup();
}
+Sym*
+getsymdots(int *dots)
+{
+ int c;
+ Sym *s;
+
+ s = getsym();
+ if(s != S)
+ return s;
+
+ c = getnsc();
+ if(c != '.'){
+ unget(c);
+ return S;
+ }
+ if(getc() != '.' || getc() != '.')
+ yyerror("bad dots in macro");
+ *dots = 1;
+ return slookup("__VA_ARGS__");
+}
+
int
getcom(void)
{
@@ -172,7 +194,7 @@ macdef(void)
{
Sym *s, *a;
char *args[NARG], *np, *base;
- int n, i, c, len;
+ int n, i, c, len, dots;
int ischr;
s = getsym();
@@ -182,13 +204,14 @@ macdef(void)
yyerror("macro redefined: %s", s->name);
c = getc();
n = -1;
+ dots = 0;
if(c == '(') {
n++;
c = getnsc();
if(c != ')') {
unget(c);
for(;;) {
- a = getsym();
+ a = getsymdots(&dots);
if(a == S)
goto bad;
if(n >= NARG) {
@@ -199,7 +222,7 @@ macdef(void)
c = getnsc();
if(c == ')')
break;
- if(c != ',')
+ if(c != ',' || dots)
goto bad;
}
}
@@ -325,6 +348,8 @@ macdef(void)
} while(len & 3);
*base = n+1;
+ if(dots)
+ *base |= VARMAC;
s->macro = base;
if(debug['m'])
print("#define %s %s\n", s->name, s->macro+1);
@@ -343,16 +368,19 @@ macexpand(Sym *s, char *b)
{
char buf[2000];
int n, l, c, nargs;
- char *arg[NARG], *cp, *ob, *ecp;
+ char *arg[NARG], *cp, *ob, *ecp, dots;
ob = b;
- nargs = *s->macro - 1;
- if(nargs < 0) {
+ if(*s->macro == 0) {
strcpy(b, s->macro+1);
if(debug['m'])
print("#expand %s %s\n", s->name, ob);
return;
}
+
+ nargs = (char)(*s->macro & ~VARMAC) - 1;
+ dots = *s->macro & VARMAC;
+
c = getnsc();
if(c != '(')
goto bad;
@@ -425,6 +453,10 @@ macexpand(Sym *s, char *b)
}
if(l == 0) {
if(c == ',') {
+ if(n == nargs && dots) {
+ *cp++ = ',';
+ continue;
+ }
*cp++ = 0;
arg[n++] = cp;
if(n > nargs)
@@ -452,6 +484,8 @@ macexpand(Sym *s, char *b)
cp = s->macro+1;
for(;;) {
c = *cp++;
+ if(c == '\n')
+ c = ' ';
if(c != '#') {
*b++ = c;
if(c == 0)
diff --git a/utils/kc/cgen.c b/utils/kc/cgen.c
index e4e54d48..a6b5771c 100644
--- a/utils/kc/cgen.c
+++ b/utils/kc/cgen.c
@@ -493,6 +493,8 @@ cgen(Node *n, Node *nn)
} else
gopcode(OADD, nodconst(v), Z, &nod);
gopcode(OAS, &nod, Z, &nod2);
+ if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */
+ gins(ANOP, l, Z);
regfree(&nod);
if(l->addable < INDEXED)
diff --git a/utils/kl/asm.c b/utils/kl/asm.c
index dde73d6d..62fe60b7 100644
--- a/utils/kl/asm.c
+++ b/utils/kl/asm.c
@@ -1001,6 +1001,11 @@ asmout(Prog *p, Optab *o, int aflag)
}
}
break;
+
+ case 57: /* op r1,r2 with reserved rs1 */
+ r = 0;
+ o1 = OP_RRR(opcode(p->as), p->from.reg, r, p->to.reg);
+ break;
}
if(aflag)
return o1;