Commit 9e2f2fcd authored by Russ Cox's avatar Russ Cox

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
parent da1da8d0
......@@ -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) {
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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,
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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,
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment