Skip to content

Commit

Permalink
Merge pull request #4969 from yebblies/backendx
Browse files Browse the repository at this point in the history
Remove some unused code from the backend
  • Loading branch information
WalterBright committed Aug 28, 2015
2 parents b570bf9 + 72590fc commit bc07792
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 286 deletions.
4 changes: 0 additions & 4 deletions src/backend/backconfig.c
Expand Up @@ -300,7 +300,6 @@ void util_set32()
tysize[TYint + i] = LONGSIZE;
tysize[TYuint + i] = LONGSIZE;
tysize[TYnullptr + i] = LONGSIZE;
tysize[TYjhandle + i] = LONGSIZE;
tysize[TYnptr + i] = LONGSIZE;
tysize[TYnref + i] = LONGSIZE;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_SOLARIS
Expand Down Expand Up @@ -332,7 +331,6 @@ void util_set32()
tyalignsize[TYint + i] = LONGSIZE;
tyalignsize[TYuint + i] = LONGSIZE;
tyalignsize[TYnullptr + i] = LONGSIZE;
tyalignsize[TYjhandle + i] = LONGSIZE;
tyalignsize[TYnref + i] = LONGSIZE;
tyalignsize[TYnptr + i] = LONGSIZE;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_SOLARIS
Expand Down Expand Up @@ -375,7 +373,6 @@ void util_set64()
tysize[TYint + i] = LONGSIZE;
tysize[TYuint + i] = LONGSIZE;
tysize[TYnullptr + i] = 8;
tysize[TYjhandle + i] = 8;
tysize[TYnptr + i] = 8;
tysize[TYnref + i] = 8;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_SOLARIS || TARGET_OSX
Expand Down Expand Up @@ -403,7 +400,6 @@ void util_set64()
tyalignsize[TYint + i] = LONGSIZE;
tyalignsize[TYuint + i] = LONGSIZE;
tyalignsize[TYnullptr + i] = 8;
tyalignsize[TYjhandle + i] = 8;
tyalignsize[TYnptr + i] = 8;
tyalignsize[TYnref + i] = 8;
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_SOLARIS
Expand Down
4 changes: 0 additions & 4 deletions src/backend/blockopt.c
Expand Up @@ -2156,10 +2156,6 @@ STATIC int funcsideeffect_walk(elem *e)
break;
goto Lside;

case OParray:
case OPfield:
goto Lside; // these can throw exceptions

// Note: we should allow assignments to local variables as
// not being a 'side effect'.

Expand Down
11 changes: 4 additions & 7 deletions src/backend/cc.h
Expand Up @@ -592,14 +592,13 @@ enum BC {
BCcatch = 11, // C++ catch block
BCjump = 12, // Belem specifies (near) address to jump to
BC_try = 13, // SEH: first block of try-except or try-finally
// Jupiter, Mars: try-catch or try-finally
// Mars: try-catch or try-finally
BC_filter = 14, // SEH exception-filter (always exactly one block)
BC_finally = 15, // first block of SEH termination-handler,
// or finally block
BC_ret = 16, // last block of SEH termination-handler or finally block
BC_except = 17, // first block of SEH exception-handler
BCjcatch = 18, // first block of Jupiter or Mars catch-block
BCjplace = 19, // Jupiter: placeholder
BCjcatch = 18, // first block of Mars catch-block
BCMAX
};

Expand Down Expand Up @@ -662,10 +661,8 @@ typedef struct FUNC_S
#define Fnteh 0x08 // uses NT Structured EH
#define Fdoinline 0x40 // do inline walk
#define Foverridden 0x80 // ignore for overriding purposes
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#define Fnowrite 0x100 // SCinline should never output definition
#else
#define Fjmonitor 0x100 // Jupiter synchronized function
#if MARS && TARGET_WINDOS
#define Fjmonitor 0x100 // Mars synchronized function
#endif
#define Fnosideeff 0x200 // function has no side effects
#define F3badoparrow 0x400 // bad operator->()
Expand Down
3 changes: 0 additions & 3 deletions src/backend/cdef.h
Expand Up @@ -552,9 +552,6 @@ typedef targ_uns targ_size_t; /* size_t for the target machine */
#define UNKNOWN -1 /* unknown segment */
#define DGROUPIDX 1 /* group index of DGROUP */

#define KEEPBITFIELDS 0 /* 0 means code generator cannot handle bit fields, */
/* so replace them with shifts and masks */

#define REGMAX 29 // registers are numbered 0..10

