Commit d8c79805 authored by Russ Cox's avatar Russ Cox

comment sudoaddable;

remove unused second parameter.

R=ken
OCL=22126
CL=22126
parent 8318187f
...@@ -66,7 +66,7 @@ cgen(Node *n, Node *res) ...@@ -66,7 +66,7 @@ cgen(Node *n, Node *res)
break; break;
} }
if(sudoaddable(res, n->type, &addr)) { if(sudoaddable(res, &addr)) {
a = optoas(OAS, res->type); a = optoas(OAS, res->type);
if(f) { if(f) {
regalloc(&n2, res->type, N); regalloc(&n2, res->type, N);
...@@ -104,7 +104,7 @@ cgen(Node *n, Node *res) ...@@ -104,7 +104,7 @@ cgen(Node *n, Node *res)
goto ret; goto ret;
} }
if(sudoaddable(n, res->type, &addr)) { if(sudoaddable(n, &addr)) {
a = optoas(OAS, n->type); a = optoas(OAS, n->type);
if(res->op == OREGISTER) { if(res->op == OREGISTER) {
p1 = gins(a, N, res); p1 = gins(a, N, res);
...@@ -340,7 +340,7 @@ abop: // asymmetric binary ...@@ -340,7 +340,7 @@ abop: // asymmetric binary
regalloc(&n1, nl->type, res); regalloc(&n1, nl->type, res);
cgen(nl, &n1); cgen(nl, &n1);
if(sudoaddable(nr, nl->type, &addr)) { if(sudoaddable(nr, &addr)) {
p1 = gins(a, N, &n1); p1 = gins(a, N, &n1);
p1->from = addr; p1->from = addr;
gmove(&n1, res); gmove(&n1, res);
......
...@@ -987,7 +987,7 @@ cgen_asop(Node *n) ...@@ -987,7 +987,7 @@ cgen_asop(Node *n)
gins(optoas(OINC, nl->type), N, nl); gins(optoas(OINC, nl->type), N, nl);
goto ret; goto ret;
} }
if(sudoaddable(nl, nr->type, &addr)) { if(sudoaddable(nl, &addr)) {
p1 = gins(optoas(OINC, nl->type), N, N); p1 = gins(optoas(OINC, nl->type), N, N);
p1->to = addr; p1->to = addr;
sudoclean(); sudoclean();
...@@ -1003,7 +1003,7 @@ cgen_asop(Node *n) ...@@ -1003,7 +1003,7 @@ cgen_asop(Node *n)
gins(optoas(ODEC, nl->type), N, nl); gins(optoas(ODEC, nl->type), N, nl);
goto ret; goto ret;
} }
if(sudoaddable(nl, nr->type, &addr)) { if(sudoaddable(nl, &addr)) {
p1 = gins(optoas(ODEC, nl->type), N, N); p1 = gins(optoas(ODEC, nl->type), N, N);
p1->to = addr; p1->to = addr;
sudoclean(); sudoclean();
...@@ -1031,7 +1031,7 @@ cgen_asop(Node *n) ...@@ -1031,7 +1031,7 @@ cgen_asop(Node *n)
goto ret; goto ret;
} }
if(nr->ullman < UINF) if(nr->ullman < UINF)
if(sudoaddable(nl, nr->type, &addr)) { if(sudoaddable(nl, &addr)) {
if(smallintconst(nr)) { if(smallintconst(nr)) {
p1 = gins(optoas(n->etype, nl->type), nr, N); p1 = gins(optoas(n->etype, nl->type), nr, N);
p1->to = addr; p1->to = addr;
......
...@@ -215,7 +215,7 @@ Plist* newplist(void); ...@@ -215,7 +215,7 @@ Plist* newplist(void);
int isfat(Type*); int isfat(Type*);
void setmaxarg(Type*); void setmaxarg(Type*);
void sudoclean(void); void sudoclean(void);
int sudoaddable(Node*, Type*, Addr*); int sudoaddable(Node*, Addr*);
/* /*
* list.c * list.c
......
...@@ -1857,8 +1857,19 @@ sudoclean(void) ...@@ -1857,8 +1857,19 @@ sudoclean(void)
cleani -= 2; cleani -= 2;
} }
/*
* generate code to compute address of n,
* a reference to a (perhaps nested) field inside
* an array or struct.
* return 0 on failure, 1 on success.
* on success, leaves usable address in a.
*
* caller is responsible for calling sudoclean
* after successful sudoaddable,
* to release the register used for a.
*/
int int
sudoaddable(Node *n, Type *t, Addr *a) sudoaddable(Node *n, Addr *a)
{ {
int o, i, w; int o, i, w;
int oary[10]; int oary[10];
...@@ -1866,8 +1877,9 @@ sudoaddable(Node *n, Type *t, Addr *a) ...@@ -1866,8 +1877,9 @@ sudoaddable(Node *n, Type *t, Addr *a)
Node n1, n2, *nn, *l, *r; Node n1, n2, *nn, *l, *r;
Node *reg, *reg1; Node *reg, *reg1;
Prog *p1; Prog *p1;
Type *t;
if(n->type == T || t == T) if(n->type == T)
return 0; return 0;
switch(n->op) { switch(n->op) {
......
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