Skip to content

Commit

Permalink
update with D2 backend changes
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jun 24, 2015
1 parent 69d366f commit a9902c6
Show file tree
Hide file tree
Showing 53 changed files with 1,022 additions and 900 deletions.
26 changes: 13 additions & 13 deletions src/backend/blockopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ block *curblock; /* current block being read in */
block *block_last; // last block read in

static block * block_freelist;


////////////////////////////
// Storage allocator.

Expand Down Expand Up @@ -207,7 +207,7 @@ void block_goto(block *bgoto,block *bnew)
}

#endif


/**********************************
* Replace block numbers with block pointers.
* Also compute numblks and maxblks.
Expand All @@ -228,7 +228,7 @@ void block_ptr()
}
maxblks = 3 * numblks; /* allow for increase in # of blocks */
}


/*******************************
* Build predecessor list (Bpred) for each block.
*/
Expand Down Expand Up @@ -291,7 +291,7 @@ void block_compbcount()
block_visit(startblock); // visit all reachable blocks
elimblks(); // eliminate unvisited blocks
}


/*******************************
* Free list of blocks.
*/
Expand Down Expand Up @@ -567,7 +567,7 @@ void block_endfunc(int flag)
curblock = NULL; // undefined from now on
block_last = NULL;
}


/******************************
* Perform branch optimization on basic blocks.
*/
Expand Down Expand Up @@ -655,7 +655,7 @@ void blockopt(int iter)
#endif
}
}


/***********************************
* Try to remove control structure.
* That is, try to resolve if-else, goto and return statements
Expand Down Expand Up @@ -872,7 +872,7 @@ void brcombine()
}
} while (0);
}


/***********************
* Branch optimization.
*/
Expand Down Expand Up @@ -989,7 +989,7 @@ STATIC void bropt()
}
}
}


/*********************************
* Do branch rearrangement.
*/
Expand Down Expand Up @@ -1068,7 +1068,7 @@ STATIC void brrear()
#endif
} /* for */
}


/*************************
* Compute depth first order (DFO).
* Equivalent to Aho & Ullman Fig. 13.8.
Expand Down Expand Up @@ -1130,7 +1130,7 @@ STATIC void search(block *b)
dfo[--dfotop] = b; // add to dfo[]
b->Bdfoidx = dfotop; // link back
}


/*************************
* Remove blocks not marked as visited (they aren't in dfo[]).
* A block is not in dfo[] if not visited.
Expand Down Expand Up @@ -1299,7 +1299,7 @@ STATIC int mergeblks()
}
return merge;
}


/*******************************
* Combine together blocks that are identical.
*/
Expand Down Expand Up @@ -1462,7 +1462,7 @@ STATIC void blident()
}
}
}


/**********************************
* Split out return blocks so the returns can be combined into a
* single block by blident().
Expand Down Expand Up @@ -1534,7 +1534,7 @@ STATIC void blreturn()
blident(); /* combine return blocks */
}
}


/*****************************************
* Convert expression into a list.
* Construct the list in reverse, that is, so that the right-most
Expand Down
33 changes: 11 additions & 22 deletions src/backend/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* For any other uses, please contact Digital Mars.
*/

#if __SC__
#if __DMC__
#pragma once
#endif

Expand Down Expand Up @@ -191,7 +191,7 @@ typedef struct SYMTAB_S symtab_t;
struct code;

extern Config config;


/////////// Position in source file

typedef struct Srcpos
Expand All @@ -210,9 +210,6 @@ typedef struct Srcpos
#if M_UNIX
short Sfilnum; // file number
#endif
#if SOURCE_OFFSETS
unsigned long Sfiloff; // byte offset
#endif

void print(const char *func);
} Srcpos;
Expand Down Expand Up @@ -352,12 +349,12 @@ extern Cstate cstate;
// done on it, so it is stack and register variables.)
#define symbol_isintab(s) (sytab[(s)->Sclass] & SCSS)

#if defined(__SC__) || defined(_MSC_VER)
#if defined(__DMC__) || defined(_MSC_VER)
typedef char enum_SC;
#else
typedef enum SC enum_SC;
#endif