typedef unsigned tym_t; // data type big enough for type masks
Expand Down
2 changes: 1 addition & 1 deletion src/backend/cgcs.c
Expand Up @@ -367,7 +367,7 @@ STATIC void ecom(elem **pe)
case OPd_s64: case OPs64_d: case OPd_u64: case OPu64_d:
case OPstrctor: case OPu16_d: case OPd_u16:
case OParrow:
case OPvoid: case OPnullcheck:
case OPvoid:
case OPbsf: case OPbsr: case OPbswap: case OPpopcnt: case OPvector:
case OPld_u64:
#if TX86
Expand Down
2 changes: 0 additions & 2 deletions src/backend/cgcv.c
Expand Up @@ -412,13 +412,11 @@ void cv_init()
{
dttab4[TYptr] = 0x600;
dttab4[TYnptr] = 0x600;
dttab4[TYjhandle] = 0x600;
}
else
{
dttab4[TYptr] = 0x400;
dttab4[TYnptr] = 0x400;
dttab4[TYjhandle] = 0x400;
}
#if TARGET_SEGMENTED
dttab4[TYsptr] = 0x400;
Expand Down
86 changes: 2 additions & 84 deletions src/backend/cgelem.c
Expand Up @@ -30,7 +30,6 @@ static char __file__[] = __FILE__; /* for tassert.h */
extern void error(const char *filename, unsigned linnum, unsigned charnum, const char *format, ...);

STATIC elem * optelem(elem *,goal_t);
STATIC elem * elarray(elem *e);
STATIC elem * eldiv(elem *, goal_t goal);

