mirror of
https://github.com/golang/go
synced 2024-11-20 05:54:43 -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:
parent
da1da8d07e
commit
9e2f2fcd2e
@ -923,7 +923,9 @@ cgen(Node *n, Node *nn)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
o = reg[REGARG];
|
o = 0;
|
||||||
|
if(REGARG >= 0)
|
||||||
|
o = reg[REGARG];
|
||||||
gargs(r, &nod, &nod1);
|
gargs(r, &nod, &nod1);
|
||||||
if(l->addable < INDEXED) {
|
if(l->addable < INDEXED) {
|
||||||
reglcgen(&nod, l, nn);
|
reglcgen(&nod, l, nn);
|
||||||
@ -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) {
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
@ -1475,7 +1475,7 @@ gpseudo(int a, Sym *s, Node *n)
|
|||||||
p->from.sym = s;
|
p->from.sym = s;
|
||||||
p->from.scale = textflag;
|
p->from.scale = textflag;
|
||||||
textflag = 0;
|
textflag = 0;
|
||||||
|
|
||||||
if(s->class == CSTATIC)
|
if(s->class == CSTATIC)
|
||||||
p->from.type = D_STATIC;
|
p->from.type = D_STATIC;
|
||||||
naddr(n, &p->to);
|
naddr(n, &p->to);
|
||||||
@ -1513,8 +1513,8 @@ exreg(Type *t)
|
|||||||
|
|
||||||
schar ewidth[NTYPE] =
|
schar ewidth[NTYPE] =
|
||||||
{
|
{
|
||||||
-1, /*[TXXX]*/
|
-1, /*[TXXX]*/
|
||||||
SZ_CHAR, /*[TCHAR]*/
|
SZ_CHAR, /*[TCHAR]*/
|
||||||
SZ_CHAR, /*[TUCHAR]*/
|
SZ_CHAR, /*[TUCHAR]*/
|
||||||
SZ_SHORT, /*[TSHORT]*/
|
SZ_SHORT, /*[TSHORT]*/
|
||||||
SZ_SHORT, /*[TUSHORT]*/
|
SZ_SHORT, /*[TUSHORT]*/
|
||||||
@ -1538,10 +1538,10 @@ int32 ncast[NTYPE] =
|
|||||||
{
|
{
|
||||||
0, /*[TXXX]*/
|
0, /*[TXXX]*/
|
||||||
BCHAR|BUCHAR, /*[TCHAR]*/
|
BCHAR|BUCHAR, /*[TCHAR]*/
|
||||||
BCHAR|BUCHAR, /*[TUCHAR]*/
|
BCHAR|BUCHAR, /*[TUCHAR]*/
|
||||||
BSHORT|BUSHORT, /*[TSHORT]*/
|
BSHORT|BUSHORT, /*[TSHORT]*/
|
||||||
BSHORT|BUSHORT, /*[TUSHORT]*/
|
BSHORT|BUSHORT, /*[TUSHORT]*/
|
||||||
BINT|BUINT|BLONG|BULONG, /*[TINT]*/
|
BINT|BUINT|BLONG|BULONG, /*[TINT]*/
|
||||||
BINT|BUINT|BLONG|BULONG, /*[TUINT]*/
|
BINT|BUINT|BLONG|BULONG, /*[TUINT]*/
|
||||||
BINT|BUINT|BLONG|BULONG, /*[TLONG]*/
|
BINT|BUINT|BLONG|BULONG, /*[TLONG]*/
|
||||||
BINT|BUINT|BLONG|BULONG, /*[TULONG]*/
|
BINT|BUINT|BLONG|BULONG, /*[TULONG]*/
|
||||||
|
@ -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,
|
||||||
|
@ -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);
|
||||||
|
@ -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) {
|
||||||
|
@ -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);
|
||||||
@ -1409,8 +1409,8 @@ exreg(Type *t)
|
|||||||
|
|
||||||
schar ewidth[NTYPE] =
|
schar ewidth[NTYPE] =
|
||||||
{
|
{
|
||||||
-1, /*[TXXX]*/
|
-1, /*[TXXX]*/
|
||||||
SZ_CHAR, /*[TCHAR]*/
|
SZ_CHAR, /*[TCHAR]*/
|
||||||
SZ_CHAR, /*[TUCHAR]*/
|
SZ_CHAR, /*[TUCHAR]*/
|
||||||
SZ_SHORT, /*[TSHORT]*/
|
SZ_SHORT, /*[TSHORT]*/
|
||||||
SZ_SHORT, /*[TUSHORT]*/
|
SZ_SHORT, /*[TUSHORT]*/
|
||||||
@ -1434,10 +1434,10 @@ int32 ncast[NTYPE] =
|
|||||||
{
|
{
|
||||||
0, /*[TXXX]*/
|
0, /*[TXXX]*/
|
||||||
BCHAR|BUCHAR, /*[TCHAR]*/
|
BCHAR|BUCHAR, /*[TCHAR]*/
|
||||||
BCHAR|BUCHAR, /*[TUCHAR]*/
|
BCHAR|BUCHAR, /*[TUCHAR]*/
|
||||||
BSHORT|BUSHORT, /*[TSHORT]*/
|
BSHORT|BUSHORT, /*[TSHORT]*/
|
||||||
BSHORT|BUSHORT, /*[TUSHORT]*/
|
BSHORT|BUSHORT, /*[TUSHORT]*/
|
||||||
BINT|BUINT|BLONG|BULONG|BIND, /*[TINT]*/
|
BINT|BUINT|BLONG|BULONG|BIND, /*[TINT]*/
|
||||||
BINT|BUINT|BLONG|BULONG|BIND, /*[TUINT]*/
|
BINT|BUINT|BLONG|BULONG|BIND, /*[TUINT]*/
|
||||||
BINT|BUINT|BLONG|BULONG|BIND, /*[TLONG]*/
|
BINT|BUINT|BLONG|BULONG|BIND, /*[TLONG]*/
|
||||||
BINT|BUINT|BLONG|BULONG|BIND, /*[TULONG]*/
|
BINT|BUINT|BLONG|BULONG|BIND, /*[TULONG]*/
|
||||||
|
@ -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,
|
||||||
|
@ -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);
|
||||||
@ -385,8 +385,8 @@ loop:
|
|||||||
gbranch(OGOTO); /* entry */
|
gbranch(OGOTO); /* entry */
|
||||||
sp = p;
|
sp = p;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if there are no incoming labels in the
|
* if there are no incoming labels in the
|
||||||
* body and the top's not reachable, warn
|
* body and the top's not reachable, warn
|
||||||
*/
|
*/
|
||||||
if(!canreach && warnreach && deadheads(n)) {
|
if(!canreach && warnreach && deadheads(n)) {
|
||||||
@ -410,7 +410,7 @@ loop:
|
|||||||
|
|
||||||
patch(spc, pc);
|
patch(spc, pc);
|
||||||
gen(l->right->right); /* inc */
|
gen(l->right->right); /* inc */
|
||||||
patch(sp, pc);
|
patch(sp, pc);
|
||||||
if(l->left != Z) { /* test */
|
if(l->left != Z) { /* test */
|
||||||
bcomplex(l->left, Z);
|
bcomplex(l->left, Z);
|
||||||
patch(p, breakpc);
|
patch(p, breakpc);
|
||||||
@ -460,7 +460,7 @@ loop:
|
|||||||
* Don't complain about unreachable break statements.
|
* Don't complain about unreachable break statements.
|
||||||
* There are breaks hidden in yacc's output and some people
|
* There are breaks hidden in yacc's output and some people
|
||||||
* write return; break; in their switch statements out of habit.
|
* write return; break; in their switch statements out of habit.
|
||||||
* However, don't confuse the analysis by inserting an
|
* However, don't confuse the analysis by inserting an
|
||||||
* unreachable reference to breakpc either.
|
* unreachable reference to breakpc either.
|
||||||
*/
|
*/
|
||||||
if(!canreach)
|
if(!canreach)
|
||||||
@ -488,7 +488,7 @@ loop:
|
|||||||
canreach = 1;
|
canreach = 1;
|
||||||
gen(n->right->right);
|
gen(n->right->right);
|
||||||
/*
|
/*
|
||||||
* treat constant ifs as regular ifs for
|
* treat constant ifs as regular ifs for
|
||||||
* reachability warnings.
|
* reachability warnings.
|
||||||
*/
|
*/
|
||||||
if(!canreach && oldreach && debug['w'] < 2)
|
if(!canreach && oldreach && debug['w'] < 2)
|
||||||
@ -501,7 +501,7 @@ loop:
|
|||||||
canreach = 1;
|
canreach = 1;
|
||||||
supgen(n->right->right);
|
supgen(n->right->right);
|
||||||
/*
|
/*
|
||||||
* treat constant ifs as regular ifs for
|
* treat constant ifs as regular ifs for
|
||||||
* reachability warnings.
|
* reachability warnings.
|
||||||
*/
|
*/
|
||||||
if(!oldreach && canreach && debug['w'] < 2)
|
if(!oldreach && canreach && debug['w'] < 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user