Shifted all area names into port. Shifted assembler names and opts
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 23 Jan 2000 19:07:41 +0000 (19:07 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 23 Jan 2000 19:07:41 +0000 (19:07 +0000)
into port.  Shiftet type sizes.
Now compiles cleanly on the Z80.  Probably doesnt work but.

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@24 4a8a32a2-be11-0410-ad9d-d568d2c75423

21 files changed:
src/SDCCglobl.h
src/SDCCglue.c
src/SDCCicode.c
src/SDCCmain.c
src/SDCCmem.h
src/mcs51/gen.c
src/mcs51/main.c
src/mcs51/ralloc.c
src/port.h
src/z80/Makefile
src/z80/gen.c
src/z80/global.h [deleted file]
src/z80/glue.c [deleted file]
src/z80/glue.h [deleted file]
src/z80/icode.c [deleted file]
src/z80/main.c
src/z80/main.h [deleted file]
src/z80/mem.c [deleted file]
src/z80/mem.h [deleted file]
src/z80/memmaps.h [deleted file]
src/z80/port.h [deleted file]

index f7fa682fd50aefd8226ca5892a0973753409f728..4b9e21cc4cbb511b2daf9377cd46ab623ba74834 100644 (file)
@@ -45,16 +45,16 @@ typedef int bool;
 #endif
 
 /* size's in bytes  */
-#define CHARSIZE    1
-#define SHORTSIZE   1
-#define INTSIZE     2
-#define LONGSIZE    4
-#define PTRSIZE     1
-#define FPTRSIZE    2
-#define GPTRSIZE    3
-#define BITSIZE     1
-#define FLOATSIZE   4
-#define MAXBASESIZE 4
+#define CHARSIZE    port->s.char_size
+#define SHORTSIZE   port->s.short_size
+#define INTSIZE     port->s.int_size
+#define LONGSIZE    port->s.long_size
+#define PTRSIZE     port->s.ptr_size
+#define FPTRSIZE    port->s.fptr_size
+#define GPTRSIZE    port->s.gptr_size
+#define BITSIZE     port->s.bit_size
+#define FLOATSIZE   port->s.float_size
+#define MAXBASESIZE port->s.max_base_size
 
 
 #define PRAGMA_SAVE        "SAVE"
index 3dfe3748f384f51a5256f53b15bc0be45adb72b0..0e1d470d77aaeef9a5b55193e90aa57a10b70734 100644 (file)
@@ -778,7 +778,7 @@ static void emitOverlay(FILE *afile)
     set *ovrset;
     
     if (!elementsInSet(ovrSetSets))
-       fprintf(afile,"\t.area\tOSEG\t(OVR,DATA)\n");
+       fprintf(afile,"\t.area\t%s\n", port->mem.overlay_name);
 
     /* for each of the sets in the overlay segment do */
     for (ovrset = setFirstItem(ovrSetSets); ovrset;
@@ -793,7 +793,7 @@ static void emitOverlay(FILE *afile)
               sad but true */
            fprintf(afile,"\t.area _DUMMY\n");
            /* output the area informtion */
-           fprintf(afile,"\t.area\tOSEG\t(OVR,DATA)\n"); /* MOF */
+           fprintf(afile,"\t.area\t%s\n", port->mem.overlay_name); /* MOF */
        }
        
        for (sym = setFirstItem(ovrset); sym;
@@ -980,7 +980,7 @@ void glue ()
     fprintf (asmFile, "%s", iComments2);
     fprintf (asmFile, "; global & static initialisations\n");
     fprintf (asmFile, "%s", iComments2);
-    fprintf (asmFile, "\t.area GSINIT (CODE)\n"); /* MOF */
+    fprintf (asmFile, "\t.area %s\n", port->mem.static_name); /* MOF */
     if (mainf && mainf->fbody) {
        fprintf (asmFile,"__sdcc_gsinit_startup:\n");
        /* if external stack is specified then the
@@ -1018,7 +1018,7 @@ void glue ()
     fprintf (asmFile, "%s", iComments2);
     fprintf (asmFile, "; code\n");
     fprintf (asmFile, "%s", iComments2);
-    fprintf (asmFile, "\t.area CSEG (CODE)\n");
+    fprintf (asmFile, "\t.area %s\n", port->mem.code_name);
     if (mainf && mainf->fbody) {
        
        /* entry point @ start of CSEG */
index adfc7307b4a4df18354c5bcbee413fde285dea78..fa19b13f8d149e731e1010bd19dafee0e098a5cd 100644 (file)
@@ -184,7 +184,7 @@ int printOperand (operand *op, FILE *file)
                int i;
                fprintf(file,"[");
                for(i=0;i<OP_SYMBOL(op)->nRegs;i++)
-                   fprintf(file,"%s ", port->getRegName(OP_SYMBOL(op)));
+                   fprintf(file,"%s ", port->getRegName(OP_SYMBOL(op)->regs[i]));
                fprintf(file,"]");
            }
        } 
index 1a4ba19390df6920cddcd62a27c1105c4e63b7f7..4b80021e4f274ed2b42b74b930d257d8e1f967ed 100644 (file)
@@ -123,6 +123,7 @@ PORT *port;
 
 static PORT *_ports[] = {
     &mcs51_port,
+    &z80_port
 };
 
 #define NUM_PORTS (sizeof(_ports)/sizeof(_ports[0]))
@@ -1001,19 +1002,28 @@ static void linkEdit (char **envp)
 static void assemble (char **envp)
 {
     char *asmArgs[128];  /* assembler arguments */
+    /* PENDING: A bit messy */
+    char buffer2[1024];
+
     int i = 2;
 
-    asmArgs[0] = "asx8051";
+    asmArgs[0] = port->assembler.exec_name;
     
 /*     if (options.debug) */
-    asmArgs[1] = "-plosgffc" ;
+    asmArgs[1] = port->assembler.debug_opts;
 /*     else */
-/*     asmArgs[1] = "-plosgff"; */
+/*     asmArgs[1] = port->assembler.plain_opts; */
 
     /* add the extra options if any */
     for (; asmOptions[i-2] ; i++)
        asmArgs[i] = asmOptions[i-2];
 
+    if (port->assembler.requires_output_name) {
+       sprintf(buffer2, srcFileName);
+       strcat(buffer2, ".o");
+       asmArgs[i++] = buffer2;
+    }
+       
     /* create the assembler file name */
     sprintf (buffer, srcFileName);
     strcat (buffer, ".asm");
@@ -1021,7 +1031,7 @@ static void assemble (char **envp)
 
     asmArgs[i] = 0; /* end of args */
 
-    if (my_system("asx8051",asmArgs)) {
+    if (my_system(port->assembler.exec_name, asmArgs)) {
        perror("Cannot exec linker");
        exit(1);
     }
@@ -1083,8 +1093,8 @@ static void _findPort(int argc, char **argv)
        argv++;
        argc--;
     }
-    /* Assume mcs51 */
-    port = &mcs51_port;
+    /* Use the first in the list */
+    port = _ports[0];
 }
 
 /* 
index 09ce432b875e6c6035faa458bd0a19527a774841..03961ad3d292087b7b589be72007af0840136b32 100644 (file)
@@ -26,15 +26,15 @@ typedef  struct memmap{
 extern FILE    *junkFile ;     
 
 /* memory map prefixes  MOF added the DATA,CODE,XDATA,BIT */
-#define  XSTACK_NAME   "XSEG    (XDATA)"
-#define  ISTACK_NAME   "STACK   (DATA)"
-#define  CODE_NAME     "CSEG    (CODE)"
-#define  DATA_NAME     "DSEG    (DATA)"
-#define  IDATA_NAME    "ISEG    (DATA)"
-#define  XDATA_NAME    "XSEG    (XDATA)"
-#define  BIT_NAME      "BSEG    (BIT)"
-#define  REG_NAME      "RSEG    (DATA)"
-#define  STATIC_NAME   "GSINIT  (CODE)"
+#define  XSTACK_NAME   port->mem.xstack_name
+#define  ISTACK_NAME   port->mem.istack_name
+#define  CODE_NAME     port->mem.code_name
+#define  DATA_NAME     port->mem.data_name
+#define  IDATA_NAME    port->mem.idata_name
+#define  XDATA_NAME    port->mem.xdata_name
+#define  BIT_NAME      port->mem.bit_name
+#define  REG_NAME      port->mem.reg_name
+#define  STATIC_NAME   port->mem.static_name
  
 /* forward definition for variables */
 extern   memmap  *xstack;    /* xternal stack data         */
index 6fb9f88d16ba9455a323af7f2852ae7aa1479d5f..148c988e412ba72d34c1cda9911f9c64d0b03b3e 100644 (file)
@@ -86,12 +86,12 @@ static void saverbank (int, iCode *,bool);
 #define MOVA(x) if (strcmp(x,"a") && strcmp(x,"acc")) emitcode("mov","a,%s",x);
 #define CLRC    emitcode("clr","c");
 
-lineNode *lineHead = NULL;
-lineNode *lineCurr = NULL;
+static lineNode *lineHead = NULL;
+static lineNode *lineCurr = NULL;
 
-unsigned char   SLMask[] = {0xFF ,0xFE, 0xFC, 0xF8, 0xF0,
+static unsigned char   SLMask[] = {0xFF ,0xFE, 0xFC, 0xF8, 0xF0,
 0xE0, 0xC0, 0x80, 0x00};
-unsigned char   SRMask[] = {0xFF, 0x7F, 0x3F, 0x1F, 0x0F,
+static unsigned char   SRMask[] = {0xFF, 0x7F, 0x3F, 0x1F, 0x0F,
 0x07, 0x03, 0x01, 0x00};
 
 #define LSB     0
index 0d34e392dcf2c23c0fc55f9721e8477919768f11..49cee9e099e31ddb79d9740d37e1cc4d48225529 100644 (file)
@@ -1,7 +1,14 @@
+/** @file main.c
+    mcs51 specific general functions.
+
+    Note that mlh prepended _mcs51_ on the static functions.  Makes
+    it easier to set a breakpoint using the debugger.
+*/
 #include "common.h"
 #include "main.h"
 #include "ralloc.h"
 
+
 void mcs51_assignRegisters (eBBlock **ebbs, int count);
 
 static bool _mcs51_parseOptions(int *pargc, char **argv)
@@ -41,6 +48,18 @@ PORT mcs51_port = {
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
        1, 1, 2, 4, 1, 2, 3, 1, 4, 4
     },
+    {
+       "XSEG    (XDATA)",
+       "STACK   (DATA)",
+       "CSEG    (CODE)",
+       "DSEG    (DATA)",
+       "ISEG    (DATA)",
+       "XSEG    (XDATA)",
+       "BSEG    (BIT)",
+       "RSEG    (DATA)",
+       "GSINIT  (CODE)",
+       "OSEG    (OVR,DATA)"
+    },
     { 
        +1, 1, 4, 0, 0
     },
@@ -54,4 +73,3 @@ PORT mcs51_port = {
     mcs51_assignRegisters,
     _mcs51_getRegName
 };
-
index 9e0ccc9db7768b57dc644ad319d4f724922cc7ff..2ae154ab80cf6b6b565f92f8bfbb4dad1f90b33f 100644 (file)
    You are forbidden to forbid anyone else to use, share and improve
    what you give them.   Help stamp out software-hoarding!  
 -------------------------------------------------------------------------*/
-#include <stdio.h>
-#include <stdlib.h>
-#include "SDCCglobl.h"
-#include "SDCCast.h"
-#include "SDCCmem.h"
-#include "SDCCy.h" 
-#include "SDCChasht.h"
-#include "SDCCbitv.h"
-#include "SDCCset.h"
-#include "SDCCicode.h"
-#include "SDCClabel.h"
-#include "SDCCBBlock.h"
-#include "SDCCloop.h"
-#include "SDCCcse.h"
-#include "SDCCcflow.h"
-#include "SDCCdflow.h"
-#include "SDCClrange.h"
-#include "SDCCralloc.h"
+
+#include "common.h"
+#include "ralloc.h"
 
 /*-----------------------------------------------------------------*/
 /* At this point we start getting processor specific although      */
@@ -87,7 +72,7 @@ regs regs8051[] =
     { REG_CND  ,CND_IDX,REG_CND , "C"  , "C"  ,  "xreg", 0, 1 },  
 };
 int mcs51_nRegs = 13;
-void spillThis (symbol *);
+static void spillThis (symbol *);
 
 /*-----------------------------------------------------------------*/
 /* allocReg - allocates register of given type                     */
@@ -283,7 +268,7 @@ static int notUsedInBlock (symbol *sym, eBBlock *ebp, iCode *ic)
 /*-----------------------------------------------------------------*/
 /* notUsedInRemaining - not used or defined in remain of the block */
 /*-----------------------------------------------------------------*/
-int notUsedInRemaining (symbol *sym, eBBlock *ebp, iCode *ic)
+static int notUsedInRemaining (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     return ((usedInRemaining (operandFromSymbol(sym),ic) ? 0 : 1) &&
            allDefsOutOfRange (sym->defs,ic->seq,ebp->lSeq));
@@ -292,7 +277,7 @@ int notUsedInRemaining (symbol *sym, eBBlock *ebp, iCode *ic)
 /*-----------------------------------------------------------------*/
 /* allLRs - return true for all                                    */
 /*-----------------------------------------------------------------*/
-int allLRs (symbol *sym, eBBlock *ebp, iCode *ic)
+static int allLRs (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     return 1;
 }
@@ -300,7 +285,7 @@ int allLRs (symbol *sym, eBBlock *ebp, iCode *ic)
 /*-----------------------------------------------------------------*/
 /* liveRangesWith - applies function to a given set of live range  */
 /*-----------------------------------------------------------------*/
-set *liveRangesWith (bitVect *lrs, int (func)(symbol *,eBBlock *, iCode *),
+static set *liveRangesWith (bitVect *lrs, int (func)(symbol *,eBBlock *, iCode *),
                     eBBlock *ebp, iCode *ic)
 {
     set *rset = NULL;
@@ -333,7 +318,7 @@ set *liveRangesWith (bitVect *lrs, int (func)(symbol *,eBBlock *, iCode *),
 /*-----------------------------------------------------------------*/
 /* leastUsedLR - given a set determines which is the least used    */
 /*-----------------------------------------------------------------*/
-symbol *leastUsedLR (set *sset)
+static symbol *leastUsedLR (set *sset)
 {
     symbol *sym = NULL, *lsym = NULL ;
     
@@ -364,7 +349,7 @@ symbol *leastUsedLR (set *sset)
 /*-----------------------------------------------------------------*/
 /* noOverLap - will iterate through the list looking for over lap  */
 /*-----------------------------------------------------------------*/
-int noOverLap (set *itmpStack, symbol *fsym)
+static int noOverLap (set *itmpStack, symbol *fsym)
 {
     symbol *sym;
    
@@ -382,7 +367,7 @@ int noOverLap (set *itmpStack, symbol *fsym)
 /*-----------------------------------------------------------------*/
 /* isFree - will return 1 if the a free spil location is found     */
 /*-----------------------------------------------------------------*/
-DEFSETFUNC(isFree)
+static DEFSETFUNC(isFree)
 {
     symbol *sym = item;
     V_ARG(symbol **,sloc);
@@ -409,7 +394,7 @@ DEFSETFUNC(isFree)
 /*-----------------------------------------------------------------*/
 /* spillLRWithPtrReg :- will spil those live ranges which use PTR  */
 /*-----------------------------------------------------------------*/
-void spillLRWithPtrReg (symbol *forSym)
+static void spillLRWithPtrReg (symbol *forSym)
 {
     symbol *lrsym;
     regs *r0,*r1;
@@ -451,7 +436,7 @@ void spillLRWithPtrReg (symbol *forSym)
 /*-----------------------------------------------------------------*/
 /* createStackSpil - create a location on the stack to spil        */
 /*-----------------------------------------------------------------*/
-symbol *createStackSpil (symbol *sym)
+static symbol *createStackSpil (symbol *sym)
 {
     symbol *sloc= NULL;
     int useXstack, model, noOverlay;
@@ -525,7 +510,7 @@ symbol *createStackSpil (symbol *sym)
 /*-----------------------------------------------------------------*/
 /* isSpiltOnStack - returns true if the spil location is on stack  */
 /*-----------------------------------------------------------------*/
-bool isSpiltOnStack (symbol *sym)
+static bool isSpiltOnStack (symbol *sym)
 {
     link *etype;
 
@@ -551,7 +536,7 @@ bool isSpiltOnStack (symbol *sym)
 /*-----------------------------------------------------------------*/
 /* spillThis - spils a specific operand                            */
 /*-----------------------------------------------------------------*/
-void spillThis (symbol *sym)
+static void spillThis (symbol *sym)
 {
     int i;
     /* if this is rematerializable or has a spillLocation
@@ -590,7 +575,7 @@ void spillThis (symbol *sym)
 /*-----------------------------------------------------------------*/
 /* selectSpil - select a iTemp to spil : rather a simple procedure */
 /*-----------------------------------------------------------------*/
-symbol *selectSpil (iCode *ic, eBBlock *ebp, symbol *forSym)
+static symbol *selectSpil (iCode *ic, eBBlock *ebp, symbol *forSym)
 {
     bitVect *lrcs= NULL ; 
     set *selectS ;
@@ -683,7 +668,7 @@ symbol *selectSpil (iCode *ic, eBBlock *ebp, symbol *forSym)
 /*-----------------------------------------------------------------*/
 /* spilSomething - spil some variable & mark registers as free     */
 /*-----------------------------------------------------------------*/
-bool spilSomething (iCode *ic, eBBlock *ebp, symbol *forSym)
+static bool spilSomething (iCode *ic, eBBlock *ebp, symbol *forSym)
 {
     symbol *ssym;
     int i ;
@@ -771,7 +756,7 @@ regs *getRegPtr (iCode *ic, eBBlock *ebp, symbol *sym)
 /*-----------------------------------------------------------------*/
 /* getRegGpr - will try for GPR if not spil                        */
 /*-----------------------------------------------------------------*/
-regs *getRegGpr (iCode *ic, eBBlock *ebp,symbol *sym)
+static regs *getRegGpr (iCode *ic, eBBlock *ebp,symbol *sym)
 {
     regs *reg;
 
@@ -811,7 +796,7 @@ static bool symHasReg(symbol *sym,regs *reg)
 /* deassignLRs - check the live to and if they have registers & are*/
 /*               not spilt then free up the registers              */
 /*-----------------------------------------------------------------*/
-void deassignLRs (iCode *ic, eBBlock *ebp)
+static void deassignLRs (iCode *ic, eBBlock *ebp)
 {
     symbol *sym;
     int k;
@@ -904,7 +889,7 @@ void deassignLRs (iCode *ic, eBBlock *ebp)
 /*-----------------------------------------------------------------*/
 /* reassignLR - reassign this to registers                         */
 /*-----------------------------------------------------------------*/
-void reassignLR (operand *op)
+static void reassignLR (operand *op)
 {
     symbol *sym = OP_SYMBOL(op);
     int i;
@@ -924,7 +909,7 @@ void reassignLR (operand *op)
 /*-----------------------------------------------------------------*/
 /* willCauseSpill - determines if allocating will cause a spill    */
 /*-----------------------------------------------------------------*/
-int willCauseSpill ( int nr, int rt)
+static int willCauseSpill ( int nr, int rt)
 {
     /* first check if there are any avlb registers
        of te type required */
@@ -987,7 +972,7 @@ static void positionRegs (symbol *result, symbol *opsym, int lineno)
 /*-----------------------------------------------------------------*/
 /* serialRegAssign - serially allocate registers to the variables  */
 /*-----------------------------------------------------------------*/
-void serialRegAssign (eBBlock **ebbs, int count)
+static void serialRegAssign (eBBlock **ebbs, int count)
 {
     int i;
 
@@ -1127,7 +1112,7 @@ void serialRegAssign (eBBlock **ebbs, int count)
 /*-----------------------------------------------------------------*/
 /* rUmaskForOp :- returns register mask for an operand             */
 /*-----------------------------------------------------------------*/
-bitVect *rUmaskForOp (operand *op)
+static bitVect *rUmaskForOp (operand *op)
 {
     bitVect *rumask;
     symbol *sym;
@@ -1157,7 +1142,7 @@ bitVect *rUmaskForOp (operand *op)
 /*-----------------------------------------------------------------*/
 /* regsUsedIniCode :- returns bit vector of registers used in iCode*/
 /*-----------------------------------------------------------------*/
-bitVect *regsUsedIniCode (iCode *ic)
+static bitVect *regsUsedIniCode (iCode *ic)
 {
     bitVect *rmask = newBitVect(mcs51_nRegs);
 
@@ -1197,7 +1182,7 @@ bitVect *regsUsedIniCode (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* createRegMask - for each instruction will determine the regsUsed*/
 /*-----------------------------------------------------------------*/
-void createRegMask (eBBlock **ebbs, int count)
+static void createRegMask (eBBlock **ebbs, int count)
 {
     int i;
 
@@ -1261,7 +1246,7 @@ void createRegMask (eBBlock **ebbs, int count)
 /*-----------------------------------------------------------------*/
 /* rematStr - returns the rematerialized string for a remat var    */
 /*-----------------------------------------------------------------*/
-char *rematStr (symbol *sym)
+static char *rematStr (symbol *sym)
 {
     char *s = buffer;   
     iCode *ic = sym->rematiCode;    
@@ -1288,7 +1273,7 @@ char *rematStr (symbol *sym)
 /*-----------------------------------------------------------------*/
 /* regTypeNum - computes the type & number of registers required   */
 /*-----------------------------------------------------------------*/
-void regTypeNum ()
+static void regTypeNum ()
 {
     symbol *sym;
     int k;
@@ -1379,7 +1364,7 @@ void regTypeNum ()
 /*-----------------------------------------------------------------*/
 /* freeAllRegs - mark all registers as free                        */
 /*-----------------------------------------------------------------*/
-void freeAllRegs()
+static void freeAllRegs()
 {
     int i;
 
@@ -1390,7 +1375,7 @@ void freeAllRegs()
 /*-----------------------------------------------------------------*/
 /* deallocStackSpil - this will set the stack pointer back         */
 /*-----------------------------------------------------------------*/
-DEFSETFUNC(deallocStackSpil)
+static DEFSETFUNC(deallocStackSpil)
 {
     symbol *sym = item;
 
@@ -1464,7 +1449,7 @@ static iCode *farSpacePackable (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* packRegsForAssign - register reduction for assignment           */
 /*-----------------------------------------------------------------*/
-int packRegsForAssign (iCode *ic,eBBlock *ebp)
+static int packRegsForAssign (iCode *ic,eBBlock *ebp)
 {
     iCode *dic, *sic;
     
@@ -1576,7 +1561,7 @@ pack:
 /*-----------------------------------------------------------------*/
 /* findAssignToSym : scanning backwards looks for first assig found*/
 /*-----------------------------------------------------------------*/
-iCode *findAssignToSym (operand *op,iCode *ic)
+static iCode *findAssignToSym (operand *op,iCode *ic)
 {
     iCode *dic;
 
@@ -1648,7 +1633,7 @@ iCode *findAssignToSym (operand *op,iCode *ic)
 /*-----------------------------------------------------------------*/
 /* packRegsForSupport :- reduce some registers for support calls   */
 /*-----------------------------------------------------------------*/
-int packRegsForSupport (iCode *ic, eBBlock *ebp)
+static int packRegsForSupport (iCode *ic, eBBlock *ebp)
 {
     int change = 0 ;
     /* for the left & right operand :- look to see if the
@@ -1864,7 +1849,7 @@ static bool isBitwiseOptimizable (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* packRegsForAccUse - pack registers for acc use                  */
 /*-----------------------------------------------------------------*/
-void packRegsForAccUse (iCode *ic)
+static void packRegsForAccUse (iCode *ic)
 {
     iCode *uic;
     
index 756efb38ac7e3ac3dccb8f344626c3d6b77081c7..b1503ae4ea73b86009c9fb8529662b2df8d91588 100644 (file)
@@ -38,6 +38,19 @@ typedef struct {
        int float_size;
        int max_base_size;
     } s;
+    /** Names for all the memory regions */
+    struct {
+       const char *xstack_name;
+       const char *istack_name;
+       const char *code_name;
+       const char *data_name;
+       const char *idata_name;
+       const char *xdata_name;
+       const char *bit_name;
+       const char *reg_name;
+       const char *static_name;
+       const char *overlay_name;
+    } mem;
     struct {
        /** -1 for grows down (z80), +1 for grows up (mcs51) */
        int direction;
index 77f51e6d6aec24158f3e5da2b1d2295b04d26a78..b8f9ab40b42097f1739a07c638f8763900791149 100644 (file)
@@ -2,7 +2,7 @@ PRJDIR = ../..
 
 include $(PRJDIR)/Makefile.common
 
-OBJ = icode.o gen.o ralloc.o main.o glue.o mem.o
+OBJ = gen.o ralloc.o main.o
 LIB = port.a
 
 CFLAGS = -ggdb -Wall
index f34803e41306f9c3db9033ff7ba5fb2de6297f21..3f5075bd183dc55ba4dc0e5975924080447b69fb 100644 (file)
@@ -521,27 +521,6 @@ dealloc:
     }
 }
 
-/*-----------------------------------------------------------------*/
-/* aopLiteral - string from a literal value                        */
-/*-----------------------------------------------------------------*/
-char *aopLiteral (value *val, int offset)
-{
-    char *rs;
-
-    /* if it is a float then it gets tricky */
-    /* otherwise it is fairly simple */
-    if (!IS_FLOAT(val->type)) {
-        unsigned long v = floatFromVal(val);
-
-        v >>= (offset * 8);
-        sprintf(buffer,"#0x%02x",((char) v) & 0xff);
-        ALLOC_ATOMIC(rs,strlen(buffer)+1);
-        return strcpy (rs,buffer);
-    }
-
-    assert(0);
-}
-
 char *aopGetWord(asmop *aop, int offset)
 {
     char *s = buffer ;
@@ -1221,12 +1200,7 @@ static void genEndFunction (iCode *ic)
         if (SPEC_CRTCL(sym->etype))
             emitcode("ei", "");
        
-       if (sym->calleeSave) {
-           /* Handled by cret */
-       }
-       else {
-           assert(0);
-       }
+       /* PENDING: calleeSave */
 
        /* if debug then send end of function */
        if (options.debug && currFunc) { 
diff --git a/src/z80/global.h b/src/z80/global.h
deleted file mode 100644 (file)
index f20caa2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-typedef struct {
-} PROCESSOR_OPTIONS;
-
diff --git a/src/z80/glue.c b/src/z80/glue.c
deleted file mode 100644 (file)
index 878e082..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "SDCCglue.h"
-#include "glue.h"
-
-extern int maxRegBank ;
-
-/* Not yet ported */
-#if 0
-void x_glue(FILE *asmFile)
-{
-    assert(asmFile);
-}
-
-void x_insertMainHook(FILE *asmFile)
-{
-    assert(asmFile);
-
-    if (mainf && mainf->fbody) {
-       fprintf (asmFile,"__sdcc_gsinit_startup:\n");
-    }
-
-}
-#endif
diff --git a/src/z80/glue.h b/src/z80/glue.h
deleted file mode 100644 (file)
index 03d38b9..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef GLUE_INCLUDE
-#define GLUE_INCLUDE
-
-#include <stdio.h>
-
-void x_glue(FILE *asmFile);
-void x_insertMainHook(FILE *asmFile);
-
-#endif
diff --git a/src/z80/icode.c b/src/z80/icode.c
deleted file mode 100644 (file)
index e569685..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-#include "SDCCglobl.h"
-#include "SDCCast.h"
-#include "SDCCmem.h"
-#include "SDCCy.h"
-#include "SDCChasht.h"
-#include "SDCCicode.h"
-#include "SDCCerr.h"
-#include "ralloc.h"
-
-/* Not ported yet */
-#if 0
-/*-----------------------------------------------------------------*/
-/* aggrToPtr - changes an aggregate to pointer to an aggregate     */
-/*-----------------------------------------------------------------*/
-link *aggrToPtr ( link *type, bool force)
-{
-    link *etype ;
-    link *ptype ;
-
-    
-    if (IS_PTR(type) && !force)
-       return type;
-
-    etype = getSpec(type);
-    ptype = newLink();
-
-    ptype->next = type;
-    /* if the output class is generic */
-    if (SPEC_OCLS(etype) == generic)
-       DCL_TYPE(ptype) = GPOINTER;
-    else
-       if (SPEC_OCLS(etype)->codesp ) {
-           DCL_TYPE(ptype) = POINTER ;
-           DCL_PTR_CONST(ptype) = 1;
-       }
-       else
-           DCL_TYPE(ptype) = POINTER ;
-    
-    /* if the variable was declared a constant */
-    /* then the pointer points to a constant */
-    if (IS_CONSTANT(etype) )
-       DCL_PTR_CONST(ptype) = 1;
-
-    /* the variable was volatile then pointer to volatile */
-    if (IS_VOLATILE(etype))
-       DCL_PTR_VOLATILE(ptype) = 1;
-    return ptype; 
-}
-
-/*-----------------------------------------------------------------*/
-/* geniCodeArray2Ptr - array to pointer                            */
-/*-----------------------------------------------------------------*/
-operand *geniCodeArray2Ptr (operand *op)
-{
-    link *optype = operandType(op);
-    link *opetype = getSpec(optype);
-    
-    /* set the pointer depending on the storage class */
-    if (SPEC_OCLS(opetype)->codesp ) {
-       DCL_TYPE(optype) = POINTER ;
-       DCL_PTR_CONST(optype) = 1;
-    }
-    else {
-       DCL_TYPE(optype) = POINTER;
-    }
-    
-    /* if the variable was declared a constant */
-    /* then the pointer points to a constant */
-    if (IS_CONSTANT(opetype) )
-       DCL_PTR_CONST(optype) = 1;
-
-    /* the variable was volatile then pointer to volatile */
-    if (IS_VOLATILE(opetype))
-       DCL_PTR_VOLATILE(optype) = 1;
-    op->isaddr = 0;
-    return op;
-}
-
-/*-----------------------------------------------------------------*/
-/* geniCodeAddressOf - gens icode for '&' address of operator      */
-/*-----------------------------------------------------------------*/
-operand *geniCodeAddressOf (operand *op) 
-{
-    iCode *ic;
-    link *p ;
-    link *optype = operandType(op);
-    link *opetype= getSpec(optype);
-    
-    /* this must be a lvalue */
-    if (!op->isaddr && !IS_AGGREGATE(optype)) {
-       werror (E_LVALUE_REQUIRED,"&");
-       return op;
-    }
-    
-    p = newLink();
-    p->class = DECLARATOR ;
-    /* set the pointer depending on the storage class */
-    if (SPEC_OCLS(opetype)->codesp ) {
-       DCL_TYPE(p) = POINTER ;
-       DCL_PTR_CONST(p) = 1;
-    }
-    else {
-       DCL_TYPE(p) = POINTER ;
-    }
-    
-    /* make sure we preserve the const & volatile */
-    if (IS_CONSTANT(opetype)) 
-       DCL_PTR_CONST(p) = 1;
-
-    if (IS_VOLATILE(opetype))
-       DCL_PTR_VOLATILE(p) = 1;
-    
-    p->next = copyLinkChain(optype);
-    
-    /* if already a temp */
-    if (IS_ITEMP(op)) {
-       setOperandType (op,p);     
-       op->isaddr= 0;
-       return op;
-    }
-    
-    /* other wise make this of the type coming in */
-    ic = newiCode(ADDRESS_OF,op,NULL);
-    IC_RESULT(ic) = newiTempOperand(p,1);
-    IC_RESULT(ic)->isaddr = 0;
-    ADDTOCHAIN(ic);
-    return IC_RESULT(ic);
-}
-
-/*-----------------------------------------------------------------*/
-/* setOClass - sets the output class depending on the pointer type */
-/*-----------------------------------------------------------------*/
-void setOClass (link *ptr, link *spec)
-{
-    switch (DCL_TYPE(ptr)) {
-    case POINTER:
-       SPEC_OCLS(spec) = data ;
-       break ;
-       
-    case CPOINTER:
-       SPEC_OCLS(spec) = code ;
-       break ;  
-
-    case GPOINTER:
-       SPEC_OCLS(spec) = generic;
-       break;
-
-    default:
-       assert(0);
-    }
-}
-
-#endif
index 280ffdd8b5829300c16358a04e41fdbf6eef01ce..bfc1c9fdb5e038c2999c6e774ca2c8bc73b0f193 100644 (file)
@@ -1,5 +1,5 @@
 #include "common.h"
-#include "main.h"
+#include "ralloc.h"
 
 void z80_assignRegisters (eBBlock **ebbs, int count);
 
@@ -31,6 +31,13 @@ static void _z80_setDefaultOptions(void)
     optimize.loopInduction = 0;
 }
 
+static const char *_z80_getRegName(struct regs *reg)
+{
+    if (reg)
+       return reg->name;
+    return "err";
+}
+
 /* Globals */
 PORT z80_port = {
     "z80",
@@ -48,6 +55,18 @@ PORT z80_port = {
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
        1, 1, 2, 4, 2, 2, 2, 1, 4, 4
     },
+    {
+       "_XSEG",
+       "_STACK",
+       "_CODE",
+       "_DATA",
+       "_ISEG",
+       "_XSEG",
+       "_BSEG",
+       "_RSEG",
+       "_GSINIT",
+       "_OVERLAY"
+    },
     { 
        -1, 0, 0, 8, 0
     },
@@ -59,5 +78,6 @@ PORT z80_port = {
     _z80_finaliseOptions,
     _z80_setDefaultOptions,
     z80_assignRegisters,
+    _z80_getRegName
 };
 
diff --git a/src/z80/main.h b/src/z80/main.h
deleted file mode 100644 (file)
index c4d1602..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef MAIN_INCLUDE
-#define MAIN_INCLUDE
-
-bool x_parseOptions(char **argv, int *pargc);
-void x_setDefaultOptions(void);
-void x_finaliseOptions(void);
-
-#endif
diff --git a/src/z80/mem.c b/src/z80/mem.c
deleted file mode 100644 (file)
index adc7e72..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "SDCCglobl.h"
-#include "SDCCmem.h"
-#include "mem.h"
-
-memmap  *xstack= NULL ;         /* xternal stack data         */
-memmap  *xdata = NULL;  /* external data                          */
-memmap  *idata = NULL;  /* internal data upto 256     */
-memmap  *bit   = NULL;  /* bit addressable space      */
-memmap  *sfr   = NULL;   /* register space              */
-memmap  *sfrbit= NULL;   /* sfr bit space               */
-memmap  *overlay=NULL;   /* overlay segment             */
-
-void x_initMem(void)
-{
-}
-
diff --git a/src/z80/mem.h b/src/z80/mem.h
deleted file mode 100644 (file)
index 78b5f60..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef MEM_INCLUDE
-#define MEM_INCLUDE
-
-/* memory map prefixes  MOF added the DATA,CODE,XDATA,BIT */
-#define  OVERLAY_NAME          "_OVERLAY"
-#define  CODE_NAME             "_CODE"
-#define  DATA_NAME             "_DATA"
-#define  STATIC_NAME           "GSINIT"
-#define GENERIC_NAME           "GENERIC"
-#define ISTACK_NAME            "_STACK"
-
-#define IN_STACK(x)  (IS_SPEC(x) && (SPEC_OCLS(x) == istack ))
-#define IN_FARSPACE(x) FALSE
-
-typedef struct {
-} X_MEMMAP;
-
-#endif
diff --git a/src/z80/memmaps.h b/src/z80/memmaps.h
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/z80/port.h b/src/z80/port.h
deleted file mode 100644 (file)
index aa265dc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/** Set to target the 8051 */
-#define PROCESSOR_Z80          1
-
-#define HAS_BITSPACE           0
-#define HAS_REGSPACE           0
-#define HAS_PAGEDSPACE         0
-#define HAS_DIRECTSPACE                0
-#define HAS_XDATA              0
-#define HAS_OVERLAY            0
-#define HAS_IDATA              0
-#define HAS_SFRSPACE           0
-#define HAS_SFRBITSPACE                0
-#define HAS_XSTACK             0
-
-#define HAS_INTERRUPT_TABLE    0
-
-/** Setting this is equivalent to --stack-auto --no-peep --main-return --callee-saves --noregparms --xstack */
-#define USE_CLEAN_OPTIONS      1
-/** Set if the callee should save _all_ registers */
-#define USE_CALLEE_SAVES_ALL   1
-