Skip to content

Commit

Permalink
merge D2 pull 283
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Aug 1, 2011
1 parent 8b2de71 commit e7dd41e
Show file tree
Hide file tree
Showing 22 changed files with 91 additions and 79 deletions.
2 changes: 0 additions & 2 deletions src/backend/backend.txt
Expand Up @@ -27,7 +27,6 @@ cod4.c code gen
cod5.c code gen
code.c memory management for code instructions
code.h define registers, register masks, and the CPU instruction linked list
cpp.h C++ semantic routines
cppman.c C++ name mangling
cv4.h CodeView symbolic debug info declarations
debug.c pretty printing for debug builds
Expand Down Expand Up @@ -66,7 +65,6 @@ os.c some operating system specific support
out.c write data definitions to object file
outbuf.c resizeable buffer
outbuf.h API for resizeable buffer
parser.h for C/C++ parser
ptrntab.c instruction tables for inline assembler
rtlsym.c initialize for compiler 'helper' runtime functions
rtlsym.h compiler 'helper' runtime functions
Expand Down
2 changes: 1 addition & 1 deletion src/backend/blockopt.c
Expand Up @@ -27,10 +27,10 @@
#include "el.h"
#include "type.h"
#include "global.h"
#include "parser.h"
#include "go.h"
#include "code.h"
#if SCPP
#include "parser.h"
#include "iasm.h"
#endif

Expand Down
1 change: 1 addition & 0 deletions src/backend/cgcv.c
Expand Up @@ -33,6 +33,7 @@
#include "cv4.h"
#include "global.h"
#if SCPP
#include "parser.h"
#include "cpp.h"
#endif

Expand Down
3 changes: 1 addition & 2 deletions src/backend/cgobj.c
Expand Up @@ -27,8 +27,7 @@
#include "code.h"
#include "type.h"
#include "outbuf.h"
//#include "oper.h"
//#include "scope.h"
#include "scope.h"

#include "md5.h"

Expand Down
2 changes: 0 additions & 2 deletions src/backend/cgsched.c
Expand Up @@ -22,8 +22,6 @@
#include "oper.h"
#include "global.h"
#include "type.h"
#include "parser.h"
#include "cpp.h"
#include "exh.h"
#include "list.h"

Expand Down
56 changes: 21 additions & 35 deletions src/backend/cod3.c
Expand Up @@ -22,17 +22,21 @@
#include "oper.h"
#include "global.h"
#include "type.h"
#include "parser.h"
#include "aa.h"
#include "tinfo.h"
#if SCPP
#include "cpp.h"
#include "exh.h"
#endif

#if HYDRATE
#include "parser.h"
#endif

static char __file__[] = __FILE__; /* for tassert.h */
#include "tassert.h"

extern dt_t **dtnzeros(dt_t **pdtend,targ_size_t size);

extern targ_size_t retsize;
STATIC void pinholeopt_unittest();
STATIC void do8bit (enum FL,union evc *);
Expand Down Expand Up @@ -119,7 +123,7 @@ static unsigned char inssize[256] =
M|A|2,M|A|2,M|A|2,M|A|2, M|2,M|2,M|2,M|R|2, /* 88 */
1,1,1,1, 1,1,1,1, /* 90 */
1,1,T|5,1, 1,1,1,1, /* 98 */
#if 0 /* cod3_set386() patches this */
#if 0 /* cod3_set32() patches this */
T|5,T|5,T|5,T|5, 1,1,1,1, /* A0 */
#else
T|3,T|3,T|3,T|3, 1,1,1,1, /* A0 */
Expand Down Expand Up @@ -234,40 +238,22 @@ int cod3_EA(code *c)
* Fix global variables for 386.
*/

