Skip to content

Commit

Permalink
remove some of the SC Enum aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
benjones committed Sep 1, 2022
1 parent 42be60c commit 0604517
Show file tree
Hide file tree
Showing 36 changed files with 459 additions and 459 deletions.
5 changes: 0 additions & 5 deletions compiler/src/dmd/backend/cdef.d
Original file line number Diff line number Diff line change
Expand Up @@ -974,11 +974,6 @@ enum SC : ubyte
adl, /// list of ADL symbols for overloading
}

enum SCunde = SC.unde;
enum SCauto = SC.auto_;
enum SCstatic = SC.static_;
enum SCthread = SC.thread;
enum SCextern = SC.extern_;
enum SCregister = SC.register;
enum SCpseudo = SC.pseudo;
enum SCglobal = SC.global;
Expand Down
24 changes: 12 additions & 12 deletions compiler/src/dmd/backend/cgcod.d
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ tryagain:

switch (s.Sclass)
{
case SCregister:
case SCauto:
case SCfastpar:
case SC.register:
case SC.auto_:
case SC.fastpar:
if (s.Sfl == FLreg)
break;

Expand Down Expand Up @@ -1332,7 +1332,7 @@ void stackoffsets(ref symtab_t symtab, bool estimate)

switch (s.Sclass)
{
case SCfastpar:
case SC.fastpar:
/* Get these
* right next to the stack frame pointer, EBP.
* Needed so we can call nested contract functions
Expand All @@ -1355,8 +1355,8 @@ void stackoffsets(ref symtab_t symtab, bool estimate)
Fast.alignment = alignsize;
break;

case SCregister:
case SCauto:
case SC.register:
case SC.auto_:
if (s.Sfl == FLreg) // if allocated in register
break;

Expand All @@ -1374,15 +1374,15 @@ void stackoffsets(ref symtab_t symtab, bool estimate)
Auto.alignment = alignsize;
break;

case SCstack:
case SC.stack:
EEStack.offset = _align(sz,EEStack.offset);
s.Soffset = EEStack.offset;
//printf("EEStack.offset = x%lx\n",cast(long)s.Soffset);
EEStack.offset += sz;
break;

case SCshadowreg:
case SCparameter:
case SC.shadowreg:
case SC.parameter:
if (config.exe == EX_WIN64)
{
assert((Para.offset & 7) == 0);
Expand All @@ -1405,9 +1405,9 @@ void stackoffsets(ref symtab_t symtab, bool estimate)
: type_size(s.Stype);
break;

case SCpseudo:
case SCstatic:
case SCbprel:
case SC.pseudo:
case SC.static_:
case SC.bprel:
break;
default:
symbol_print(s);
Expand Down
38 changes: 19 additions & 19 deletions compiler/src/dmd/backend/cgcs.d
Original file line number Diff line number Diff line change
Expand Up @@ -617,29 +617,29 @@ void touchlvalue(ref CGCS cgcs, const elem* e)
}
switch (e.EV.Vsym.Sclass)
{
case SCregpar:
case SCregister:
case SCpseudo:
case SC.regpar:
case SC.register:
case SC.pseudo:
break;

case SCauto:
case SCparameter:
case SCfastpar:
case SCshadowreg:
case SCbprel:
case SC.auto_:
case SC.parameter:
case SC.fastpar:
case SC.shadowreg:
case SC.bprel:
if (e.EV.Vsym.Sflags & SFLunambig)
break;
goto case SCstatic;

case SCstatic:
case SCextern:
case SCglobal:
case SClocstat:
case SCcomdat:
case SCinline:
case SCsinline:
case SCeinline:
case SCcomdef:
goto case SC.static_;

case SC.static_:
case SC.extern_:
case SC.global:
case SC.locstat:
case SC.comdat:
case SC.inline:
case SC.sinline:
case SC.einline:
case SC.comdef:
touchstar(cgcs);
break;

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/backend/cgelem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ private elem * elmin(elem *e, goal_t goal)
{
Symbol *s = symbol_calloc(LARGECODE ? "_aFahdiff".ptr : "_aNahdiff".ptr);
s.Stype = tsclib;
s.Sclass = SCextern;
s.Sclass = SC.extern_;
s.Sfl = FLfunc;
s.Ssymnum = 0;
s.Sregsaved = mBX|mCX|mSI|mDI|mBP|mES;
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/dmd/backend/cgen.d
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static if (TARGET_SEGMENTED)

if (f.sym.Sxtrnnum == 0)
{
if (f.sym.Sclass == SCstatic)
if (f.sym.Sclass == SC.static_)
{
version (SCPP)
{
Expand All @@ -466,14 +466,14 @@ else // MARS
else if (f.sym.Sflags & SFLwasstatic)
{
// Put it in BSS
f.sym.Sclass = SCstatic;
f.sym.Sclass = SC.static_;
f.sym.Sfl = FLunde;
f.sym.Sdt = dt_get_nzeros(cast(uint)type_size(f.sym.Stype));
outdata(f.sym);
}
else if (f.sym.Sclass != SCsinline)
{
f.sym.Sclass = SCextern; /* make it external */
f.sym.Sclass = SC.extern_; /* make it external */
objmod.external(f.sym);
if (f.sym.Sflags & SFLweak)
objmod.wkext(f.sym, null);
Expand Down
44 changes: 22 additions & 22 deletions compiler/src/dmd/backend/cgobj.d
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ static int generate_comdat(Symbol *s, bool is_readonly_comdat)

// Put out LNAME for name of Symbol
lnamesize = OmfObj_mangle(s,lnames.ptr);
objrecord((s.Sclass == SCstatic ? LLNAMES : LNAMES),lnames.ptr,cast(uint)lnamesize);
objrecord((s.Sclass == SC.static_ ? LLNAMES : LNAMES),lnames.ptr,cast(uint)lnamesize);

// Put out CEXTDEF for name of Symbol
outextdata();
Expand Down Expand Up @@ -2137,7 +2137,7 @@ else
}
lr.alloctyp = atyp;
}
if (s.Sclass == SCstatic)
if (s.Sclass == SC.static_)
lr.flags |= 0x04; // local bit (make it an "LCOMDAT")
s.Soffset = 0;
s.Sseg = pseg.SDseg;
Expand Down Expand Up @@ -2373,7 +2373,7 @@ else
elem_debug(e);
if ((e.Eoper == OPvar || e.Eoper == OPrelconst) &&
(s = e.EV.Vsym).ty() & mTYimport &&
(s.Sclass == SCextern || s.Sclass == SCinline)
(s.Sclass == SC.extern_ || s.Sclass == SC.inline)
)
{
char* name;
Expand Down Expand Up @@ -2407,7 +2407,7 @@ else
if (!simp)
{ type *t;

simp = scope_define(p,SCTglobal,SCextern);
simp = scope_define(p,SCTglobal,SC.extern_);
simp.Ssequence = 0;
simp.Sfl = FLextern;
simp.Simport = s;
Expand Down Expand Up @@ -2988,35 +2988,35 @@ private void obj_modend()

switch (s.Sclass)
{
case SCcomdat:
case SC.comdat:
case_SCcomdat:
case SCextern:
case SCcomdef:
case SC.extern_:
case SC.comdef:
if (s.Sxtrnnum) // identifier is defined somewhere else
external = s.Sxtrnnum;
else
{
Ladd:
s.Sclass = SCextern;
s.Sclass = SC.extern_;
external = objmod.external(s);
outextdata();
}
break;
case SCinline:
case SC.inline:
if (config.flags2 & CFG2comdat)
goto case_SCcomdat; // treat as initialized common block
goto case;

case SCsinline:
case SCstatic:
case SCglobal:
case SC.sinline:
case SC.static_:
case SC.global:
if (s.Sseg == UNKNOWN)
goto Ladd;
if (seg_is_comdat(SegData[s.Sseg].segidx)) // if in comdat
goto case_SCcomdat;
goto case;

case SClocstat:
case SC.locstat:
external = 0; // identifier is static or global
// and we know its offset
offset += s.Soffset;
Expand Down Expand Up @@ -3681,10 +3681,10 @@ static if (0)

switch (s.Sclass)
{
case SCcomdat:
case SC.comdat:
case_SCcomdat:
case SCextern:
case SCcomdef:
case SC.extern_:
case SC.comdef:
if (s.Sxtrnnum) // identifier is defined somewhere else
{
external = s.Sxtrnnum;
Expand All @@ -3707,21 +3707,21 @@ static if (0)
return numbytes;
}
break;
case SCinline:
case SC.inline:
if (config.flags2 & CFG2comdat)
goto case_SCcomdat; // treat as initialized common block
goto case;

case SCsinline:
case SCstatic:
case SCglobal:
case SC.sinline:
case SC.static_:
case SC.global:
if (s.Sseg == UNKNOWN)
goto Ladd;
if (seg_is_comdat(SegData[s.Sseg].segidx))
goto case_SCcomdat;
goto case;

case SClocstat:
case SC.locstat:
external = 0; // identifier is static or global
// and we know its offset
if (flags & CFoff)
Expand Down Expand Up @@ -3887,7 +3887,7 @@ void OmfObj_far16thunk(Symbol *s)
targ_size_t L2offset;
int idx;

s.Sclass = SCstatic;
s.Sclass = SC.static_;
s.Sseg = cseg; // identifier is defined in code segment
s.Soffset = Offset(cseg);

Expand Down
32 changes: 16 additions & 16 deletions compiler/src/dmd/backend/cgreg.d
Original file line number Diff line number Diff line change
Expand Up @@ -684,24 +684,24 @@ private void cgreg_map(Symbol *s, reg_t regmsw, reg_t reglsw)
{
switch (s.Sclass)
{
case SCauto:
case SCregister:
case SC.auto_:
case SC.register:
s.Sfl = FLauto;
break;
case SCfastpar:
case SC.fastpar:
s.Sfl = FLfast;
break;
case SCbprel:
case SC.bprel:
s.Sfl = FLbprel;
break;
case SCshadowreg:
case SCparameter:
case SC.shadowreg:
case SC.parameter:
s.Sfl = FLpara;
break;
case SCpseudo:
case SC.pseudo:
s.Sfl = FLpseudo;
break;
case SCstack:
case SC.stack:
s.Sfl = FLstack;
break;
default:
Expand Down Expand Up @@ -812,24 +812,24 @@ int cgreg_assign(Symbol *retsym)
{
switch (s.Sclass)
{
case SCauto:
case SCregister:
case SC.auto_:
case SC.register:
s.Sfl = FLauto;
break;
case SCfastpar:
case SC.fastpar:
s.Sfl = FLfast;
break;
case SCbprel:
case SC.bprel:
s.Sfl = FLbprel;
break;
case SCshadowreg:
case SCparameter:
case SC.shadowreg:
case SC.parameter:
s.Sfl = FLpara;
break;
case SCpseudo:
case SC.pseudo:
s.Sfl = FLpseudo;
break;
case SCstack:
case SC.stack:
s.Sfl = FLstack;
break;
default:
Expand Down
9 changes: 5 additions & 4 deletions compiler/src/dmd/backend/cod1.d
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ void getlvalue(ref CodeBuilder cdb,code *pcs,elem *e,regm_t keepmsk)
{
if (s.Sfl == FLtlsdata || s.ty() & mTYthread)
{
if (s.Sclass == SCglobal || s.Sclass == SCstatic || s.Sclass == SClocstat)
if (s.Sclass == SC.global || s.Sclass == SC.static_ || s.Sclass == SC.locstat)
return false;
}
return true;
Expand Down Expand Up @@ -1570,7 +1570,7 @@ void getlvalue(ref CodeBuilder cdb,code *pcs,elem *e,regm_t keepmsk)
else if (I64)
{
if (config.flags3 & CFG3pie &&
(s.Sclass == SCglobal || s.Sclass == SCstatic || s.Sclass == SClocstat))
(s.Sclass == SC.global || s.Sclass == SC.static_ || s.Sclass == SC.locstat))
{
pcs.Iflags |= CFfs;
pcs.Irm = modregrm(0, 0, 4);
Expand Down Expand Up @@ -2110,7 +2110,7 @@ Symbol* symboly(const(char)* name, regm_t desregs)
{
Symbol *s = symbol_calloc(name);
s.Stype = tsclib;
s.Sclass = SCextern;
s.Sclass = SC.extern_;
s.Sfl = FLfunc;
s.Ssymnum = 0;
s.Sregsaved = ~desregs & (mBP | mES | ALLREGS);
Expand Down Expand Up @@ -4824,7 +4824,8 @@ void pushParams(ref CodeBuilder cdb, elem* e, uint stackalign, tym_t tyf)
(fl = s.Sfl) != FLfardata &&
/* not a function that CS might not be the segment of */
(!((fl == FLfunc || s.ty() & mTYcs) &&
(s.Sclass == SCcomdat || s.Sclass == SCextern || s.Sclass == SCinline || config.wflags & WFthunk)) ||
(s.Sclass == SC.comdat || s.Sclass == SC.extern_ ||
s.Sclass == SC.inline || config.wflags & WFthunk)) ||
(fl == FLfunc && config.exe == EX_DOSX)
)
)
Expand Down
Loading

0 comments on commit 0604517

Please sign in to comment.