1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:54:44 -07:00

cmd/[568]g: recycle ONAME nodes used in regopt to denote registers.

The reported decrease in memory usage is about 5%.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6902064
This commit is contained in:
Rémy Oudompheng 2012-12-09 19:10:52 +01:00
parent 00cd6a3be3
commit 45fe306ac8
3 changed files with 21 additions and 6 deletions

View File

@ -170,6 +170,8 @@ static char* regname[] = {
".F15",
};
static Node* regnodes[NREGVAR];
void
regopt(Prog *firstp)
{
@ -216,8 +218,11 @@ regopt(Prog *firstp)
*/
nvar = NREGVAR;
memset(var, 0, NREGVAR*sizeof var[0]);
for(i=0; i<NREGVAR; i++)
var[i].node = newname(lookup(regname[i]));
for(i=0; i<NREGVAR; i++) {
if(regnodes[i] == N)
regnodes[i] = newname(lookup(regname[i]));
var[i].node = regnodes[i];
}
regbits = RtoB(REGSP)|RtoB(REGLINK)|RtoB(REGPC);
for(z=0; z<BITS; z++) {

View File

@ -151,6 +151,8 @@ static char* regname[] = {
".X15",
};
static Node* regnodes[NREGVAR];
static void fixjmp(Prog*);
void
@ -191,8 +193,11 @@ regopt(Prog *firstp)
*/
nvar = NREGVAR;
memset(var, 0, NREGVAR*sizeof var[0]);
for(i=0; i<NREGVAR; i++)
var[i].node = newname(lookup(regname[i]));
for(i=0; i<NREGVAR; i++) {
if(regnodes[i] == N)
regnodes[i] = newname(lookup(regname[i]));
var[i].node = regnodes[i];
}
regbits = RtoB(D_SP);
for(z=0; z<BITS; z++) {

View File

@ -121,6 +121,8 @@ setaddrs(Bits bit)
static char* regname[] = { ".ax", ".cx", ".dx", ".bx", ".sp", ".bp", ".si", ".di" };
static Node* regnodes[NREGVAR];
void
regopt(Prog *firstp)
{
@ -159,8 +161,11 @@ regopt(Prog *firstp)
*/
nvar = NREGVAR;
memset(var, 0, NREGVAR*sizeof var[0]);
for(i=0; i<NREGVAR; i++)
var[i].node = newname(lookup(regname[i]));
for(i=0; i<NREGVAR; i++) {
if(regnodes[i] == N)
regnodes[i] = newname(lookup(regname[i]));
var[i].node = regnodes[i];
}
regbits = RtoB(D_SP);
for(z=0; z<BITS; z++) {