Skip to content

Commit

Permalink
Merge pull request #208 from braddr/cleanup-backend
Browse files Browse the repository at this point in the history
Cleanup bit rotten parts of the backend
  • Loading branch information
WalterBright committed Jul 13, 2011
2 parents 7aeb7d2 + 420e94a commit 5a3f2eb
Show file tree
Hide file tree
Showing 27 changed files with 49 additions and 1,538 deletions.
12 changes: 1 addition & 11 deletions src/backend/blockopt.c
Expand Up @@ -31,11 +31,7 @@
#include "go.h"
#include "code.h"
#if SCPP
#if TX86
#include "iasm.h"
#else
#include "TG.h"
#endif
#endif

static char __file__[] = __FILE__; /* for tassert.h */
Expand Down Expand Up @@ -993,9 +989,6 @@ STATIC void bropt()
list_free(&b->Bsucc,FPNULL);
list_append(&b->Bsucc,db);
b->BC = BCgoto;
#if !HOST_THINK
MEM_PH_FREE(b->BS.Bswitch);
#endif
b->Belem = doptelem(b->Belem,GOALnone | GOALagain);
cmes("CHANGE: switch (const)\n");
changes++;
Expand Down Expand Up @@ -1037,7 +1030,7 @@ STATIC void brrear()
bt->Btry == list_block(bt->Bsucc)->Btry &&
#endif