void cod3_set386()
void cod3_set32()
{
// if (I32)
{ unsigned i;

inssize[0xA0] = T|5;
inssize[0xA1] = T|5;
inssize[0xA2] = T|5;
inssize[0xA3] = T|5;
BPRM = 5; /* [EBP] addressing mode */
fregsaved = mBP | mBX | mSI | mDI; // saved across function calls
FLOATREGS = FLOATREGS_32;
FLOATREGS2 = FLOATREGS2_32;
DOUBLEREGS = DOUBLEREGS_32;
if (config.flags3 & CFG3eseqds)
fregsaved |= mES;
inssize[0xA0] = T|5;
inssize[0xA1] = T|5;
inssize[0xA2] = T|5;
inssize[0xA3] = T|5;
BPRM = 5; /* [EBP] addressing mode */
fregsaved = mBP | mBX | mSI | mDI; // saved across function calls
FLOATREGS = FLOATREGS_32;
FLOATREGS2 = FLOATREGS2_32;
DOUBLEREGS = DOUBLEREGS_32;
if (config.flags3 & CFG3eseqds)
fregsaved |= mES;

for (i = 0x80; i < 0x90; i++)
inssize2[i] = W|T|6;
}
#if 0
else
{
inssize[0xA0] = T|3;
inssize[0xA1] = T|3;
inssize[0xA2] = T|3;
inssize[0xA3] = T|3;
BPRM = 6; /* [EBP] addressing mode */
fregsaved = mSI | mDI; /* saved across function calls */
FLOATREGS = FLOATREGS_16;
FLOATREGS2 = FLOATREGS2_16;
DOUBLEREGS = DOUBLEREGS_16;
}
#endif
for (unsigned i = 0x80; i < 0x90; i++)
inssize2[i] = W|T|6;
}

/********************************
Expand Down
1 change: 0 additions & 1 deletion src/backend/dt.c
Expand Up @@ -19,7 +19,6 @@
#include "cc.h"
#include "oper.h"
#include "global.h"
#include "parser.h"
#include "el.h"
#include "type.h"
#include "dt.h"
Expand Down
6 changes: 4 additions & 2 deletions src/backend/ee.c
Expand Up @@ -26,13 +26,15 @@
#include "type.h"
#include "oper.h"
#include "el.h"
#include "parser.h"
#include "cpp.h"
#include "exh.h"
#if TX86
#include "cgcv.h"
#endif

#if SCPP
#include "parser.h"
#endif

#include "iasm.h"

static char __file__[] = __FILE__; /* for tassert.h */
Expand Down
5 changes: 4 additions & 1 deletion src/backend/el.c
Expand Up @@ -27,12 +27,15 @@
#include "oper.h"
#include "type.h"

#include "parser.h"
#include "code.h"

#include "global.h"
#include "go.h"

#if SCPP
#include "parser.h"
#endif

static char __file__[] = __FILE__; /* for tassert.h */
#include "tassert.h"

Expand Down
6 changes: 4 additions & 2 deletions src/backend/evalu8.c
Expand Up @@ -35,11 +35,13 @@
#include "cc.h"
#include "oper.h" /* OPxxxx definitions */
#include "global.h"
#include "parser.h"
#include "el.h"
#include "type.h"
#include "cpp.h"

#if SCPP
#include "parser.h"
#include "cpp.h"
#endif

static char __file__[] = __FILE__; /* for tassert.h */
#include "tassert.h"
Expand Down
8 changes: 7 additions & 1 deletion src/backend/global.h
Expand Up @@ -83,6 +83,11 @@ CEXTERN block *block_last;
CEXTERN int errcnt;
CEXTERN regm_t fregsaved;

#if SCPP
CEXTERN targ_size_t dsout; /* # of bytes actually output to data */
#endif
CEXTERN tym_t pointertype; /* default data pointer type */

// cg.c
extern symbol *localgot;
extern symbol *tls_get_addr_sym;
Expand All @@ -106,6 +111,7 @@ void eecontext_parse();
/* doesn't belong here, but func to OPxxx is in exp2 */
void exp2_setstrthis(elem *e,Symbol *s,targ_size_t offset,type *t);
symbol *exp2_qualified_lookup(Classsym *sclass, int flags, int *pflags);
elem *exp2_copytotemp(elem *e);

/* util.c */
void util_progress();
Expand All @@ -115,7 +121,7 @@ void util_exit(int) __attribute__((analyzer_noreturn));
void util_exit(int);
#pragma ZTC noreturn(util_exit)
#endif
void util_set386(void);
void util_set32(void);
void util_set64(void);
int ispow2(targ_ullong);
#if TX86
Expand Down
4 changes: 4 additions & 0 deletions src/backend/gother.c
Expand Up @@ -23,6 +23,10 @@
#include "list.h"
#include "type.h"

#if SCPP
#include "parser.h"
#endif

