mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
move Auto to CGstate.Auto
This commit is contained in:
parent
978cdca8b9
commit
1f963ecf3b
6 changed files with 32 additions and 32 deletions
|
@ -69,7 +69,6 @@ targ_size_t pushoff; // offset of saved registers
|
|||
bool pushoffuse; // using pushoff
|
||||
int BPoff; // offset from BP
|
||||
int EBPtoESP; // add to EBP offset to get ESP offset
|
||||
LocalSection Auto; // section of automatics and registers
|
||||
LocalSection Fast; // section of fastpar
|
||||
LocalSection EEStack; // offset of SCstack variables from ESP
|
||||
LocalSection Alloca; // data for alloca() temporary
|
||||
|
@ -653,7 +652,7 @@ void prolog(ref CodeBuilder cdb)
|
|||
{
|
||||
bool enter;
|
||||
|
||||
//printf("cod3.prolog() %s, needframe = %d, Auto.alignment = %d\n", funcsym_p.Sident.ptr, needframe, Auto.alignment);
|
||||
//printf("cod3.prolog() %s, needframe = %d, Auto.alignment = %d\n", funcsym_p.Sident.ptr, needframe, cgstate.Auto.alignment);
|
||||
debug debugw && printf("funcstart()\n");
|
||||
regcon.immed.mval = 0; /* no values in registers yet */
|
||||
version (FRAMEPTR)
|
||||
|
@ -803,11 +802,11 @@ else
|
|||
|
||||
Fast.size = alignsection(Fast.size - Fast.offset, Fast.alignment, bias);
|
||||
|
||||
if (Auto.alignment < REGSIZE)
|
||||
Auto.alignment = REGSIZE; // necessary because localsize must be REGSIZE aligned
|
||||
Auto.size = alignsection(Fast.size - Auto.offset, Auto.alignment, bias);
|
||||
if (cgstate.Auto.alignment < REGSIZE)
|
||||
cgstate.Auto.alignment = REGSIZE; // necessary because localsize must be REGSIZE aligned
|
||||
cgstate.Auto.size = alignsection(Fast.size - cgstate.Auto.offset, cgstate.Auto.alignment, bias);
|
||||
|
||||
regsave.off = alignsection(Auto.size - regsave.top, regsave.alignment, bias);
|
||||
regsave.off = alignsection(cgstate.Auto.size - regsave.top, regsave.alignment, bias);
|
||||
//printf("regsave.off = x%x, size = x%x, alignment = %x\n",
|
||||
//cast(int)regsave.off, cast(int)(regsave.top), cast(int)regsave.alignment);
|
||||
|
||||
|
@ -852,7 +851,7 @@ else
|
|||
}
|
||||
}
|
||||
|
||||
//printf("Fast.size = x%x, Auto.size = x%x\n", cast(int)Fast.size, cast(int)Auto.size);
|
||||
//printf("Fast.size = x%x, Auto.size = x%x\n", cast(int)Fast.size, cast(int)cgstate.Auto.size);
|
||||
|
||||
cgstate.funcarg.alignment = STACKALIGN;
|
||||
/* If the function doesn't need the extra alignment, don't do it.
|
||||
|
@ -899,7 +898,7 @@ else
|
|||
cgstate.funcarg.offset = -localsize;
|
||||
|
||||
//printf("Foff x%02x Auto.size x%02x NDPoff x%02x CSoff x%02x Para.size x%02x localsize x%02x\n",
|
||||
//(int)Foff,(int)Auto.size,(int)NDPoff,(int)CSoff,(int)cgstate.Para.size,(int)localsize);
|
||||
//(int)Foff,(int)cgstate.Auto.size,(int)NDPoff,(int)CSoff,(int)cgstate.Para.size,(int)localsize);
|
||||
|
||||
uint xlocalsize = cast(uint)localsize; // amount to subtract from ESP to make room for locals
|
||||
|
||||
|
@ -1056,8 +1055,8 @@ Lcont:
|
|||
|
||||
/* Alignment checks
|
||||
*/
|
||||
//assert(Auto.alignment <= STACKALIGN);
|
||||
//assert(((Auto.size + cgstate.Para.size + BPoff) & (Auto.alignment - 1)) == 0);
|
||||
//assert(cgstate.Auto.alignment <= STACKALIGN);
|
||||
//assert(((cgstate.Auto.size + cgstate.Para.size + BPoff) & (cgstate.Auto.alignment - 1)) == 0);
|
||||
}
|
||||
|
||||
/************************************
|
||||
|
@ -1116,7 +1115,7 @@ void stackoffsets(ref symtab_t symtab, bool estimate)
|
|||
|
||||
cgstate.Para.initialize(); // parameter offset
|
||||
Fast.initialize(); // SCfastpar offset
|
||||
Auto.initialize(); // automatic & register offset
|
||||
cgstate.Auto.initialize(); // automatic & register offset
|
||||
EEStack.initialize(); // for SCstack's
|
||||
|
||||
// Set if doing optimization of auto layout
|
||||
|
@ -1213,13 +1212,13 @@ void stackoffsets(ref symtab_t symtab, bool estimate)
|
|||
break;
|
||||
}
|
||||
|
||||
Auto.offset = _align(sz,Auto.offset);
|
||||
s.Soffset = Auto.offset;
|
||||
Auto.offset += sz;
|
||||
cgstate.Auto.offset = _align(sz,cgstate.Auto.offset);
|
||||
s.Soffset = cgstate.Auto.offset;
|
||||
cgstate.Auto.offset += sz;
|
||||
//printf("auto '%s' sz = %d, auto offset = x%lx\n", s.Sident,sz, cast(long) s.Soffset);
|
||||
|
||||
if (alignsize > Auto.alignment)
|
||||
Auto.alignment = alignsize;
|
||||
if (alignsize > cgstate.Auto.alignment)
|
||||
cgstate.Auto.alignment = alignsize;
|
||||
break;
|
||||
|
||||
case SC.stack:
|
||||
|
@ -1306,15 +1305,15 @@ void stackoffsets(ref symtab_t symtab, bool estimate)
|
|||
}
|
||||
}
|
||||
}
|
||||
Auto.offset = _align(sz,Auto.offset);
|
||||
s.Soffset = Auto.offset;
|
||||
cgstate.Auto.offset = _align(sz,cgstate.Auto.offset);
|
||||
s.Soffset = cgstate.Auto.offset;
|
||||
//printf("auto '%s' sz = %d, auto offset = x%lx\n", s.Sident, sz, cast(long) s.Soffset);
|
||||
Auto.offset += sz;
|
||||
cgstate.Auto.offset += sz;
|
||||
if (s.Srange && !(s.Sflags & SFLspill))
|
||||
vec_setbit(si,tbl);
|
||||
|
||||
if (alignsize > Auto.alignment)
|
||||
Auto.alignment = alignsize;
|
||||
if (alignsize > cgstate.Auto.alignment)
|
||||
cgstate.Auto.alignment = alignsize;
|
||||
L2: { }
|
||||
}
|
||||
|
||||
|
|
|
@ -2525,7 +2525,7 @@ regm_t cod3_useBP()
|
|||
goto Lcant;
|
||||
|
||||
stackoffsets(globsym, true); // estimate stack offsets
|
||||
localsize = Auto.offset + Fast.offset; // an estimate only
|
||||
localsize = cgstate.Auto.offset + Fast.offset; // an estimate only
|
||||
// if (localsize)
|
||||
{
|
||||
if (!(config.flags4 & CFG4speed) ||
|
||||
|
@ -3842,7 +3842,7 @@ void prolog_genvarargs(ref CodeBuilder cdb, Symbol* sv)
|
|||
|
||||
/* Save registers into the voff area on the stack
|
||||
*/
|
||||
targ_size_t voff = Auto.size + BPoff + sv.Soffset; // EBP offset of start of sv
|
||||
targ_size_t voff = cgstate.Auto.size + BPoff + sv.Soffset; // EBP offset of start of sv
|
||||
const int vregnum = 6;
|
||||
const uint vsize = vregnum * 8 + 8 * 16;
|
||||
|
||||
|
@ -5125,9 +5125,9 @@ void cod3_adjSymOffsets()
|
|||
if (s.Sfl == FLfast)
|
||||
s.Soffset += Fast.size + BPoff;
|
||||
else
|
||||
//printf("s = '%s', Soffset = x%x, Auto.size = x%x, BPoff = x%x EBPtoESP = x%x\n", s.Sident, cast(int)s.Soffset, cast(int)Auto.size, cast(int)BPoff, cast(int)EBPtoESP);
|
||||
//printf("s = '%s', Soffset = x%x, Auto.size = x%x, BPoff = x%x EBPtoESP = x%x\n", s.Sident, cast(int)s.Soffset, cast(int)cgstate.Auto.size, cast(int)BPoff, cast(int)EBPtoESP);
|
||||
// if (!(funcsym_p.Sfunc.Fflags3 & Fnested))
|
||||
s.Soffset += Auto.size + BPoff;
|
||||
s.Soffset += cgstate.Auto.size + BPoff;
|
||||
break;
|
||||
|
||||
case SC.bprel:
|
||||
|
@ -5327,7 +5327,7 @@ void assignaddrc(code *c)
|
|||
|
||||
case FLreg:
|
||||
case FLauto:
|
||||
soff = Auto.size;
|
||||
soff = cgstate.Auto.size;
|
||||
L1:
|
||||
if (Symbol_Sisdead(*s, anyiasm))
|
||||
{
|
||||
|
@ -5505,7 +5505,7 @@ void assignaddrc(code *c)
|
|||
break;
|
||||
|
||||
case FLauto:
|
||||
c.IEV2.Vpointer += s.Soffset + Auto.size + BPoff;
|
||||
c.IEV2.Vpointer += s.Soffset + cgstate.Auto.size + BPoff;
|
||||
L3:
|
||||
if (!hasframe || (enforcealign && c.IFL2 != FLpara))
|
||||
/* Convert to ESP relative address instead of EBP */
|
||||
|
@ -5579,7 +5579,7 @@ targ_size_t cod3_bpoffset(Symbol *s)
|
|||
break;
|
||||
|
||||
case FLauto:
|
||||
offset += Auto.size + BPoff;
|
||||
offset += cgstate.Auto.size + BPoff;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -160,6 +160,7 @@ struct CGstate
|
|||
|
||||
LocalSection funcarg; // where function arguments are placed
|
||||
LocalSection Para; // section of function parameters
|
||||
LocalSection Auto; // section of automatics and registers
|
||||
|
||||
targ_size_t funcargtos; // current high water level of arguments being moved onto
|
||||
// the funcarg section. It is filled from top to bottom,
|
||||
|
|
|
@ -709,7 +709,7 @@ void cv8_outsym(Symbol *s)
|
|||
if (s.Sfl == FLreg)
|
||||
goto case_register;
|
||||
case_auto:
|
||||
base = cast(uint)Auto.size;
|
||||
base = cast(uint)cgstate.Auto.size;
|
||||
L1:
|
||||
if (s.Sscope) // local variables moved into the closure cannot be emitted directly
|
||||
break;
|
||||
|
|
|
@ -1644,7 +1644,7 @@ private void cv4_outsym(Symbol *s)
|
|||
if (s.Sfl == FLreg)
|
||||
goto case_register;
|
||||
case_auto:
|
||||
base = Auto.size;
|
||||
base = cgstate.Auto.size;
|
||||
L1:
|
||||
if (s.Sscope) // local variables moved into the closure cannot be emitted directly
|
||||
goto Lret;
|
||||
|
|
|
@ -1987,7 +1987,7 @@ static if (1)
|
|||
// sa.Sident.ptr, sa.Sscope.Sident.ptr, closptr_off, memb_off);
|
||||
|
||||
debug_info.buf.writeByte(DW_OP_fbreg);
|
||||
debug_info.buf.writesLEB128(cast(uint)(Auto.size + BPoff - cgstate.Para.size + closptr_off)); // closure pointer offset from frame base
|
||||
debug_info.buf.writesLEB128(cast(uint)(cgstate.Auto.size + BPoff - cgstate.Para.size + closptr_off)); // closure pointer offset from frame base
|
||||
debug_info.buf.writeByte(DW_OP_deref);
|
||||
debug_info.buf.writeByte(DW_OP_plus_uconst);
|
||||
debug_info.buf.writeuLEB128(cast(uint)memb_off); // closure variable offset
|
||||
|
@ -2003,7 +2003,7 @@ static if (1)
|
|||
else if (sa.Sclass == SC.bprel)
|
||||
debug_info.buf.writesLEB128(cast(int)(-cgstate.Para.size + sa.Soffset));
|
||||
else
|
||||
debug_info.buf.writesLEB128(cast(int)(Auto.size + BPoff - cgstate.Para.size + sa.Soffset));
|
||||
debug_info.buf.writesLEB128(cast(int)(cgstate.Auto.size + BPoff - cgstate.Para.size + sa.Soffset));
|
||||
}
|
||||
debug_info.buf.buf[soffset] = cast(ubyte)(debug_info.buf.length() - soffset - 1);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue