1
0
mirror of https://github.com/golang/go synced 2024-11-26 09:18:07 -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;
}
o = 0;
if(REGARG >= 0)
o = reg[REGARG];
gargs(r, &nod, &nod1);
if(l->addable < INDEXED) {
@ -932,7 +934,7 @@ cgen(Node *n, Node *nn)
regfree(&nod);
} else
gopcode(OFUNC, n->type, Z, l);
if(REGARG)
if(REGARG >= 0)
if(o != reg[REGARG])
reg[REGARG]--;
if(nn != Z) {

View File

@ -799,7 +799,7 @@ copyu(Prog *p, Adr *v, Adr *s)
case ACALL: /* funny */
if(REGEXT && v->type <= REGEXT && v->type > exregoffset)
return 2;
if(REGARG && v->type == REGARG)
if(REGARG >= 0 && v->type == REGARG)
return 2;
if(s != A) {
@ -812,7 +812,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3;
case ATEXT: /* funny */
if(REGARG && v->type == REGARG)
if(REGARG >= 0 && v->type == REGARG)
return 3;
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);
return;
}
if(REGARG && curarg == 0 && typechlpv[n->type->etype]) {
if(REGARG >= 0 && curarg == 0 && typechlpv[n->type->etype]) {
regaalloc1(tn1, n);
if(n->complex >= FNX) {
cgen(*fnxp, tn1);
@ -437,8 +437,8 @@ regsalloc(Node *n, Node *nn)
void
regaalloc1(Node *n, Node *nn)
{
if(REGARG == 0)
diag(n, "regaalloc1 and REGARG==0");
if(REGARG < 0)
diag(n, "regaalloc1 and REGARG<0");
nodreg(n, nn, REGARG);
reg[REGARG]++;
curarg = align(curarg, nn->type, Aarg1);

View File

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

View File

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

View File

@ -713,7 +713,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3;
case ACALL: /* funny */
if(REGARG && v->type == REGARG)
if(REGARG >= 0 && v->type == REGARG)
return 2;
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);
return;
}
if(REGARG && curarg == 0 && typeilp[n->type->etype]) {
if(REGARG >= 0 && curarg == 0 && typeilp[n->type->etype]) {
regaalloc1(tn1, n);
if(n->complex >= FNX) {
cgen(*fnxp, tn1);

View File

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

View File

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