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)
break;
}
if(sudoaddable(res, n->type, &addr)) {
if(sudoaddable(res, &addr)) {
a = optoas(OAS, res->type);
if(f) {
regalloc(&n2, res->type, N);
......@@ -104,7 +104,7 @@ cgen(Node *n, Node *res)
goto ret;
}
if(sudoaddable(n, res->type, &addr)) {
if(sudoaddable(n, &addr)) {
a = optoas(OAS, n->type);
if(res->op == OREGISTER) {
p1 = gins(a, N, res);
......@@ -340,7 +340,7 @@ abop: // asymmetric binary
regalloc(&n1, nl->type, res);
cgen(nl, &n1);
if(sudoaddable(nr, nl->type, &addr)) {
if(sudoaddable(nr, &addr)) {
p1 = gins(a, N, &n1);
p1->from = addr;
gmove(&n1, res);
......
......@@ -987,7 +987,7 @@ cgen_asop(Node *n)
gins(optoas(OINC, nl->type), N, nl);
goto ret;
}
if(sudoaddable(nl, nr->type, &addr)) {
if(sudoaddable(nl, &addr)) {
p1 = gins(optoas(OINC, nl->type), N, N);
p1->to = addr;
sudoclean();
......@@ -1003,7 +1003,7 @@ cgen_asop(Node *n)
gins(optoas(ODEC, nl->type), N, nl);
goto ret;
}
if(sudoaddable(nl, nr->type, &addr)) {
if(sudoaddable(nl, &addr)) {
p1 = gins(optoas(ODEC, nl->type), N, N);
p1->to = addr;
sudoclean();
......@@ -1031,7 +1031,7 @@ cgen_asop(Node *n)
goto ret;
}
if(nr->ullman < UINF)
if(sudoaddable(nl, nr->type, &addr)) {
if(sudoaddable(nl, &addr)) {
if(smallintconst(nr)) {
p1 = gins(optoas(n->etype, nl->type), nr, N);
p1->to = addr;
......
......@@ -215,7 +215,7 @@ Plist* newplist(void);
int isfat(Type*);
void setmaxarg(Type*);
void sudoclean(void);
int sudoaddable(Node*, Type*, Addr*);
int sudoaddable(Node*, Addr*);
/*
* list.c
......
......@@ -1857,8 +1857,19 @@ sudoclean(void)
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
sudoaddable(Node *n, Type *t, Addr *a)
sudoaddable(Node *n, Addr *a)
{
int o, i, w;
int oary[10];
......@@ -1866,8 +1877,9 @@ sudoaddable(Node *n, Type *t, Addr *a)
Node n1, n2, *nn, *l, *r;
Node *reg, *reg1;
Prog *p1;
Type *t;
if(n->type == T || t == T)
if(n->type == T)
return 0;
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