extern elem * evalu8(elem *, goal_t goal);
Expand Down Expand Up @@ -1097,7 +1096,7 @@ STATIC elem * elmin(elem *e, goal_t goal)
/* for floating or far or huge pointers! */
if (e1->Eoper == OPadd && e2->Eoper == OPadd &&
cnst(e1->E2) && cnst(e2->E2) &&
(tyintegral(tym) || tybasic(tym) == TYjhandle || tybasic(tym) == TYnptr
(tyintegral(tym) || tybasic(tym) == TYnptr
#if TARGET_SEGMENTED
|| tybasic(tym) == TYsptr
#endif
Expand Down Expand Up @@ -4825,23 +4824,6 @@ STATIC elem * elinfo(elem *e, goal_t goal)
return e;
}

/********************************************
*/

STATIC elem * elhstring(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elnullcheck(elem *e, goal_t goal)
{
return e;
}


/********************************************
*/

Expand All @@ -4850,54 +4832,6 @@ STATIC elem * elclassinit(elem *e, goal_t goal)
return e;
}

/********************************************
*/

STATIC elem * elnewarray(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elmultinewarray(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elinstanceof(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elfinalinstanceof(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elcheckcast(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elarraylength(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

Expand Down Expand Up @@ -4972,22 +4906,6 @@ STATIC elem * elvalist(elem *e, goal_t goal)
}
#endif

/********************************************
*/

STATIC elem * elarray(elem *e, goal_t goal)
{
return e;
}

/********************************************
*/

STATIC elem * elfield(elem *e, goal_t goal)
{
return e;
}

/******************************************
* OPparam
*/
Expand Down Expand Up @@ -5419,7 +5337,7 @@ STATIC elem * optelem(elem *e, goal_t goal)
}
else /* unary operator */
{
assert(!e->E2 || op == OPinfo || op == OParraylength || op == OPddtor);
assert(!e->E2 || op == OPinfo || op == OPddtor);
if (!goal && !OTsideff(op) && !(e->Ety & mTYvolatile))
{
tym_t tym = e->E1->Ety;
Expand Down
23 changes: 0 additions & 23 deletions src/backend/cod2.c
Expand Up @@ -5246,27 +5246,4 @@ code *cdhalt(elem *e,regm_t *pretregs)
return gen1(NULL, 0xF4); // HLT
}

/****************************************
* Check to see if pointer is NULL.
*/

code *cdnullcheck(elem *e,regm_t *pretregs)
{ regm_t retregs;
regm_t scratch;
unsigned reg;
code *c;
code *cs;

assert(!I16);
retregs = *pretregs;
if ((retregs & allregs) == 0)
retregs |= allregs;
c = codelem(e->E1,&retregs,FALSE);
scratch = allregs & ~retregs;
cs = allocreg(&scratch,&reg,TYint);
unsigned rex = I64 ? REX_W : 0;
cs = genc1(cs,0x8B,(rex << 16) | buildModregrm(2,reg,findreg(retregs)),FLconst,0); // MOV reg,0[e]
return cat3(c,cs,fixresult(e,retregs,pretregs));
}

#endif // !SPP
3 changes: 1 addition & 2 deletions src/backend/code.h
Expand Up @@ -167,7 +167,7 @@ extern unsigned usednteh;
#define NTEHcpp (NTEHexcspec | NTEHcleanup | NTEHtry)
#define EHcleanup 0x20
#define EHtry 0x40
#define NTEHjmonitor 0x80 // uses Jupiter monitor
#define NTEHjmonitor 0x80 // uses Mars monitor
#define NTEHpassthru 0x100

/********************** Code Generator State ***************/
Expand Down Expand Up @@ -329,7 +329,6 @@ cd_t cdddtor;
cd_t cdctor;
cd_t cddtor;
cd_t cdmark;
cd_t cdnullcheck;
cd_t cdclassinit;

/* cod3.c */
Expand Down
2 changes: 0 additions & 2 deletions src/backend/el.c
Expand Up @@ -2651,7 +2651,6 @@ int el_match(elem *n1,elem *n2)
break;
case OPasm:
case OPstring:
case OPhstring:
if (n1->EV.ss.Vstrlen != (n = n2->EV.ss.Vstrlen) ||
n1->EV.ss.Voffset != n2->EV.ss.Voffset ||
memcmp(n1->EV.ss.Vstring,n2->EV.ss.Vstring,n))
Expand Down Expand Up @@ -3110,7 +3109,6 @@ void elem_print(elem *e)
break;
case OPasm:
case OPstring:
case OPhstring:
dbg_printf(" '%s',%lld\n",e->EV.ss.Vstring,(unsigned long long)e->EV.ss.Voffset);
break;
case OPconst:
Expand Down
2 changes: 1 addition & 1 deletion src/backend/el.h
Expand Up @@ -79,7 +79,7 @@ struct elem
#define NFLdelcse 0x40 // this is not the generating CSE
#define NFLtouns 0x80 // relational operator was changed from signed to unsigned
#if MARS
unsigned char Ejty_; // original Jupiter/Mars type
unsigned char Ejty_; // original Mars type
#define Ejty _EU._EO.Ejty_
#endif
}_EO;
Expand Down
14 changes: 1 addition & 13 deletions src/backend/gflow.c
Expand Up @@ -1329,12 +1329,6 @@ STATIC void accumlv(vec_t GEN,vec_t KILL,elem *n)
vec_subass(GEN,KILL);
break;

case OPnewarray:
case OPmultinewarray:
accumlv(GEN,KILL,n->E1);
accumlv(GEN,KILL,n->E2);
goto L1;

case OPcall:
case OPcallns:
case OPstrcpy:
Expand Down Expand Up @@ -1572,12 +1566,6 @@ STATIC void accumvbe(vec_t GEN,vec_t KILL,elem *n)
}
break;

case OPnewarray:
case OPmultinewarray:
accumvbe(GEN,KILL,n->E1);
accumvbe(GEN,KILL,n->E2);
break;

case OPcall:
case OPcallns:
accumvbe(GEN,KILL,n->E2);
Expand Down Expand Up @@ -1703,7 +1691,7 @@ STATIC void accumvbe(vec_t GEN,vec_t KILL,elem *n)
{ if (!vec_testbit(e->E1->Eexp,KILL))
continue;
}
else /* OPconst or OPrelconst or OPstring or OPhstring */
else /* OPconst or OPrelconst or OPstring */
continue;

vec_setbit(i,KILL); // KILL it
Expand Down
12 changes: 0 additions & 12 deletions src/backend/glocal.c
Expand Up @@ -274,17 +274,9 @@ STATIC void local_exp(elem *e,int goal)
local_ambigref();
break;

case OPnewarray:
case OPmultinewarray:
local_exp(e->E1,1);
local_exp(e->E2,1);
goto Lrd;

case OPstrcmp:
case OPmemcmp:
case OPbt:
case OParray:
case OPfield:
local_exp(e->E1,1);
local_exp(e->E2,1);
local_ambigref();
Expand Down Expand Up @@ -584,8 +576,6 @@ STATIC int local_getflags(elem *e,symbol *s)
case OPucallns:
case OPcall:
case OPcallns:
case OPnewarray:
case OPmultinewarray:
case OPstrcat:
case OPstrcpy:
case OPmemcpy:
Expand All @@ -608,8 +598,6 @@ STATIC int local_getflags(elem *e,symbol *s)
break;

case OPind:
case OParray:
case OPfield:
case OPstrlen:
case OPstrcmp:
case OPmemcmp:
Expand Down

0 comments on commit bc07792

Please sign in to comment.