Commit 4acb70d3 authored by Russ Cox's avatar Russ Cox

cmd/gc: bypass DATA instruction for data initialized to integer constant

Eventually we will want to bypass DATA for everything,
but the relocations are not standardized well enough across
architectures to make that possible.

This did not help as much as I expected, but it is definitely better.
It shaves maybe 1-2% off all.bash depending on how much you
trust the timings of a single run:

Before: 241.139r 362.702u 112.967s
After:  234.339r 359.623u 111.045s

R=golang-codereviews, gobot, r, iant
CC=golang-codereviews
https://golang.org/cl/44650043
parent dc8572c3
......@@ -223,27 +223,6 @@ dgostringptr(Sym *s, int off, char *str)
return dgostrlitptr(s, off, lit);
}
int
duintxx(Sym *s, int off, uint64 v, int wid)
{
Prog *p;
off = rnd(off, wid);
p = gins(ADATA, N, N);
p->from.type = D_OREG;
p->from.name = D_EXTERN;
p->from.sym = linksym(s);
p->from.offset = off;
p->reg = wid;
p->to.type = D_CONST;
p->to.name = D_NONE;
p->to.offset = v;
off += wid;
return off;
}
int
dsymptr(Sym *s, int off, Sym *x, int xoff)
{
......
......@@ -205,27 +205,6 @@ dgostringptr(Sym *s, int off, char *str)
return dgostrlitptr(s, off, lit);
}
int
duintxx(Sym *s, int off, uint64 v, int wid)
{
Prog *p;
off = rnd(off, wid);
p = gins(ADATA, N, N);
p->from.type = D_EXTERN;
p->from.index = D_NONE;
p->from.sym = linksym(s);
p->from.offset = off;
p->from.scale = wid;
p->to.type = D_CONST;
p->to.index = D_NONE;
p->to.offset = v;
off += wid;
return off;
}
int
dsymptr(Sym *s, int off, Sym *x, int xoff)
{
......
......@@ -216,28 +216,6 @@ dgostringptr(Sym *s, int off, char *str)
return dgostrlitptr(s, off, lit);
}
int
duintxx(Sym *s, int off, uint64 v, int wid)
{
Prog *p;
off = rnd(off, wid);
p = gins(ADATA, N, N);
p->from.type = D_EXTERN;
p->from.index = D_NONE;
p->from.sym = linksym(s);
p->from.offset = off;
p->from.scale = wid;
p->to.type = D_CONST;
p->to.index = D_NONE;
p->to.offset = v;
off += wid;
return off;
}
int
dsymptr(Sym *s, int off, Sym *x, int xoff)
{
......
......@@ -160,6 +160,16 @@ linksym(Sym *s)
return s->lsym;
}
int
duintxx(Sym *s, int off, uint64 v, int wid)
{
// Update symbol data directly instead of generating a
// DATA instruction that liblink will have to interpret later.
// This reduces compilation time and memory usage.
off = rnd(off, wid);
return setuintxx(ctxt, linksym(s), off, v, wid);
}
int
duint8(Sym *s, int off, uint8 v)
{
......
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