1
0
mirror of https://github.com/golang/go synced 2024-11-20 08:14:41 -07:00

compilers were inconsistent about

whether no register argument was
REGARG == 0 or REGARG < 0.
use REGARG < 0 because arm needs 0 for R0.

R=ken
OCL=31562
CL=31566
This commit is contained in:
Russ Cox 2009-07-13 19:20:43 -07:00
parent da1da8d07e
commit 9e2f2fcd2e
9 changed files with 30 additions and 28 deletions

View File

@ -923,6 +923,8 @@ cgen(Node *n, Node *nn)
return; return;
} }
o = 0;
if(REGARG >= 0)
o = reg[REGARG]; o = reg[REGARG];
gargs(r, &nod, &nod1); gargs(r, &nod, &nod1);
if(l->addable < INDEXED) { if(l->addable < INDEXED) {
@ -932,7 +934,7 @@ cgen(Node *n, Node *nn)
regfree(&nod); regfree(&nod);
} else } else
gopcode(OFUNC, n->type, Z, l); gopcode(OFUNC, n->type, Z, l);
if(REGARG) if(REGARG >= 0)
if(o != reg[REGARG]) if(o != reg[REGARG])
reg[REGARG]--; reg[REGARG]--;
if(nn != Z) { if(nn != Z) {

View File

@ -799,7 +799,7 @@ copyu(Prog *p, Adr *v, Adr *s)
case ACALL: /* funny */ case ACALL: /* funny */
if(REGEXT && v->type <= REGEXT && v->type > exregoffset) if(REGEXT && v->type <= REGEXT && v->type > exregoffset)
return 2; return 2;
if(REGARG && v->type == REGARG) if(REGARG >= 0 && v->type == REGARG)
return 2; return 2;
if(s != A) { if(s != A) {
@ -812,7 +812,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3; return 3;
case ATEXT: /* funny */ case ATEXT: /* funny */
if(REGARG && v->type == REGARG) if(REGARG >= 0 && v->type == REGARG)
return 3; return 3;
return 0; return 0;
} }

View File

@ -247,7 +247,7 @@ garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
sugen(n, tn2, n->type->width); sugen(n, tn2, n->type->width);
return; return;
} }
if(REGARG && curarg == 0 && typechlpv[n->type->etype]) { if(REGARG >= 0 && curarg == 0 && typechlpv[n->type->etype]) {
regaalloc1(tn1, n); regaalloc1(tn1, n);
if(n->complex >= FNX) { if(n->complex >= FNX) {
cgen(*fnxp, tn1); cgen(*fnxp, tn1);
@ -437,8 +437,8 @@ regsalloc(Node *n, Node *nn)
void void
regaalloc1(Node *n, Node *nn) regaalloc1(Node *n, Node *nn)
{ {
if(REGARG == 0) if(REGARG < 0)
diag(n, "regaalloc1 and REGARG==0"); diag(n, "regaalloc1 and REGARG<0");
nodreg(n, nn, REGARG); nodreg(n, nn, REGARG);
reg[REGARG]++; reg[REGARG]++;
curarg = align(curarg, nn->type, Aarg1); curarg = align(curarg, nn->type, Aarg1);

View File

@ -832,7 +832,7 @@ enum
T_SCONST = 1<<5, T_SCONST = 1<<5,
T_64 = 1<<6, T_64 = 1<<6,
REGARG = 0, REGARG = -1,
REGRET = D_AX, REGRET = D_AX,
FREGRET = D_X0, FREGRET = D_X0,
REGSP = D_SP, REGSP = D_SP,

View File

@ -925,7 +925,7 @@ cgen(Node *n, Node *nn)
regfree(&nod); regfree(&nod);
} else } else
gopcode(OFUNC, n->type, Z, l); gopcode(OFUNC, n->type, Z, l);
if(REGARG && reg[REGARG]) if(REGARG >= 0 && reg[REGARG])
reg[REGARG]--; reg[REGARG]--;
if(nn != Z) { if(nn != Z) {
regret(&nod, n); regret(&nod, n);

View File

@ -713,7 +713,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3; return 3;
case ACALL: /* funny */ case ACALL: /* funny */
if(REGARG && v->type == REGARG) if(REGARG >= 0 && v->type == REGARG)
return 2; return 2;
if(s != A) { if(s != A) {

View File

@ -233,7 +233,7 @@ garg1(Node *n, Node *tn1, Node *tn2, int f, Node **fnxp)
sugen(n, tn2, n->type->width); sugen(n, tn2, n->type->width);
return; return;
} }
if(REGARG && curarg == 0 && typeilp[n->type->etype]) { if(REGARG >= 0 && curarg == 0 && typeilp[n->type->etype]) {
regaalloc1(tn1, n); regaalloc1(tn1, n);
if(n->complex >= FNX) { if(n->complex >= FNX) {
cgen(*fnxp, tn1); cgen(*fnxp, tn1);

View File

@ -460,7 +460,7 @@ enum
T_SCONST = 1<<5, T_SCONST = 1<<5,
T_OFFSET2 = 1<<6, T_OFFSET2 = 1<<6,
REGARG = 0, REGARG = -1,
REGRET = D_AX, REGRET = D_AX,
FREGRET = D_F0, FREGRET = D_F0,
REGSP = D_SP, REGSP = D_SP,

View File

@ -83,7 +83,7 @@ codgen(Node *n, Node *nn)
/* /*
* isolate first argument * isolate first argument
*/ */
if(REGARG) { if(REGARG >= 0) {
if(typesuv[thisfn->link->etype]) { if(typesuv[thisfn->link->etype]) {
nod1 = *nodret->left; nod1 = *nodret->left;
nodreg(&nod, &nod1, REGARG); nodreg(&nod, &nod1, REGARG);