Commit 77a415e5 authored by Russ Cox's avatar Russ Cox

liblink: place TEXT/GLOBL flags in p->from3 always

Before, amd64 and 386 stored the flags in p->from.scale
and arm and ppc64 stored the flags in p->reg.
Both caused special cases in printing and in handling of the
addresses.

To avoid possible conflicts with the real meaning of p->from
and to avoid storing a non-register value in a reg field,
use from3 to hold a TYPE_CONST value giving the flags.

There is still a special case for printing, because the flags
are specified without a $, and normally a TYPE_CONST prints
with a $. But that's much less special than what came before.

This allows us to remove the textflag and settextflag methods
from LinkArch. They are no longer architecture-specific.

Change-Id: I931da8e1ecd92e127cd9aa44ef5a73c42e730110
Reviewed-on: https://go-review.googlesource.com/3572Reviewed-by: default avatarAustin Clements <austin@google.com>
parent 72521319
......@@ -210,7 +210,7 @@ struct Reloc
};
// TODO(rsc): Describe prog.
// TOOD(rsc): Make ARM scond == 0 mean C_SCOND_NONE.
// TODO(rsc): Describe TEXT/GLOBL flag in from3, DATA width in from3.
struct Prog
{
vlong pc;
......@@ -224,7 +224,7 @@ struct Prog
int16 reg; // arm, ppc64 only (e.g., ADD from, reg, to);
// starts at 0 for both GPRs and FPRs;
// also used for ADATA width on arm, ppc64
Addr from3; // ppc64 only (e.g., RLWM/FMADD from, reg, from3, to)
Addr from3; // addl source argument (e.g., RLWM/FMADD from, reg, from3, to)
Addr to;
// for 5g, 6g, 8g internal use
......@@ -245,8 +245,6 @@ struct Prog
char width; /* fake for DATA */
char mode; /* 16, 32, or 64 in 6l, 8l; internal use in 5g, 6g, 8g */
/*c2go uchar TEXTFLAG; */
};
// prevent incompatible type signatures between liblink and 8l on Plan 9
......@@ -604,8 +602,6 @@ struct LinkArch
int (*isdata)(Prog*);
Prog* (*prg)(void);
void (*progedit)(Link*, Prog*);
void (*settextflag)(Prog*, int);
int (*textflag)(Prog*);
int minlc;
int ptrsize;
......
......@@ -127,6 +127,7 @@ EXTERN int32 thunk;
EXTERN Biobuf obuf;
EXTERN Link* ctxt;
EXTERN Biobuf bstdout;
EXTERN Prog* lastpc;
void* alloc(int32);
void* allocn(void*, int32, int32);
......
......@@ -220,7 +220,11 @@ inst:
| LTYPEB name ',' con ',' '$' textsize
{
settext($2.sym);
outcode($1, Always, &$2, $4, &$7);
outcode($1, Always, &$2, 0, &$7);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
/*
* GLOBL
......@@ -233,7 +237,11 @@ inst:
| LGLOBL name ',' con ',' imm
{
settext($2.sym);
outcode($1, Always, &$2, $4, &$6);
outcode($1, Always, &$2, 0, &$6);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
/*
* DATA
......
......@@ -497,8 +497,6 @@ static int bcode[] =
ANOP,
};
static Prog *lastpc;
void
outcode(int a, int scond, Addr *g1, int reg, Addr *g2)
{
......
This diff is collapsed.
......@@ -9,8 +9,6 @@
#include "../gc/go.h"
#include "../5l/5.out.h"
#define TEXTFLAG reg
enum
{
REGALLOC_R0 = REG_R0,
......
......@@ -200,9 +200,9 @@ ggloblnod(Node *nam)
p->to.type = TYPE_CONST;
p->to.offset = nam->type->width;
if(nam->readonly)
p->reg = RODATA;
p->from3.offset = RODATA;
if(nam->type != T && !haspointers(nam->type))
p->reg |= NOPTR;
p->from3.offset |= NOPTR;
}
void
......@@ -217,7 +217,7 @@ ggloblsym(Sym *s, int32 width, int8 flags)
p->to.type = TYPE_CONST;
p->to.name = NAME_NONE;
p->to.offset = width;
p->reg = flags;
p->from3.offset = flags;
}
void
......
......@@ -139,6 +139,7 @@ EXTERN int32 thunk;
EXTERN Biobuf obuf;
EXTERN Link* ctxt;
EXTERN Biobuf bstdout;
EXTERN Prog* lastpc;
void* alloc(int32);
void* allocn(void*, int32, int32);
......
......@@ -60,8 +60,8 @@
%type <lval> con expr pointer offset
%type <addr> mem imm reg nam rel rem rim rom omem nmem textsize
%type <addr2> nonnon nonrel nonrem rimnon rimrem remrim
%type <addr2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9
%type <addr2> spec10 spec11 spec12 spec13
%type <addr2> spec1 spec3 spec4 spec5 spec6 spec7 spec8 spec9
%type <addr2> spec10 spec12 spec13
%%
prog:
| prog
......@@ -103,7 +103,7 @@ inst:
| LTYPE4 remrim { outcode($1, &$2); }
| LTYPER nonrel { outcode($1, &$2); }
| LTYPED spec1 { outcode($1, &$2); }
| LTYPET spec2 { outcode($1, &$2); }
| spec2
| LTYPEC spec3 { outcode($1, &$2); }
| LTYPEN spec4 { outcode($1, &$2); }
| LTYPES spec5 { outcode($1, &$2); }
......@@ -112,7 +112,7 @@ inst:
| LTYPEXC spec8 { outcode($1, &$2); }
| LTYPEX spec9 { outcode($1, &$2); }
| LTYPERT spec10 { outcode($1, &$2); }
| LTYPEG spec11 { outcode($1, &$2); }
| spec11
| LTYPEPC spec12 { outcode($1, &$2); }
| LTYPEF spec13 { outcode($1, &$2); }
......@@ -191,18 +191,47 @@ spec1: /* DATA */
}
spec2: /* TEXT */
mem ',' '$' textsize
LTYPET mem ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.to = $4;
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $5;
outcode(ATEXT, &a);
}
| mem ',' con ',' '$' textsize
| LTYPET mem ',' con ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.from.scale = $3;
$$.to = $6;
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $7;
outcode(ATEXT, &a);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
spec11: /* GLOBL */
LTYPEG mem ',' imm
{
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $4;
outcode(AGLOBL, &a);
}
| LTYPEG mem ',' con ',' imm
{
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $6;
outcode(AGLOBL, &a);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
spec3: /* JMP/CALL */
......@@ -297,19 +326,6 @@ spec10: /* RET/RETF */
$$.to = nullgen;
}
spec11: /* GLOBL */
mem ',' imm
{
$$.from = $1;
$$.to = $3;
}
| mem ',' con ',' imm
{
$$.from = $1;
$$.from.scale = $3;
$$.to = $5;
}
spec12: /* PCDATA */
rim ',' rim
{
......
......@@ -1104,8 +1104,6 @@ cclean(void)
outcode(AEND, &g2);
}
static Prog *lastpc;
void
outcode(int a, Addr2 *g2)
{
......
This diff is collapsed.
......@@ -9,8 +9,6 @@
#include "../gc/go.h"
#include "../6l/6.out.h"
#define TEXTFLAG from.scale
EXTERN int32 dynloc;
EXTERN uchar reg[MAXREG];
EXTERN int32 pcloc; // instruction counter
......
......@@ -198,9 +198,9 @@ ggloblnod(Node *nam)
p->to.type = TYPE_CONST;
p->to.offset = nam->type->width;
if(nam->readonly)
p->from.scale = RODATA;
p->from3.offset = RODATA;
if(nam->type != T && !haspointers(nam->type))
p->from.scale |= NOPTR;
p->from3.offset |= NOPTR;
}
void
......@@ -225,7 +225,7 @@ ggloblsym(Sym *s, int32 width, int8 flags)
p->from.sym = linksym(s);
p->to.type = TYPE_CONST;
p->to.offset = width;
p->from.scale = flags;
p->from3.offset = flags;
}
int
......
......@@ -139,6 +139,7 @@ EXTERN int32 thunk;
EXTERN Biobuf obuf;
EXTERN Link* ctxt;
EXTERN Biobuf bstdout;
EXTERN Prog* lastpc;
void* alloc(int32);
void* allocn(void*, int32, int32);
......
......@@ -59,7 +59,7 @@
%type <lval> con expr pointer offset
%type <addr> mem imm reg nam rel rem rim rom omem nmem textsize
%type <addr2> nonnon nonrel nonrem rimnon rimrem remrim
%type <addr2> spec1 spec2 spec3 spec4 spec5 spec6 spec7 spec8 spec9 spec10 spec11 spec12
%type <addr2> spec1 spec3 spec4 spec5 spec6 spec7 spec9 spec10 spec11 spec12
%%
prog:
| prog
......@@ -101,13 +101,13 @@ inst:
| LTYPE4 remrim { outcode($1, &$2); }
| LTYPER nonrel { outcode($1, &$2); }
| LTYPED spec1 { outcode($1, &$2); }
| LTYPET spec2 { outcode($1, &$2); }
| spec2
| LTYPEC spec3 { outcode($1, &$2); }
| LTYPEN spec4 { outcode($1, &$2); }
| LTYPES spec5 { outcode($1, &$2); }
| LTYPEM spec6 { outcode($1, &$2); }
| LTYPEI spec7 { outcode($1, &$2); }
| LTYPEG spec8 { outcode($1, &$2); }
| spec8
| LTYPEXC spec9 { outcode($1, &$2); }
| LTYPEX spec10 { outcode($1, &$2); }
| LTYPEPC spec11 { outcode($1, &$2); }
......@@ -188,18 +188,47 @@ spec1: /* DATA */
}
spec2: /* TEXT */
mem ',' '$' textsize
LTYPET mem ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.to = $4;
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $5;
outcode(ATEXT, &a);
}
| mem ',' con ',' '$' textsize
| LTYPET mem ',' con ',' '$' textsize
{
settext($1.sym);
$$.from = $1;
$$.from.scale = $3;
$$.to = $6;
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $7;
outcode(ATEXT, &a);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
spec8: /* GLOBL */
LTYPEG mem ',' imm
{
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $4;
outcode(AGLOBL, &a);
}
| LTYPEG mem ',' con ',' imm
{
Addr2 a;
settext($2.sym);
a.from = $2;
a.to = $6;
outcode(AGLOBL, &a);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
spec3: /* JMP/CALL */
......@@ -271,19 +300,6 @@ spec7:
$$.to = $3;
}
spec8: /* GLOBL */
mem ',' imm
{
$$.from = $1;
$$.to = $3;
}
| mem ',' con ',' imm
{
$$.from = $1;
$$.from.scale = $3;
$$.to = $5;
}
spec9: /* CMPPS/CMPPD */
reg ',' rem ',' con
{
......
......@@ -881,8 +881,6 @@ cclean(void)
outcode(AEND, &g2);
}
static Prog *lastpc;
void
outcode(int a, Addr2 *g2)
{
......
This diff is collapsed.
......@@ -9,8 +9,6 @@
#include "../gc/go.h"
#include "../8l/8.out.h"
#define TEXTFLAG from.scale
// foptoas flags
enum
{
......
......@@ -200,9 +200,9 @@ ggloblnod(Node *nam)
p->to.type = TYPE_CONST;
p->to.offset = nam->type->width;
if(nam->readonly)
p->from.scale = RODATA;
p->from3.offset = RODATA;
if(nam->type != T && !haspointers(nam->type))
p->from.scale |= NOPTR;
p->from3.offset |= NOPTR;
}
void
......@@ -218,7 +218,7 @@ ggloblsym(Sym *s, int32 width, int8 flags)
p->to.type = TYPE_CONST;
p->to.index = REG_NONE;
p->to.offset = width;
p->from.scale = flags;
p->from3.offset = flags;
}
void
......
......@@ -126,6 +126,7 @@ EXTERN int32 thunk;
EXTERN Biobuf obuf;
EXTERN Link* ctxt;
EXTERN Biobuf bstdout;
EXTERN Prog* lastpc;
void* alloc(int32);
void* allocn(void*, int32, int32);
......
......@@ -621,7 +621,11 @@ inst:
| LTEXT name ',' con ',' '$' textsize
{
settext($2.sym);
outcode($1, &$2, $4, &$7);
outcode($1, &$2, 0, &$7);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
/*
* GLOBL
......@@ -634,7 +638,11 @@ inst:
| LGLOBL name ',' con ',' imm
{
settext($2.sym);
outcode($1, &$2, $4, &$6);
outcode($1, &$2, 0, &$6);
if(pass > 1) {
lastpc->from3.type = TYPE_CONST;
lastpc->from3.offset = $4;
}
}
/*
......
......@@ -650,8 +650,6 @@ cclean(void)
outcode(AEND, &nullgen, 0, &nullgen);
}
static Prog *lastpc;
void
outcode(int a, Addr *g1, int reg, Addr *g2)
{
......
This diff is collapsed.
......@@ -12,8 +12,6 @@
// TODO(minux): Remove when no longer used.
#define noimpl sysfatal("%s not implemented (%s:%d).", __func__, __FILE__, __LINE__)
#define TEXTFLAG reg
EXTERN int32 dynloc;
EXTERN uchar reg[NREG+NFREG];
EXTERN int32 pcloc; // instruction counter
......
......@@ -200,9 +200,9 @@ ggloblnod(Node *nam)
p->to.type = TYPE_CONST;
p->to.offset = nam->type->width;
if(nam->readonly)
p->reg = RODATA;
p->from3.offset = RODATA;
if(nam->type != T && !haspointers(nam->type))
p->reg |= NOPTR;
p->from3.offset |= NOPTR;
}
void
......@@ -228,7 +228,7 @@ ggloblsym(Sym *s, int32 width, int8 flags)
p->to.type = TYPE_CONST;
p->to.name = NAME_NONE;
p->to.offset = width;
p->reg = flags;
p->from3.offset = flags;
}
int
......
......@@ -231,20 +231,20 @@ compile(Node *fn)
nodconst(&nod1, types[TINT32], 0);
ptxt = arch.gins(arch.ATEXT, isblank(curfn->nname) ? N : curfn->nname, &nod1);
if(fn->dupok)
arch.thelinkarch->settextflag(ptxt, arch.thelinkarch->textflag(ptxt) | DUPOK);
ptxt->from3.offset |= DUPOK;
if(fn->wrapper)
arch.thelinkarch->settextflag(ptxt, arch.thelinkarch->textflag(ptxt) | WRAPPER);
ptxt->from3.offset |= WRAPPER;
if(fn->needctxt)
arch.thelinkarch->settextflag(ptxt, arch.thelinkarch->textflag(ptxt) | NEEDCTXT);
ptxt->from3.offset |= NEEDCTXT;
if(fn->nosplit)
arch.thelinkarch->settextflag(ptxt, arch.thelinkarch->textflag(ptxt) | NOSPLIT);
ptxt->from3.offset |= NOSPLIT;
// Clumsy but important.
// See test/recover.go for test cases and src/reflect/value.go
// for the actual functions being considered.
if(myimportpath != nil && strcmp(myimportpath, "reflect") == 0) {
if(strcmp(curfn->nname->sym->name, "callReflect") == 0 || strcmp(curfn->nname->sym->name, "callMethod") == 0)
arch.thelinkarch->settextflag(ptxt, arch.thelinkarch->textflag(ptxt) | WRAPPER);
ptxt->from3.offset |= WRAPPER;
}
arch.afunclit(&ptxt->from, curfn->nname);
......
......@@ -72,7 +72,6 @@ static Optab optab[] =
/* struct Optab:
OPCODE, from, prog->reg, to, type,size,param,flag */
{ ATEXT, C_ADDR, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_TEXTSIZE, 0, 0, 0 },
{ AADD, C_REG, C_REG, C_REG, 1, 4, 0 },
{ AADD, C_REG, C_NONE, C_REG, 1, 4, 0 },
......
......@@ -60,13 +60,9 @@ struct Optab
static Optab optab[] = {
{ ATEXT, C_LEXT, C_NONE, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_LEXT, C_REG, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_LEXT, C_NONE, C_LCON, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_LEXT, C_REG, C_LCON, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_NONE, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_NONE, C_LCON, C_TEXTSIZE, 0, 0, 0 },
{ ATEXT, C_ADDR, C_REG, C_LCON, C_TEXTSIZE, 0, 0, 0 },
/* move register */
{ AMOVD, C_REG, C_NONE, C_NONE, C_REG, 1, 4, 0 },
......
......@@ -112,7 +112,7 @@ Pconv(Fmt *fp)
sprint(str, "%.5lld (%L) %A %D/%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
else
if(p->as == ATEXT)
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(p->reg == 0)
sprint(str, "%.5lld (%L) %A%s %D,%D", p->pc, p->lineno, a, sc, &p->from, &p->to);
......
......@@ -90,9 +90,9 @@ Pconv(Fmt *fp)
break;
case ATEXT:
if(p->from.scale) {
sprint(str, "%.5lld (%L) %A %D,%d,%D",
p->pc, p->lineno, p->as, &p->from, p->from.scale, &p->to);
if(p->from3.offset) {
sprint(str, "%.5lld (%L) %A %D,%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break;
}
sprint(str, "%.5lld (%L) %A %D,%D",
......
......@@ -77,9 +77,9 @@ Pconv(Fmt *fp)
break;
case ATEXT:
if(p->from.scale) {
sprint(str, "%.5lld (%L) %A %D,%d,%D",
p->pc, p->lineno, p->as, &p->from, p->from.scale, &p->to);
if(p->from3.offset) {
sprint(str, "%.5lld (%L) %A %D,%lld,%D",
p->pc, p->lineno, p->as, &p->from, p->from3.offset, &p->to);
break;
}
sprint(str, "%.5lld (%L) %A %D,%D",
......
......@@ -95,14 +95,9 @@ Pconv(Fmt *fp)
str[0] = 0;
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);
else if(a == ATEXT) {
if(p->reg != 0)
sprint(str, "%.5lld (%L) %A %D,%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
else
sprint(str, "%.5lld (%L) %A %D,%D", p->pc, p->lineno, a, &p->from, &p->to);
} else if(a == AGLOBL) {
if(p->reg != 0)
sprint(str, "%.5lld (%L) %A %D,%d,%D", p->pc, p->lineno, a, &p->from, p->reg, &p->to);
else if(a == ATEXT || a == AGLOBL) {
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);
else
sprint(str, "%.5lld (%L) %A %D,%D", p->pc, p->lineno, a, &p->from, &p->to);
} else {
......
......@@ -58,18 +58,6 @@ datasize(Prog *p)
return p->reg;
}
static int
textflag(Prog *p)
{
return p->reg;
}
static void
settextflag(Prog *p, int f)
{
p->reg = f;
}
static void
progedit(Link *ctxt, Prog *p)
{
......@@ -268,7 +256,7 @@ preprocess(Link *ctxt, LSym *cursym)
cursym->args = p->to.u.argsize;
if(ctxt->debugzerostack) {
if(autoffset && !(p->reg&NOSPLIT)) {
if(autoffset && !(p->from3.offset&NOSPLIT)) {
// MOVW $4(R13), R1
p = appendp(ctxt, p);
p->as = AMOVW;
......@@ -421,8 +409,8 @@ preprocess(Link *ctxt, LSym *cursym)
break;
}
if(!(p->reg & NOSPLIT))
p = stacksplit(ctxt, p, autosize, !(cursym->text->reg&NEEDCTXT)); // emit split check
if(!(p->from3.offset & NOSPLIT))
p = stacksplit(ctxt, p, autosize, !(cursym->text->from3.offset&NEEDCTXT)); // emit split check
// MOVW.W R14,$-autosize(SP)
p = appendp(ctxt, p);
......@@ -435,7 +423,7 @@ preprocess(Link *ctxt, LSym *cursym)
p->to.reg = REGSP;
p->spadj = autosize;
if(cursym->text->reg & WRAPPER) {
if(cursym->text->from3.offset & WRAPPER) {
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
//
// MOVW g_panic(g), R1
......@@ -1048,8 +1036,6 @@ LinkArch linkarm = {
.isdata = isdata,
.prg = prg,
.progedit = progedit,
.settextflag = settextflag,
.textflag = textflag,
.minlc = 4,
.ptrsize = 4,
......
......@@ -78,18 +78,6 @@ datasize(Prog *p)
return p->from.scale;
}
static int
textflag(Prog *p)
{
return p->from.scale;
}
static void
settextflag(Prog *p, int f)
{
p->from.scale = f;
}
static void nacladdr(Link*, Prog*, Addr*);
static int
......@@ -404,24 +392,24 @@ preprocess(Link *ctxt, LSym *cursym)
cursym->args = textarg;
cursym->locals = p->to.offset;
if(autoffset < StackSmall && !(p->from.scale & NOSPLIT)) {
if(autoffset < StackSmall && !(p->from3.offset & NOSPLIT)) {
for(q = p; q != nil; q = q->link) {
if(q->as == ACALL)
goto noleaf;
if((q->as == ADUFFCOPY || q->as == ADUFFZERO) && autoffset >= StackSmall - 8)
goto noleaf;
}
p->from.scale |= NOSPLIT;
p->from3.offset |= NOSPLIT;
noleaf:;
}
q = nil;
if(!(p->from.scale & NOSPLIT) || (p->from.scale & WRAPPER)) {
if(!(p->from3.offset & NOSPLIT) || (p->from3.offset & WRAPPER)) {
p = appendp(ctxt, p);
p = load_g_cx(ctxt, p); // load g into CX
}
if(!(cursym->text->from.scale & NOSPLIT))
p = stacksplit(ctxt, p, autoffset, textarg, !(cursym->text->from.scale&NEEDCTXT), &q); // emit split check
if(!(cursym->text->from3.offset & NOSPLIT))
p = stacksplit(ctxt, p, autoffset, textarg, !(cursym->text->from3.offset&NEEDCTXT), &q); // emit split check
if(autoffset) {
if(autoffset%ctxt->arch->regsize != 0)
......@@ -468,7 +456,7 @@ preprocess(Link *ctxt, LSym *cursym)
p->to.reg = REG_BP;
}
if(cursym->text->from.scale & WRAPPER) {
if(cursym->text->from3.offset & WRAPPER) {
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
//
// MOVQ g_panic(CX), BX
......@@ -564,7 +552,7 @@ preprocess(Link *ctxt, LSym *cursym)
p2->pcond = p;
}
if(ctxt->debugzerostack && autoffset && !(cursym->text->from.scale&NOSPLIT)) {
if(ctxt->debugzerostack && autoffset && !(cursym->text->from3.offset&NOSPLIT)) {
// 6l -Z means zero the stack frame on entry.
// This slows down function calls but can help avoid
// false positives in garbage collection.
......@@ -1093,8 +1081,6 @@ LinkArch linkamd64 = {
.isdata = isdata,
.prg = prg,
.progedit = progedit,
.settextflag = settextflag,
.textflag = textflag,
.minlc = 1,
.ptrsize = 8,
......@@ -1127,8 +1113,6 @@ LinkArch linkamd64p32 = {
.isdata = isdata,
.prg = prg,
.progedit = progedit,
.settextflag = settextflag,
.textflag = textflag,
.minlc = 1,
.ptrsize = 4,
......
......@@ -68,18 +68,6 @@ datasize(Prog *p)
return p->from.scale;
}
static int
textflag(Prog *p)
{
return p->from.scale;
}
static void
settextflag(Prog *p, int f)
{
p->from.scale = f;
}
static int
canuselocaltls(Link *ctxt)
{
......@@ -302,12 +290,12 @@ preprocess(Link *ctxt, LSym *cursym)
q = nil;
if(!(p->from.scale & NOSPLIT) || (p->from.scale & WRAPPER)) {
if(!(p->from3.offset & NOSPLIT) || (p->from3.offset & WRAPPER)) {
p = appendp(ctxt, p);
p = load_g_cx(ctxt, p); // load g into CX
}
if(!(cursym->text->from.scale & NOSPLIT))
p = stacksplit(ctxt, p, autoffset, !(cursym->text->from.scale&NEEDCTXT), &q); // emit split check
if(!(cursym->text->from3.offset & NOSPLIT))
p = stacksplit(ctxt, p, autoffset, !(cursym->text->from3.offset&NEEDCTXT), &q); // emit split check
if(autoffset) {
p = appendp(ctxt, p);
......@@ -330,7 +318,7 @@ preprocess(Link *ctxt, LSym *cursym)
q->pcond = p;
deltasp = autoffset;
if(cursym->text->from.scale & WRAPPER) {
if(cursym->text->from3.offset & WRAPPER) {
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
//
// MOVL g_panic(CX), BX
......@@ -401,7 +389,7 @@ preprocess(Link *ctxt, LSym *cursym)
p2->pcond = p;
}
if(ctxt->debugzerostack && autoffset && !(cursym->text->from.scale&NOSPLIT)) {
if(ctxt->debugzerostack && autoffset && !(cursym->text->from3.offset&NOSPLIT)) {
// 8l -Z means zero the stack frame on entry.
// This slows down function calls but can help avoid
// false positives in garbage collection.
......@@ -894,8 +882,6 @@ LinkArch link386 = {
.isdata = isdata,
.prg = prg,
.progedit = progedit,
.settextflag = settextflag,
.textflag = textflag,
.minlc = 1,
.ptrsize = 4,
......
......@@ -57,18 +57,6 @@ datasize(Prog *p)
return p->reg;
}
static int
textflag(Prog *p)
{
return p->reg;
}
static void
settextflag(Prog *p, int f)
{
p->reg = f;
}
static void
progedit(Link *ctxt, Prog *p)
{
......@@ -367,8 +355,8 @@ preprocess(Link *ctxt, LSym *cursym)
autosize += 4;
p->to.offset = autosize-8;
if(!(p->reg & NOSPLIT))
p = stacksplit(ctxt, p, autosize, !(cursym->text->reg&NEEDCTXT)); // emit split check
if(!(p->from3.offset & NOSPLIT))
p = stacksplit(ctxt, p, autosize, !(cursym->text->from3.offset&NEEDCTXT)); // emit split check
q = p;
if(autosize) {
......@@ -420,7 +408,7 @@ preprocess(Link *ctxt, LSym *cursym)
if(q->as == AMOVDU)
q->spadj = -aoffset;
if(cursym->text->reg & WRAPPER) {
if(cursym->text->from3.offset & WRAPPER) {
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
//
// MOVD g_panic(g), R3
......@@ -970,8 +958,6 @@ LinkArch linkppc64 = {
.isdata = isdata,
.prg = prg,
.progedit = progedit,
.settextflag = settextflag,
.textflag = textflag,
.minlc = 4,
.ptrsize = 8,
......@@ -1004,8 +990,6 @@ LinkArch linkppc64le = {
.isdata = isdata,
.prg = prg,
.progedit = progedit,
.settextflag = settextflag,
.textflag = textflag,
.minlc = 4,
.ptrsize = 8,
......
......@@ -189,7 +189,7 @@ writeobj(Link *ctxt, Biobuf *b)
s->size = p->to.offset;
if(s->type == 0 || s->type == SXREF)
s->type = SBSS;
flag = ctxt->arch->textflag(p);
flag = p->from3.offset;
if(flag & DUPOK)
s->dupok = 1;
if(flag & RODATA)
......@@ -222,7 +222,7 @@ writeobj(Link *ctxt, Biobuf *b)
else
etext->next = s;
etext = s;
flag = ctxt->arch->textflag(p);
flag = p->from3.offset;
if(flag & DUPOK)
s->dupok = 1;
if(flag & NOSPLIT)
......
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