++iter < T68000(numblks) T80x86(10))
++iter < 10)
{
list_ptr(bl) = list_ptr(bt->Bsucc);
if (bt->Bsrcpos.Slinnum && !b->Bsrcpos.Slinnum)
Expand Down Expand Up @@ -1676,9 +1669,6 @@ STATIC void bltailmerge()
if (bnew->BC == BCswitch)
{
bnew->BS.Bswitch = b->BS.Bswitch;
#if !HOST_THINK
MEM_PH_FREE(bn->BS.Bswitch);
#endif
b->BS.Bswitch = NULL;
bn->BS.Bswitch = NULL;
}
Expand Down
22 changes: 0 additions & 22 deletions src/backend/cc.h
Expand Up @@ -338,11 +338,6 @@ typedef struct Pstate
#endif
block *STbtry; // current try block
block *STgotolist; // threaded goto scoping list
#if MPW_OBJ && TARGET_68K
short STpush_value;
short STpop_value;
char STdo_push;
#endif
#if !TX86
char STdo_pop;
char STprogressShown; // true if func_body() has already shown progress info
Expand Down Expand Up @@ -505,11 +500,6 @@ typedef struct block
#if NTEXCEPTIONS
#define BFLehcode 0x10 // set when we need to load exception code
#define BFLunwind 0x1000 // do local_unwind following block
#endif
#if TARGET_POWERPC
#define BFLstructret 0x10 /* Set if a struct return is changed to
block type BCret. This is done to avoid
error messages */
#endif
#define BFLnomerg 0x20 // do not merge with other blocks
#if TX86
Expand Down Expand Up @@ -1129,10 +1119,6 @@ typedef struct STRUCT
#define list_setsymbol(l,s) list_ptr(l) = (s)
#define list_Classsym(l) ((Classsym *) list_ptr(l))

#if TARGET_POWERPC
#pragma SC align 4
#endif

struct Symbol
{
#ifdef DEBUG
Expand Down Expand Up @@ -1336,9 +1322,6 @@ struct Symbol
vec_t Slvreg; // when symbol is in register
targ_size_t Ssize; // tyfunc: size of function
targ_size_t Soffset; // variables: offset of Symbol in its storage class
#if TARGET_MAC
#define Smemoff Soffset
#endif

// CPP || OPTIMIZER
SYMIDX Ssymnum; // Symbol number (index into globsym.tab[])
Expand Down Expand Up @@ -1607,21 +1590,16 @@ typedef struct Filename
unsigned idx; // # used in array
} Filename;

//
// NOTE: In order to save the full settings of all of the options,
// the following will need to be saved:
//
// config
// PCrel_option
// tysize[TYldouble]
// war_to_msg_enable[] - Array of warnings that are enabled/disabled 0 = enabled, 1 = disabled

struct SAVED_OPTIONS
{
struct Config config;
#if TARGET_68K
short PCrel_option;
#endif
mftype mfoptim;
signed char tysizeTYldouble;
unsigned char war_to_msg_enable[40]; // Assumes that the max warning number is 40
Expand Down
13 changes: 0 additions & 13 deletions src/backend/cdef.h
Expand Up @@ -45,14 +45,6 @@
DOS16RM Rational Systems 286 DOS extender
_MSDOS MSDOS
Host systems no longer supported:
HOST_THINK
HOST_RAINBOW
HOST_MPW Macintosh Programmers' Workbench
HOST_UNIX Unix systems other than linux
HOST_MAC
One and only one of these macros must be set by the makefile:
SPP Build C/C++ preprocessor
Expand Down Expand Up @@ -163,9 +155,6 @@ One and only one of these macros must be set by the makefile:
*/

#define TX86 1 // target is Intel 80X86 processor
#define TARGET_68K 0 // target is a 68K processor
#define TARGET_POWERPC 0 // target is a PPC processor
#define TARGET_MAC 0 // target is a macintosh

// Set to 1 using the makefile
#ifndef TARGET_LINUX
Expand Down Expand Up @@ -350,8 +339,6 @@ One and only one of these macros must be set by the makefile:
#endif
#define ARG_TRUE
#define ARG_FALSE
#define T68000(x)
#define T80x86(x) x

// For Share MEM_ macros - default to mem_xxx package
// PH precompiled header
Expand Down
23 changes: 0 additions & 23 deletions src/backend/cgcs.c
Expand Up @@ -170,16 +170,8 @@ STATIC void ecom(elem **pe)
switch (op)
{
case OPconst:
#if TARGET_MAC
if (tyfloating(tym) || C_S8_VAL(e->EV.Vlong))
return; /* don't cse small constants or SANE consts */
#endif
case OPvar:
case OPrelconst:
#if TARGET_68K
if (tyfloating(tym) && !config.inline68881)
return; /* don't cse float vars for SANE */
#endif
break;
case OPstreq:
case OPpostinc:
Expand Down Expand Up @@ -378,9 +370,6 @@ STATIC void ecom(elem **pe)
case OPu32_64: case OPlngllng: case OP64_32: case OPmsw:
case OPu64_128: case OPs64_128: case OP128_64:
case OPd_s64: case OPs64_d: case OPd_u64: case OPu64_d:
#if TARGET_MAC
case OPsfltdbl: OPcase OPdblsflt:
#endif
case OPstrctor: case OPu16_d: case OPdbluns:
case OPptrlptr: case OPtofar16: case OPfromfar16: case OParrow:
case OPvoid: case OPnullcheck:
Expand All @@ -397,9 +386,6 @@ STATIC void ecom(elem **pe)
if (tym == TYstruct ||
tym == TYvoid ||
e->Ety & mTYvolatile
#if TARGET_68K
|| (tyfloating(tym) && !config.inline68881)
#endif
#if TX86
// don't CSE doubles if inline 8087 code (code generator can't handle it)
|| (tyfloating(tym) && config.inline8087)
Expand Down Expand Up @@ -498,13 +484,8 @@ STATIC void addhcstab(elem *e,int hash)
if (h >= hcsmax) /* need to reallocate table */
{
assert(h == hcsmax);
#if TARGET_MAC
hcsmax += (hcsmax + 64); /* This space is not returned */
/* multiple reallocs costly */
#else
// With 32 bit compiles, we've got memory to burn
hcsmax += (__INTSIZE == 4) ? (hcsmax + 128) : 100;
#endif
assert(h < hcsmax);
#if TX86
hcstab = (hcs *) util_realloc(hcstab,hcsmax,sizeof(hcs));
Expand Down Expand Up @@ -541,10 +522,6 @@ STATIC void touchlvalue(elem *e)

for (i = hcstop; --i >= 0;)
{ if (hcstab[i].Helem &&
#if TARGET_MAC // Vsym should be valid before compare
!EOP(hcstab[i].Helem) &&
hcstab[i].Helem->Eoper != OPconst &&
#endif
hcstab[i].Helem->EV.sp.Vsym == e->EV.sp.Vsym)
hcstab[i].Helem = NULL;
}
Expand Down

0 comments on commit 5a3f2eb

Please sign in to comment.