static char __file__[] = __FILE__; /* for tassert.h */
#include "tassert.h"

Expand Down
2 changes: 0 additions & 2 deletions src/backend/nteh.c
Expand Up @@ -25,8 +25,6 @@
#include "dt.h"
#if SCPP
#include "scope.h"
#include "parser.h"
#include "cpp.h"
#endif
#include "exh.h"

Expand Down
4 changes: 3 additions & 1 deletion src/backend/out.c
Expand Up @@ -21,13 +21,13 @@
#include "oper.h"
#include "global.h"
#include "type.h"
#include "parser.h"
#include "filespec.h"
#include "code.h"
#include "cgcv.h"
#include "go.h"
#include "dt.h"
#if SCPP
#include "parser.h"
#include "cpp.h"
#include "el.h"
#endif
Expand Down Expand Up @@ -1184,6 +1184,7 @@ STATIC void writefunc2(symbol *sfunc)
blockopt(0); /* optimize */
}

#if SCPP
if (CPP)
{
// Look for any blocks that return nothing.
Expand All @@ -1209,6 +1210,7 @@ STATIC void writefunc2(symbol *sfunc)
func_noreturnvalue();
}
}
#endif
assert(funcsym_p == sfunc);
if (eecontext.EEcompile != 1)
{
Expand Down
7 changes: 5 additions & 2 deletions src/backend/symbol.c
Expand Up @@ -18,7 +18,6 @@
#include <time.h>

#include "cc.h"
#include "parser.h"
#include "global.h"
#include "type.h"
#include "dt.h"
Expand All @@ -27,10 +26,14 @@
#endif

#include "el.h"
#include "cpp.h"
#include "oper.h" /* for OPMAX */
#include "token.h"

#if SCPP
#include "parser.h"
#include "cpp.h"
#endif

static char __file__[] = __FILE__; /* for tassert.h */
#include "tassert.h"

Expand Down
28 changes: 16 additions & 12 deletions src/backend/type.c
Expand Up @@ -20,7 +20,10 @@
#include "global.h"
#include "type.h"
#include "el.h"

#if SCPP
#include "parser.h"
#endif

#undef MEM_PH_MALLOC
#define MEM_PH_MALLOC mem_fmalloc
Expand Down Expand Up @@ -1393,6 +1396,19 @@ void param_dehydrate(param_t **pp)
}
#endif

#if MARS

int typematch(type *t1, type *t2, int relax);

// Return TRUE if type lists match.
static int paramlstmatch(param_t *p1,param_t *p2)
{
return p1 == p2 ||
p1 && p2 && typematch(p1->Ptype,p2->Ptype,0) &&
paramlstmatch(p1->Pnext,p2->Pnext)
;
}

/*************************************************
* A cheap version of exp2.typematch() and exp2.paramlstmatch(),
* so that we can get cpp_mangle() to work for MARS.
Expand All @@ -1402,8 +1418,6 @@ void param_dehydrate(param_t **pp)
* !=0 if types match.
*/

#if MARS

int typematch(type *t1,type *t2,int relax)
{ tym_t t1ty, t2ty;
tym_t tym;
Expand Down Expand Up @@ -1438,16 +1452,6 @@ int typematch(type *t1,type *t2,int relax)
;
}

// Return TRUE if type lists match.

int paramlstmatch(param_t *p1,param_t *p2)
{
return p1 == p2 ||
p1 && p2 && typematch(p1->Ptype,p2->Ptype,0) &&
paramlstmatch(p1->Pnext,p2->Pnext)
;
}

#endif

#endif /* !SPP */
1 change: 0 additions & 1 deletion src/backend/var.c
Expand Up @@ -16,7 +16,6 @@
#include <time.h>

#include "cc.h"
#include "parser.h"
#include "global.h"
#include "oper.h"
#include "type.h"
Expand Down
2 changes: 0 additions & 2 deletions src/iasm.c
Expand Up @@ -45,14 +45,12 @@
#define SCOPE_H 1 // avoid conflicts with D's Scope
#include "cc.h"
#include "token.h"
#include "parser.h"
#include "global.h"
#include "el.h"
#include "type.h"
#include "oper.h"
#include "code.h"
#include "iasm.h"
#include "cpp.h"

#undef _DH

Expand Down

0 comments on commit e7dd41e

Please sign in to comment.