mirror of
https://github.com/golang/go
synced 2024-11-18 18:14:43 -07:00
cmd/gc: slightly better code generation
* Avoid treating CALL fn(SB) as justification for introducing and tracking a registerized variable for fn(SB). * Remove USED(n) after declaration and zeroing of n. It was left over from when the compiler emitted more aggressive set and not used errors, and it was keeping the optimizer from removing a redundant zeroing of n when n was a pointer or integer variable. Update #597. R=ken2 CC=golang-dev https://golang.org/cl/7277048
This commit is contained in:
parent
d48cd5d1d5
commit
2c09d6992f
@ -275,6 +275,10 @@ regopt(Prog *firstp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid making variables for direct-called functions.
|
||||||
|
if(p->as == ABL && p->to.type == D_EXTERN)
|
||||||
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* left side always read
|
* left side always read
|
||||||
*/
|
*/
|
||||||
|
@ -252,6 +252,10 @@ regopt(Prog *firstp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid making variables for direct-called functions.
|
||||||
|
if(p->as == ACALL && p->to.type == D_EXTERN)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Addressing makes some registers used.
|
// Addressing makes some registers used.
|
||||||
if(p->from.type >= D_INDIR)
|
if(p->from.type >= D_INDIR)
|
||||||
r->use1.b[0] |= RtoB(p->from.type-D_INDIR);
|
r->use1.b[0] |= RtoB(p->from.type-D_INDIR);
|
||||||
|
@ -222,6 +222,10 @@ regopt(Prog *firstp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid making variables for direct-called functions.
|
||||||
|
if(p->as == ACALL && p->to.type == D_EXTERN)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Addressing makes some registers used.
|
// Addressing makes some registers used.
|
||||||
if(p->from.type >= D_INDIR)
|
if(p->from.type >= D_INDIR)
|
||||||
r->use1.b[0] |= RtoB(p->from.type-D_INDIR);
|
r->use1.b[0] |= RtoB(p->from.type-D_INDIR);
|
||||||
|
@ -735,8 +735,6 @@ cgen_as(Node *nl, Node *nr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clearslim(nl);
|
clearslim(nl);
|
||||||
if(nl->addable)
|
|
||||||
gused(nl);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user