From 8052ec1b36b716962cd7744c4a6b04953a3cbf41 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Sat, 30 Jan 2016 21:21:23 -0800 Subject: [PATCH] remove #ifs from optabgen, gother, gloop --- src/backend/gloop.c | 33 +---------------------------- src/backend/gother.c | 12 +---------- src/backend/optabgen.c | 47 +----------------------------------------- 3 files changed, 3 insertions(+), 89 deletions(-) diff --git a/src/backend/gloop.c b/src/backend/gloop.c index 0cc0233948b8..5e5f5b0d522a 100644 --- a/src/backend/gloop.c +++ b/src/backend/gloop.c @@ -567,10 +567,8 @@ STATIC int looprotate(loop *l) if (b == head) // if loop already rotated goto Lret; -#if SCPP if (head->BC == BCtry) goto Lret; -#endif if (head->BC == BC_try) goto Lret; #ifdef DEBUG @@ -988,9 +986,7 @@ STATIC void markinvar(elem *n,vec_t rd) case OPvoid: case OPstrlen: case OPddtor: -#if TX86 case OPinp: -#endif markinvar(n->E1,rd); break; case OPcond: @@ -998,9 +994,7 @@ STATIC void markinvar(elem *n,vec_t rd) case OPstrcmp: case OPmemcmp: case OPbt: // OPbt is like OPind, assume not LI -#if TX86 case OPoutp: -#endif markinvar(n->E1,rd); markinvar(n->E2,rd); break; @@ -1055,16 +1049,12 @@ STATIC void markinvar(elem *n,vec_t rd) case OPbsr: case OPbswap: case OPpopcnt: -#if TX86 case OPsqrt: case OPsin: case OPcos: -#endif -#if TARGET_SEGMENTED case OPvp_fp: /* BUG for MacHandles */ case OPnp_f16p: case OPf16p_np: case OPoffset: case OPnp_fp: case OPcvp_fp: -#endif markinvar(n->E1,rd); if (isLI(n->E1)) /* if child is LI */ makeLI(n); @@ -1116,11 +1106,9 @@ STATIC void markinvar(elem *n,vec_t rd) case OPpair: case OPrpair: case OPremquo: -#if TX86 case OPscale: case OPyl2x: case OPyl2xp1: -#endif markinvar(n->E1,rd); markinvar(n->E2,rd); if (isLI(n->E2) && isLI(n->E1)) @@ -1930,12 +1918,10 @@ STATIC famlist * newfamlist(tym_t ty) c.Vshort = 1; break; -#if TARGET_SEGMENTED case TYsptr: case TYcptr: case TYfptr: case TYvptr: -#endif case TYnptr: case TYnullptr: ty = TYint; @@ -1946,10 +1932,9 @@ STATIC famlist * newfamlist(tym_t ty) case TYuint: c.Vint = 1; break; -#if TARGET_SEGMENTED + case TYhptr: ty = TYlong; -#endif case TYlong: case TYulong: case TYdchar: @@ -1962,10 +1947,8 @@ STATIC famlist * newfamlist(tym_t ty) if (typtr(ty)) { ty = TYint; -#if TARGET_SEGMENTED if (tybasic(ty) == TYhptr) ty = TYlong; -#endif if (I64) ty = TYllong; } @@ -2350,7 +2333,6 @@ STATIC void ivfamelems(Iv *biv,elem **pn) n1 = n->E1; } -#if TARGET_SEGMENTED // Get rid of case where we painted a far pointer to a long if (op == OPadd || op == OPmin) { int sz; @@ -2360,7 +2342,6 @@ STATIC void ivfamelems(Iv *biv,elem **pn) (sz != tysize(n1->Ety) || sz != tysize(n2->Ety))) return; } -#endif /* Look for function of basic IV (-biv or biv op const) */ if (n1->Eoper == OPvar && n1->EV.sp.Vsym == biv->IVbasic) @@ -2406,11 +2387,9 @@ STATIC void ivfamelems(Iv *biv,elem **pn) /* Check for subtracting two pointers */ if (typtr(c2ty) && typtr(n2->Ety)) { -#if TARGET_SEGMENTED if (tybasic(c2ty) == TYhptr) c2ty = TYlong; else -#endif c2ty = I64 ? TYllong : TYint; } L1: @@ -2679,11 +2658,9 @@ STATIC bool funcprev(Iv *biv,famlist *fl) else /* can't subtract fptr */ goto L1; } -#if TARGET_SEGMENTED if (tybasic(fls->c2->Ety) == TYhptr) tymin = TYlong; else -#endif tymin = I64 ? TYllong : TYint; /* type of (ptr - ptr) */ } @@ -2950,7 +2927,6 @@ STATIC void elimbasivs(loop *l) } } -#if TARGET_SEGMENTED /* Fix if leaves of compare are TYfptrs and the compare */ /* operator is < <= > >=. */ if (ref->Eoper >= OPle && ref->Eoper <= OPge && tyfv(ref->E1->Ety)) @@ -2958,7 +2934,6 @@ STATIC void elimbasivs(loop *l) ref->E1 = el_una(OPoffset,TYuint,ref->E1); ref->E2 = el_una(OPoffset,TYuint,fofe); } -#endif #ifdef DEBUG if (debugc) { WReqn(ref); @@ -2989,14 +2964,12 @@ STATIC void elimbasivs(loop *l) ne = el_bin(OPmin,ty, el_var(fl->FLtemp), C2); -#if TARGET_SEGMENTED if (tybasic(ne->E1->Ety) == TYfptr && tybasic(ne->E2->Ety) == TYfptr) { ne->Ety = I64 ? TYllong : TYint; if (tylong(ty) && intsize == 2) ne = el_una(OPs16_32,ty,ne); } -#endif ne = el_bin(OPeq,X->ty(), el_var(X), @@ -3214,10 +3187,8 @@ STATIC famlist * flcmp(famlist *f1,famlist *f2) goto Lf2; break; -#if TARGET_SEGMENTED case TYsptr: case TYcptr: -#endif case TYnptr: // BUG: 64 bit pointers? case TYnullptr: case TYint: @@ -3229,11 +3200,9 @@ STATIC famlist * flcmp(famlist *f1,famlist *f2) case TYlong: case TYulong: case TYdchar: -#if TARGET_SEGMENTED case TYfptr: case TYvptr: case TYhptr: -#endif case_long: if (t2->Vlong == 1 || t1->Vlong != 1 && f2->c2->EV.Vlong == 0) diff --git a/src/backend/gother.c b/src/backend/gother.c index cc9e70368c0a..1b42605c0668 100644 --- a/src/backend/gother.c +++ b/src/backend/gother.c @@ -102,9 +102,7 @@ void constprop() { rd_compute(); intranges(); // compute integer ranges -#if 0 - eqeqranges(); // see if we can eliminate some relationals -#endif + //eqeqranges(); // see if we can eliminate some relationals elemdatafree(&eqeqlist); elemdatafree(&rellist); elemdatafree(&inclist); @@ -132,9 +130,7 @@ STATIC void rd_compute() switch (b->BC) { -#if MARS case BCjcatch: -#endif case BC_finally: case BC_lpad: case BCasm: @@ -424,9 +420,7 @@ STATIC void chkrd(elem *n,list_t rdlist) #endif sv->Sflags |= SFLnord; // no redundant messages -#ifdef DEBUG //elem_print(n); -#endif } /********************************** @@ -1213,9 +1207,7 @@ void elimass(elem *n) /* Don't screw up assnod[]. */ n->Eoper = OPcomma; n->Ety |= n->E2->Ety & (mTYconst | mTYvolatile | mTYimmutable | mTYshared -#if TARGET_SEGMENTED | mTYfar -#endif ); n->E1->Eoper = OPconst; break; @@ -1366,9 +1358,7 @@ STATIC void accumda(elem *n,vec_t DEAD, vec_t POSS) case OPind: case OPucall: case OPucallns: -#if TARGET_SEGMENTED case OPvp_fp: -#endif accumda(n->E1,DEAD,POSS); vec_subass(POSS,ambigref); // remove possibly refed // assignments from list diff --git a/src/backend/optabgen.c b/src/backend/optabgen.c index f63daf0f7667..28855f4b446e 100644 --- a/src/backend/optabgen.c +++ b/src/backend/optabgen.c @@ -389,11 +389,7 @@ void dotab() { int i; FILE *f; -#if BSDUNIX -#define X(d,e,c) debtab[i]=d;cdxxx[i]="c",elxxx[i]="e";break -#else #define X(d,e,c) debtab[i]=d;cdxxx[i]=#c,elxxx[i]=#e;break -#endif for (i = 0; i < OPMAX; i++) { switch (i) @@ -625,28 +621,20 @@ void fltables() { FLdata,FLudata,FLreg,FLpseudo,FLauto,FLfast,FLpara,FLextern, FLcs,FLfltreg,FLallocatmp,FLdatseg,FLtlsdata,FLbprel, FLstack,FLregsave,FLfuncarg, -#if TX86 FLndp, -#endif }; -#if TARGET_SEGMENTED static char indatafl_s[] = { FLfardata, }; -#endif static char instackfl[] = /* is FLxxxx a stack data type? */ { FLauto,FLfast,FLpara,FLcs,FLfltreg,FLallocatmp,FLbprel,FLstack,FLregsave, FLfuncarg, -#if TX86 FLndp, -#endif }; static char inflinsymtab[] = /* is FLxxxx in the symbol table? */ { FLdata,FLudata,FLreg,FLpseudo,FLauto,FLfast,FLpara,FLextern,FLfunc, FLtlsdata,FLbprel,FLstack }; -#if TARGET_SEGMENTED static char inflinsymtab_s[] = { FLfardata,FLcsdata, }; -#endif for (i = 0; i < FLMAX; i++) datafl[i] = stackfl[i] = flinsymtab[i] = 0; @@ -660,13 +648,11 @@ void fltables() for (i = 0; i < sizeof(inflinsymtab); i++) flinsymtab[inflinsymtab[i]] = 1; -#if TARGET_SEGMENTED for (i = 0; i < sizeof(indatafl_s); i++) datafl[indatafl_s[i]] = 1; for (i = 0; i < sizeof(inflinsymtab_s); i++) flinsymtab[inflinsymtab_s[i]] = 1; -#endif /* Segment registers */ /* The #undefs are to appease the compiler on Solaris because @@ -766,9 +752,7 @@ void fltables() void dotytab() { static tym_t _ptr[] = { TYnptr }; -#if TARGET_SEGMENTED static tym_t _ptr_nflat[]= { TYsptr,TYcptr,TYf16ptr,TYfptr,TYhptr,TYvptr }; -#endif static tym_t _real[] = { TYfloat,TYdouble,TYdouble_alias,TYldouble, TYfloat4,TYdouble2, }; @@ -786,45 +770,29 @@ void dotytab() TYchar16, TYcent, TYucent }; static tym_t _ref[] = { TYnref,TYref }; static tym_t _func[] = { TYnfunc,TYnpfunc,TYnsfunc,TYifunc,TYmfunc,TYjfunc,TYhfunc }; -#if TARGET_SEGMENTED static tym_t _ref_nflat[] = { TYfref }; static tym_t _func_nflat[]= { TYffunc,TYfpfunc,TYf16func,TYfsfunc,TYnsysfunc,TYfsysfunc, }; -#endif static tym_t _uns[] = { TYuchar,TYushort,TYuint,TYulong, -#if MARS TYwchar_t, -#endif TYuchar16,TYushort8,TYulong4,TYullong2, TYdchar,TYullong,TYucent,TYchar16 }; -#if !MARS static tym_t _mptr[] = { TYmemptr }; -#endif static tym_t _nullptr[] = { TYnullptr }; -#if TARGET_SEGMENTED static tym_t _fv[] = { TYfptr, TYvptr }; -#if TARGET_WINDOS static tym_t _farfunc[] = { TYffunc,TYfpfunc,TYfsfunc,TYfsysfunc }; -#endif -#endif static tym_t _pasfunc[] = { TYnpfunc,TYnsfunc,TYmfunc,TYjfunc }; -#if TARGET_SEGMENTED static tym_t _pasfunc_nf[] = { TYfpfunc,TYf16func,TYfsfunc, }; -#endif static tym_t _revfunc[] = { TYnpfunc,TYjfunc }; -#if TARGET_SEGMENTED static tym_t _revfunc_nf[] = { TYfpfunc,TYf16func, }; -#endif static tym_t _short[] = { TYbool,TYchar,TYschar,TYuchar,TYshort, TYwchar_t,TYushort,TYchar16 }; static tym_t _aggregate[] = { TYstruct,TYarray }; -#if TX86 static tym_t _xmmreg[] = { TYfloat,TYdouble,TYifloat,TYidouble, TYfloat4,TYdouble2, TYschar16,TYuchar16,TYshort8,TYushort8, TYlong4,TYulong4,TYllong2,TYullong2, }; -#endif static tym_t _simd[] = { TYfloat4,TYdouble2, TYschar16,TYuchar16,TYshort8,TYushort8, @@ -903,7 +871,6 @@ void dotytab() "C func", TYhfunc, TYhfunc, TYhfunc, -1, 0, 0, "__near &", TYnref, TYnref, TYnref, 2, 0, 0, -#if TARGET_SEGMENTED "__ss *", TYsptr, TYsptr, TYsptr, 2, 0x20, 0x100, "__cs *", TYcptr, TYcptr, TYcptr, 2, 0x20, 0x100, "__far16 *", TYf16ptr, TYf16ptr, TYf16ptr, 4, 0x40, 0x200, @@ -917,14 +884,12 @@ void dotytab() "sys func", TYnsysfunc, TYnsysfunc,TYnsysfunc, -1, 0x63, 0, "far sys func", TYfsysfunc, TYfsysfunc,TYfsysfunc, -1, 0x64, 0, "__far &", TYfref, TYfref, TYfref, 4, 0, 0, -#endif -#if !MARS + "interrupt func", TYifunc, TYifunc, TYifunc, -1, 0x64, 0, "memptr", TYmemptr, TYmemptr, TYmemptr, -1, 0, 0, "ident", TYident, TYident, TYident, -1, 0, 0, "template", TYtemplate, TYtemplate, TYtemplate, -1, 0, 0, "vtshape", TYvtshape, TYvtshape, TYvtshape, -1, 0, 0, -#endif }; FILE *f; @@ -946,22 +911,16 @@ void dotytab() }; T1(_ptr, TYFLptr); -#if TARGET_SEGMENTED T1(_ptr_nflat,TYFLptr); -#endif T1(_real, TYFLreal); T1(_integral, TYFLintegral); T1(_imaginary,TYFLimaginary); T1(_complex, TYFLcomplex); T1(_uns, TYFLuns); -#if !MARS T1(_mptr, TYFLmptr); -#endif -#if TARGET_SEGMENTED T1(_fv, TYFLfv); T2(_farfunc, TYFLfarfunc); -#endif T2(_pasfunc, TYFLpascal); T2(_revfunc, TYFLrevparam); T2(_short, TYFLshort); @@ -969,15 +928,11 @@ void dotytab() T2(_ref, TYFLref); T2(_func, TYFLfunc); T2(_nullptr, TYFLnullptr); -#if TARGET_SEGMENTED T2(_pasfunc_nf, TYFLpascal); T2(_revfunc_nf, TYFLrevparam); T2(_ref_nflat, TYFLref); T2(_func_nflat, TYFLfunc); -#endif -#if TX86 T1(_xmmreg, TYFLxmmreg); -#endif T1(_simd, TYFLsimd); #undef T1 #undef T2