Commit 3ac37c72 authored by Russ Cox's avatar Russ Cox

liblink: place DATA size in from3.offset always

Like the TEXT/GLOBL flags, this was split between from.scale and reg,
neither of which is appropriate.

Change-Id: I2a16ef066a53b6edb7afb16cce108c0d1d26389c
Reviewed-on: https://go-review.googlesource.com/3576Reviewed-by: default avatarAram Hăvărneanu <aram@mgk.ro>
Reviewed-by: default avatarAustin Clements <austin@google.com>
parent 76fed542
...@@ -598,7 +598,6 @@ struct LinkArch ...@@ -598,7 +598,6 @@ struct LinkArch
void (*preprocess)(Link*, LSym*); void (*preprocess)(Link*, LSym*);
void (*assemble)(Link*, LSym*); void (*assemble)(Link*, LSym*);
int (*datasize)(Prog*);
void (*follow)(Link*, LSym*); void (*follow)(Link*, LSym*);
int (*iscall)(Prog*); int (*iscall)(Prog*);
int (*isdata)(Prog*); int (*isdata)(Prog*);
......
...@@ -248,7 +248,11 @@ inst: ...@@ -248,7 +248,11 @@ inst:
*/ */
| LTYPEC name '/' con ',' ximm | LTYPEC name '/' con ',' ximm
{ {
outcode($1, Always, &$2, $4, &$6); outcode($1, Always, &$2, 0, &$6);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
} }
/* /*
* CASE * CASE
......
This diff is collapsed.
...@@ -45,7 +45,8 @@ dsname(Sym *sym, int off, char *t, int n) ...@@ -45,7 +45,8 @@ dsname(Sym *sym, int off, char *t, int n)
p->from.reg = 0; p->from.reg = 0;
p->from.sym = linksym(sym); p->from.sym = linksym(sym);
p->reg = n; p->from3.type = TYPE_CONST;
p->from3.offset = n;
p->to.type = TYPE_SCONST; p->to.type = TYPE_SCONST;
p->to.name = NAME_NONE; p->to.name = NAME_NONE;
...@@ -113,14 +114,17 @@ gdata(Node *nam, Node *nr, int wid) ...@@ -113,14 +114,17 @@ gdata(Node *nam, Node *nr, int wid)
if(wid == 8 && is64(nr->type)) { if(wid == 8 && is64(nr->type)) {
v = mpgetfix(nr->val.u.xval); v = mpgetfix(nr->val.u.xval);
p = gins(ADATA, nam, nodintconst(v)); p = gins(ADATA, nam, nodintconst(v));
p->reg = 4; p->from3.type = TYPE_CONST;
p->from3.offset = 4;
p = gins(ADATA, nam, nodintconst(v>>32)); p = gins(ADATA, nam, nodintconst(v>>32));
p->reg = 4; p->from3.type = TYPE_CONST;
p->from3.offset = 4;
p->from.offset += 4; p->from.offset += 4;
return; return;
} }
p = gins(ADATA, nam, nr); p = gins(ADATA, nam, nr);
p->reg = wid; p->from3.type = TYPE_CONST;
p->from3.offset = wid;
} }
void void
...@@ -133,12 +137,14 @@ gdatacomplex(Node *nam, Mpcplx *cval) ...@@ -133,12 +137,14 @@ gdatacomplex(Node *nam, Mpcplx *cval)
w = types[w]->width; w = types[w]->width;
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->reg = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->real); p->to.u.dval = mpgetflt(&cval->real);
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->reg = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->from.offset += w; p->from.offset += w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->imag); p->to.u.dval = mpgetflt(&cval->imag);
...@@ -152,14 +158,16 @@ gdatastring(Node *nam, Strlit *sval) ...@@ -152,14 +158,16 @@ gdatastring(Node *nam, Strlit *sval)
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
datastring(sval->s, sval->len, &p->to); datastring(sval->s, sval->len, &p->to);
p->reg = types[tptr]->width; p->from3.type = TYPE_CONST;
p->from3.offset = types[tptr]->width;
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
p->to.etype = TINT32; p->to.etype = TINT32;
//print("%P\n", p); //print("%P\n", p);
nodconst(&nod1, types[TINT32], sval->len); nodconst(&nod1, types[TINT32], sval->len);
p = gins(ADATA, nam, &nod1); p = gins(ADATA, nam, &nod1);
p->reg = types[TINT32]->width; p->from3.type = TYPE_CONST;
p->from3.offset = types[TINT32]->width;
p->from.offset += types[tptr]->width; p->from.offset += types[tptr]->width;
} }
...@@ -174,7 +182,8 @@ dstringptr(Sym *s, int off, char *str) ...@@ -174,7 +182,8 @@ dstringptr(Sym *s, int off, char *str)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->reg = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datastring(str, strlen(str)+1, &p->to); datastring(str, strlen(str)+1, &p->to);
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
...@@ -198,7 +207,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit) ...@@ -198,7 +207,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->reg = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datagostring(lit, &p->to); datagostring(lit, &p->to);
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
p->to.etype = TINT32; p->to.etype = TINT32;
...@@ -235,7 +245,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff) ...@@ -235,7 +245,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->reg = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
p->to.name = NAME_EXTERN; p->to.name = NAME_EXTERN;
p->to.sym = linksym(x); p->to.sym = linksym(x);
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
%type <lval> con expr pointer offset %type <lval> con expr pointer offset
%type <addr> mem imm reg nam rel rem rim rom omem nmem textsize %type <addr> mem imm reg nam rel rem rim rom omem nmem textsize
%type <addr2> nonnon nonrel nonrem rimnon rimrem remrim %type <addr2> nonnon nonrel nonrem rimnon rimrem remrim
%type <addr2> spec1 spec3 spec4 spec5 spec6 spec7 spec8 spec9 %type <addr2> spec3 spec4 spec5 spec6 spec7 spec8 spec9
%type <addr2> spec10 spec12 spec13 %type <addr2> spec10 spec12 spec13
%% %%
prog: prog:
...@@ -102,7 +102,7 @@ inst: ...@@ -102,7 +102,7 @@ inst:
| LTYPE3 rimrem { outcode($1, &$2); } | LTYPE3 rimrem { outcode($1, &$2); }
| LTYPE4 remrim { outcode($1, &$2); } | LTYPE4 remrim { outcode($1, &$2); }
| LTYPER nonrel { outcode($1, &$2); } | LTYPER nonrel { outcode($1, &$2); }
| LTYPED spec1 { outcode($1, &$2); } | spec1
| spec2 | spec2
| LTYPEC spec3 { outcode($1, &$2); } | LTYPEC spec3 { outcode($1, &$2); }
| LTYPEN spec4 { outcode($1, &$2); } | LTYPEN spec4 { outcode($1, &$2); }
...@@ -183,11 +183,16 @@ nonrel: ...@@ -183,11 +183,16 @@ nonrel:
} }
spec1: /* DATA */ spec1: /* DATA */
nam '/' con ',' imm LTYPED nam '/' con ',' imm
{ {
$$.from = $1; Addr2 a;
$$.from.scale = $3; a.from = $2;
$$.to = $5; a.to = $6;
outcode(ADATA, &a);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
} }
spec2: /* TEXT */ spec2: /* TEXT */
......
This diff is collapsed.
...@@ -41,8 +41,9 @@ dsname(Sym *s, int off, char *t, int n) ...@@ -41,8 +41,9 @@ dsname(Sym *s, int off, char *t, int n)
p->from.type = TYPE_MEM; p->from.type = TYPE_MEM;
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.offset = off; p->from.offset = off;
p->from.scale = n;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from3.type = TYPE_CONST;
p->from3.offset = n;
p->to.type = TYPE_SCONST; p->to.type = TYPE_SCONST;
memmove(p->to.u.sval, t, n); memmove(p->to.u.sval, t, n);
...@@ -101,7 +102,8 @@ gdata(Node *nam, Node *nr, int wid) ...@@ -101,7 +102,8 @@ gdata(Node *nam, Node *nr, int wid)
} }
} }
p = gins(ADATA, nam, nr); p = gins(ADATA, nam, nr);
p->from.scale = wid; p->from3.type = TYPE_CONST;
p->from3.offset = wid;
} }
void void
...@@ -114,12 +116,14 @@ gdatacomplex(Node *nam, Mpcplx *cval) ...@@ -114,12 +116,14 @@ gdatacomplex(Node *nam, Mpcplx *cval)
w = types[w]->width; w = types[w]->width;
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->from.scale = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->real); p->to.u.dval = mpgetflt(&cval->real);
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->from.scale = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->from.offset += w; p->from.offset += w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->imag); p->to.u.dval = mpgetflt(&cval->imag);
...@@ -133,13 +137,15 @@ gdatastring(Node *nam, Strlit *sval) ...@@ -133,13 +137,15 @@ gdatastring(Node *nam, Strlit *sval)
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
datastring(sval->s, sval->len, &p->to); datastring(sval->s, sval->len, &p->to);
p->from.scale = types[tptr]->width; p->from3.type = TYPE_CONST;
p->from3.offset = types[tptr]->width;
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
//print("%P\n", p); //print("%P\n", p);
nodconst(&nod1, types[TINT], sval->len); nodconst(&nod1, types[TINT], sval->len);
p = gins(ADATA, nam, &nod1); p = gins(ADATA, nam, &nod1);
p->from.scale = widthint; p->from3.type = TYPE_CONST;
p->from3.offset = widthint;
p->from.offset += widthptr; p->from.offset += widthptr;
} }
...@@ -154,7 +160,8 @@ dstringptr(Sym *s, int off, char *str) ...@@ -154,7 +160,8 @@ dstringptr(Sym *s, int off, char *str)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->from.scale = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datastring(str, strlen(str)+1, &p->to); datastring(str, strlen(str)+1, &p->to);
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
...@@ -178,7 +185,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit) ...@@ -178,7 +185,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->from.scale = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datagostring(lit, &p->to); datagostring(lit, &p->to);
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
p->to.etype = simtype[TINT]; p->to.etype = simtype[TINT];
...@@ -215,7 +223,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff) ...@@ -215,7 +223,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->from.scale = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
p->to.name = NAME_EXTERN; p->to.name = NAME_EXTERN;
p->to.sym = linksym(x); p->to.sym = linksym(x);
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
%type <lval> con expr pointer offset %type <lval> con expr pointer offset
%type <addr> mem imm reg nam rel rem rim rom omem nmem textsize %type <addr> mem imm reg nam rel rem rim rom omem nmem textsize
%type <addr2> nonnon nonrel nonrem rimnon rimrem remrim %type <addr2> nonnon nonrel nonrem rimnon rimrem remrim
%type <addr2> spec1 spec3 spec4 spec5 spec6 spec7 spec9 spec10 spec11 spec12 %type <addr2> spec3 spec4 spec5 spec6 spec7 spec9 spec10 spec11 spec12
%% %%
prog: prog:
| prog | prog
...@@ -100,7 +100,7 @@ inst: ...@@ -100,7 +100,7 @@ inst:
| LTYPE3 rimrem { outcode($1, &$2); } | LTYPE3 rimrem { outcode($1, &$2); }
| LTYPE4 remrim { outcode($1, &$2); } | LTYPE4 remrim { outcode($1, &$2); }
| LTYPER nonrel { outcode($1, &$2); } | LTYPER nonrel { outcode($1, &$2); }
| LTYPED spec1 { outcode($1, &$2); } | spec1
| spec2 | spec2
| LTYPEC spec3 { outcode($1, &$2); } | LTYPEC spec3 { outcode($1, &$2); }
| LTYPEN spec4 { outcode($1, &$2); } | LTYPEN spec4 { outcode($1, &$2); }
...@@ -180,11 +180,16 @@ nonrel: ...@@ -180,11 +180,16 @@ nonrel:
} }
spec1: /* DATA */ spec1: /* DATA */
nam '/' con ',' imm LTYPED nam '/' con ',' imm
{ {
$$.from = $1; Addr2 a;
$$.from.scale = $3; a.from = $2;
$$.to = $5; a.to = $6;
outcode(ADATA, &a);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
} }
spec2: /* TEXT */ spec2: /* TEXT */
......
This diff is collapsed.
...@@ -41,7 +41,8 @@ dsname(Sym *s, int off, char *t, int n) ...@@ -41,7 +41,8 @@ dsname(Sym *s, int off, char *t, int n)
p->from.type = TYPE_MEM; p->from.type = TYPE_MEM;
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.offset = off; p->from.offset = off;
p->from.scale = n; p->from3.type = TYPE_CONST;
p->from3.offset = n;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->to.type = TYPE_SCONST; p->to.type = TYPE_SCONST;
...@@ -105,14 +106,17 @@ gdata(Node *nam, Node *nr, int wid) ...@@ -105,14 +106,17 @@ gdata(Node *nam, Node *nr, int wid)
if(wid == 8 && is64(nr->type)) { if(wid == 8 && is64(nr->type)) {
v = mpgetfix(nr->val.u.xval); v = mpgetfix(nr->val.u.xval);
p = gins(ADATA, nam, nodintconst(v)); p = gins(ADATA, nam, nodintconst(v));
p->from.scale = 4; p->from3.type = TYPE_CONST;
p->from3.offset = 4;
p = gins(ADATA, nam, nodintconst(v>>32)); p = gins(ADATA, nam, nodintconst(v>>32));
p->from.scale = 4; p->from3.type = TYPE_CONST;
p->from3.offset = 4;
p->from.offset += 4; p->from.offset += 4;
return; return;
} }
p = gins(ADATA, nam, nr); p = gins(ADATA, nam, nr);
p->from.scale = wid; p->from3.type = TYPE_CONST;
p->from3.offset = wid;
} }
void void
...@@ -125,12 +129,14 @@ gdatacomplex(Node *nam, Mpcplx *cval) ...@@ -125,12 +129,14 @@ gdatacomplex(Node *nam, Mpcplx *cval)
w = types[w]->width; w = types[w]->width;
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->from.scale = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->real); p->to.u.dval = mpgetflt(&cval->real);
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->from.scale = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->from.offset += w; p->from.offset += w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->imag); p->to.u.dval = mpgetflt(&cval->imag);
...@@ -144,13 +150,15 @@ gdatastring(Node *nam, Strlit *sval) ...@@ -144,13 +150,15 @@ gdatastring(Node *nam, Strlit *sval)
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
datastring(sval->s, sval->len, &p->to); datastring(sval->s, sval->len, &p->to);
p->from.scale = types[tptr]->width; p->from3.type = TYPE_CONST;
p->from3.offset = types[tptr]->width;
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
//print("%P\n", p); //print("%P\n", p);
nodconst(&nod1, types[TINT32], sval->len); nodconst(&nod1, types[TINT32], sval->len);
p = gins(ADATA, nam, &nod1); p = gins(ADATA, nam, &nod1);
p->from.scale = types[TINT32]->width; p->from3.type = TYPE_CONST;
p->from3.offset = types[TINT32]->width;
p->from.offset += types[tptr]->width; p->from.offset += types[tptr]->width;
} }
...@@ -165,7 +173,8 @@ dstringptr(Sym *s, int off, char *str) ...@@ -165,7 +173,8 @@ dstringptr(Sym *s, int off, char *str)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->from.scale = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datastring(str, strlen(str)+1, &p->to); datastring(str, strlen(str)+1, &p->to);
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
...@@ -189,7 +198,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit) ...@@ -189,7 +198,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->from.scale = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datagostring(lit, &p->to); datagostring(lit, &p->to);
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
p->to.etype = TINT32; p->to.etype = TINT32;
...@@ -226,7 +236,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff) ...@@ -226,7 +236,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->from.scale = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
p->to.type = TYPE_ADDR; p->to.type = TYPE_ADDR;
p->to.name = NAME_EXTERN; p->to.name = NAME_EXTERN;
p->to.sym = linksym(x); p->to.sym = linksym(x);
......
...@@ -650,15 +650,27 @@ inst: ...@@ -650,15 +650,27 @@ inst:
*/ */
| LDATA name '/' con ',' imm | LDATA name '/' con ',' imm
{ {
outcode($1, &$2, $4, &$6); outcode($1, &$2, 0, &$6);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
} }
| LDATA name '/' con ',' ximm | LDATA name '/' con ',' ximm
{ {
outcode($1, &$2, $4, &$6); outcode($1, &$2, 0, &$6);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
} }
| LDATA name '/' con ',' fimm | LDATA name '/' con ',' fimm
{ {
outcode($1, &$2, $4, &$6); outcode($1, &$2, 0, &$6);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
} }
/* /*
* RETURN * RETURN
......
This diff is collapsed.
...@@ -43,7 +43,8 @@ dsname(Sym *s, int off, char *t, int n) ...@@ -43,7 +43,8 @@ dsname(Sym *s, int off, char *t, int n)
p->from.offset = off; p->from.offset = off;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->reg = n; p->from3.type = TYPE_CONST;
p->from3.offset = n;
p->to.type = TYPE_SCONST; p->to.type = TYPE_SCONST;
p->to.name = NAME_NONE; p->to.name = NAME_NONE;
...@@ -106,7 +107,8 @@ gdata(Node *nam, Node *nr, int wid) ...@@ -106,7 +107,8 @@ gdata(Node *nam, Node *nr, int wid)
} }
} }
p = gins(ADATA, nam, nr); p = gins(ADATA, nam, nr);
p->reg = wid; p->from3.type = TYPE_CONST;
p->from3.offset = wid;
} }
void void
...@@ -119,12 +121,14 @@ gdatacomplex(Node *nam, Mpcplx *cval) ...@@ -119,12 +121,14 @@ gdatacomplex(Node *nam, Mpcplx *cval)
w = types[w]->width; w = types[w]->width;
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->reg = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->real); p->to.u.dval = mpgetflt(&cval->real);
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
p->reg = w; p->from3.type = TYPE_CONST;
p->from3.offset = w;
p->from.offset += w; p->from.offset += w;
p->to.type = TYPE_FCONST; p->to.type = TYPE_FCONST;
p->to.u.dval = mpgetflt(&cval->imag); p->to.u.dval = mpgetflt(&cval->imag);
...@@ -138,13 +142,15 @@ gdatastring(Node *nam, Strlit *sval) ...@@ -138,13 +142,15 @@ gdatastring(Node *nam, Strlit *sval)
p = gins(ADATA, nam, N); p = gins(ADATA, nam, N);
datastring(sval->s, sval->len, &p->to); datastring(sval->s, sval->len, &p->to);
p->reg = types[tptr]->width; p->from3.type = TYPE_CONST;
p->from3.offset = types[tptr]->width;
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
p->to.etype = simtype[tptr]; p->to.etype = simtype[tptr];
nodconst(&nod1, types[TINT], sval->len); nodconst(&nod1, types[TINT], sval->len);
p = gins(ADATA, nam, &nod1); p = gins(ADATA, nam, &nod1);
p->reg = widthint; p->from3.type = TYPE_CONST;
p->from3.offset = widthint;
p->from.offset += widthptr; p->from.offset += widthptr;
} }
...@@ -159,7 +165,8 @@ dstringptr(Sym *s, int off, char *str) ...@@ -159,7 +165,8 @@ dstringptr(Sym *s, int off, char *str)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->reg = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datastring(str, strlen(str)+1, &p->to); datastring(str, strlen(str)+1, &p->to);
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
...@@ -183,7 +190,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit) ...@@ -183,7 +190,8 @@ dgostrlitptr(Sym *s, int off, Strlit *lit)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->reg = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
datagostring(lit, &p->to); datagostring(lit, &p->to);
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
p->to.etype = simtype[TINT]; p->to.etype = simtype[TINT];
...@@ -220,7 +228,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff) ...@@ -220,7 +228,8 @@ dsymptr(Sym *s, int off, Sym *x, int xoff)
p->from.name = NAME_EXTERN; p->from.name = NAME_EXTERN;
p->from.sym = linksym(s); p->from.sym = linksym(s);
p->from.offset = off; p->from.offset = off;
p->reg = widthptr; p->from3.type = TYPE_CONST;
p->from3.offset = widthptr;
p->to.type = TYPE_CONST; p->to.type = TYPE_CONST;
p->to.name = NAME_EXTERN; p->to.name = NAME_EXTERN;
p->to.sym = linksym(x); p->to.sym = linksym(x);
......
...@@ -80,7 +80,7 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn) ...@@ -80,7 +80,7 @@ savedata(Link *ctxt, LSym *s, Prog *p, char *pn)
Reloc *r; Reloc *r;
off = p->from.offset; off = p->from.offset;
siz = ctxt->arch->datasize(p); siz = p->from3.offset;
if(off < 0 || siz < 0 || off >= 1<<30 || siz >= 100) if(off < 0 || siz < 0 || off >= 1<<30 || siz >= 100)
mangle(pn); mangle(pn);
if(ctxt->enforce_data_order && off < s->np) if(ctxt->enforce_data_order && off < s->np)
......
...@@ -109,7 +109,7 @@ Pconv(Fmt *fp) ...@@ -109,7 +109,7 @@ Pconv(Fmt *fp)
sprint(str, "%.5lld (%L) %A%s %D,%D", p->pc, p->lineno, a, sc, &p->from, &p->to); sprint(str, "%.5lld (%L) %A%s %D,%D", p->pc, p->lineno, a, sc, &p->from, &p->to);
} else } else
if(a == ADATA) if(a == ADATA)
sprint(str, "%.5lld (%L) %A %D/%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to); sprint(str, "%.5lld (%L) %A %D/%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to);
else else
if(p->as == ATEXT) if(p->as == ATEXT)
sprint(str, "%.5lld (%L) %A %D,%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to); sprint(str, "%.5lld (%L) %A %D,%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to);
......
...@@ -85,8 +85,8 @@ Pconv(Fmt *fp) ...@@ -85,8 +85,8 @@ Pconv(Fmt *fp)
switch(p->as) { switch(p->as) {
case ADATA: case ADATA:
sprint(str, "%.5lld (%L) %A %D/%d,%D", sprint(str, "%.5lld (%L) %A %D/%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from.scale, &p->to); p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break; break;
case ATEXT: case ATEXT:
......
...@@ -72,8 +72,8 @@ Pconv(Fmt *fp) ...@@ -72,8 +72,8 @@ Pconv(Fmt *fp)
bigP = p; bigP = p;
switch(p->as) { switch(p->as) {
case ADATA: case ADATA:
sprint(str, "%.5lld (%L) %A %D/%d,%D", sprint(str, "%.5lld (%L) %A %D/%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from.scale, &p->to); p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break; break;
case ATEXT: case ATEXT:
......
...@@ -94,7 +94,7 @@ Pconv(Fmt *fp) ...@@ -94,7 +94,7 @@ Pconv(Fmt *fp)
str[0] = 0; str[0] = 0;
if(a == ADATA || a == AINIT || a == ADYNT) if(a == ADATA || a == AINIT || a == ADYNT)
sprint(str, "%.5lld (%L) %A %D/%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to); sprint(str, "%.5lld (%L) %A %D/%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to);
else if(a == ATEXT || a == AGLOBL) { else if(a == ATEXT || a == AGLOBL) {
if(p->from3.offset != 0) if(p->from3.offset != 0)
sprint(str, "%.5lld (%L) %A %D,%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to); sprint(str, "%.5lld (%L) %A %D,%lld,%D", p->pc, p->lineno, a, &p->from, p->from3.offset, &p->to);
......
...@@ -47,12 +47,6 @@ iscall(Prog *p) ...@@ -47,12 +47,6 @@ iscall(Prog *p)
return p->as == ABL; return p->as == ABL;
} }
static int
datasize(Prog *p)
{
return p->reg;
}
static void static void
progedit(Link *ctxt, Prog *p) progedit(Link *ctxt, Prog *p)
{ {
...@@ -1015,7 +1009,6 @@ LinkArch linkarm = { ...@@ -1015,7 +1009,6 @@ LinkArch linkarm = {
.preprocess = preprocess, .preprocess = preprocess,
.assemble = span5, .assemble = span5,
.datasize = datasize,
.follow = follow, .follow = follow,
.iscall = iscall, .iscall = iscall,
.isdata = isdata, .isdata = isdata,
......
...@@ -59,12 +59,6 @@ iscall(Prog *p) ...@@ -59,12 +59,6 @@ iscall(Prog *p)
return p->as == ACALL; return p->as == ACALL;
} }
static int
datasize(Prog *p)
{
return p->from.scale;
}
static void nacladdr(Link*, Prog*, Addr*); static void nacladdr(Link*, Prog*, Addr*);
static int static int
...@@ -1052,7 +1046,6 @@ LinkArch linkamd64 = { ...@@ -1052,7 +1046,6 @@ LinkArch linkamd64 = {
.preprocess = preprocess, .preprocess = preprocess,
.assemble = span6, .assemble = span6,
.datasize = datasize,
.follow = follow, .follow = follow,
.iscall = iscall, .iscall = iscall,
.isdata = isdata, .isdata = isdata,
...@@ -1083,7 +1076,6 @@ LinkArch linkamd64p32 = { ...@@ -1083,7 +1076,6 @@ LinkArch linkamd64p32 = {
.preprocess = preprocess, .preprocess = preprocess,
.assemble = span6, .assemble = span6,
.datasize = datasize,
.follow = follow, .follow = follow,
.iscall = iscall, .iscall = iscall,
.isdata = isdata, .isdata = isdata,
......
...@@ -47,12 +47,6 @@ iscall(Prog *p) ...@@ -47,12 +47,6 @@ iscall(Prog *p)
return p->as == ACALL; return p->as == ACALL;
} }
static int
datasize(Prog *p)
{
return p->from.scale;
}
static int static int
canuselocaltls(Link *ctxt) canuselocaltls(Link *ctxt)
{ {
...@@ -851,7 +845,6 @@ LinkArch link386 = { ...@@ -851,7 +845,6 @@ LinkArch link386 = {
.preprocess = preprocess, .preprocess = preprocess,
.assemble = span8, .assemble = span8,
.datasize = datasize,
.follow = follow, .follow = follow,
.iscall = iscall, .iscall = iscall,
.isdata = isdata, .isdata = isdata,
......
...@@ -47,12 +47,6 @@ iscall(Prog *p) ...@@ -47,12 +47,6 @@ iscall(Prog *p)
return p->as == ABL; return p->as == ABL;
} }
static int
datasize(Prog *p)
{
return p->reg;
}
static void static void
progedit(Link *ctxt, Prog *p) progedit(Link *ctxt, Prog *p)
{ {
...@@ -938,7 +932,6 @@ LinkArch linkppc64 = { ...@@ -938,7 +932,6 @@ LinkArch linkppc64 = {
.preprocess = preprocess, .preprocess = preprocess,
.assemble = span9, .assemble = span9,
.datasize = datasize,
.follow = follow, .follow = follow,
.iscall = iscall, .iscall = iscall,
.isdata = isdata, .isdata = isdata,
...@@ -969,7 +962,6 @@ LinkArch linkppc64le = { ...@@ -969,7 +962,6 @@ LinkArch linkppc64le = {
.preprocess = preprocess, .preprocess = preprocess,
.assemble = span9, .assemble = span9,
.datasize = datasize,
.follow = follow, .follow = follow,
.iscall = iscall, .iscall = iscall,
.isdata = isdata, .isdata = isdata,
......
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