/******************************************
* Basic blocks:
* Basic blocks are a linked list of all the basic blocks
Expand Down Expand Up @@ -605,7 +602,7 @@ enum BC {
BCjplace = 19, // Jupiter: placeholder
BCMAX
};


/**********************************
* Functions
*/
Expand Down Expand Up @@ -737,7 +734,7 @@ typedef struct MEMINIT
/* called for it */
} meminit_t;



/************************************
* Base classes are a list of these.
*/
Expand Down Expand Up @@ -926,7 +923,7 @@ typedef struct ENUM
/* typedef enum { ... } E; */
symlist_t SEenumlist; // all members of enum
} enum_t;


/***********************************
* Special information for structs.
*/
Expand Down Expand Up @@ -1060,7 +1057,7 @@ typedef struct STRUCT

#define struct_calloc() ((struct_t *) mem_fcalloc(sizeof(struct_t)))
#define struct_free(st) ((void)(st))


/**********************************
* Symbol Table
*/
Expand Down Expand Up @@ -1297,10 +1294,6 @@ struct Symbol
}_SXR;
regm_t Sregsaved; // mask of registers not affected by this func

#if SOURCE_4SYMS
Srcpos Ssrcpos; // file position for definition
#endif

char Sident[SYM_PREDEF_SZ]; // identifier string (dynamic array)
// (the size is for static Symbols)

Expand Down Expand Up @@ -1344,7 +1337,7 @@ struct Aliassym : Symbol { };
inline char *prettyident(Symbol *s) { return s->Sident; }
#endif



/**********************************
* Function parameters:
* Pident identifier of parameter
Expand Down Expand Up @@ -1387,9 +1380,6 @@ struct PARAM
PARAM *Pnext; // next in list
unsigned Pflags;
#define PFexplicit 1 // this template argument was explicit, i.e. in < >
#if SOURCE_4PARAMS
Srcpos Psrcpos; // parameter source definition
#endif

PARAM *createTal(PARAM *); // create template-argument-list blank from
// template-parameter-list
Expand All @@ -1399,7 +1389,7 @@ struct PARAM
void print(); // print this param_t
void print_list(); // print this list of param_t's
};


/**************************************
* Element types.
* These should be combined with storage classes.
Expand Down Expand Up @@ -1455,7 +1445,7 @@ enum FL
#endif
FLMAX
};


////////// Srcfiles

#if !MARS
Expand Down Expand Up @@ -1590,7 +1580,6 @@ extern Declar gdeclar;
* w = symbol number (pointer for CPP)
* a = offset
* DTcoff offset into code segment
* DTend mark end of list
*/

struct dt_t
Expand Down
9 changes: 4 additions & 5 deletions src/backend/cdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/* Macros defined by the compiler, not the code:
Compiler:
__SC__ Symantec compiler
__DMC__ Digital Mars compiler
_MSC_VER Microsoft compiler
__GNUC__ Gnu compiler
Expand Down Expand Up @@ -421,7 +420,7 @@ typedef long double longdouble;
#endif

#define TOOFFSET(a,b) (I32 ? TOLONG(a,b) : TOWORD(a,b))


/***************************
* Target machine data types as they appear on the host.
*/
Expand Down Expand Up @@ -596,7 +595,7 @@ Written by Walter Bright"
#endif
#endif
#endif


/**********************************
* Configuration
*/
Expand Down Expand Up @@ -680,8 +679,8 @@ struct Config
unsigned objfmt; // target object format
#define OBJ_OMF 1
#define OBJ_MSCOFF 2
#define OBJ_ELF 3
#define OBJ_MACH 4
#define OBJ_ELF 4
#define OBJ_MACH 8
unsigned exe; // target operating system
#define EX_DOSX 1 // DOSX 386 program
#define EX_ZPM 2 // ZPM 286 program
Expand Down
2 changes: 1 addition & 1 deletion src/backend/cdeflnx.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define M_UNIX 1
#define MEMMODELS 1
#if __GNUC__
#define __SC__ 0
//#define __DMC__ 0
#define _MSC_VER 0
#endif

Expand Down
Loading

0 comments on commit a9902c6

Please sign in to comment.