]> git.gag.com Git - fw/sdcc/commitdiff
Cleaned up ds390 leftovers in the mcs51 port.
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Mar 2001 16:19:13 +0000 (16:19 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 5 Mar 2001 16:19:13 +0000 (16:19 +0000)
Added target id's in port.h
Fixed configure and makefile to build only enabled ports, and do a proper clean
Renamed -mpic14 to -mpic

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

31 files changed:
device/lib/Makefile.in
device/lib/ds390/Makefile
src/Makefile.in
src/SDCCBBlock.h
src/SDCCcse.c
src/SDCCglue.c
src/SDCCicode.c
src/SDCCmain.c
src/SDCCset.c
src/SDCCsymt.c
src/avr/main.c
src/clean.mk
src/ds390/gen.c
src/ds390/gen.h
src/ds390/main.c
src/ds390/ralloc.c
src/izt/i186.c
src/izt/tlcs900h.c
src/mcs51/gen.c
src/mcs51/gen.h
src/mcs51/main.c
src/mcs51/peeph.def
src/mcs51/ralloc.c
src/pic/gen.c
src/pic/gen.h
src/pic/glue.c
src/pic/main.c
src/pic/ralloc.c
src/port.h
src/regression/Makefile
src/z80/main.c

index 1d3ad65542bb0e90919bae388e3b1d6a9fb02cb3..b172d3125039fc5939052254626121e00f6fffcc 100644 (file)
@@ -75,8 +75,7 @@ models:
 modelDS390:
        test -d ds390 || mkdir ds390
        rm -f ds390/*.lib
-       $(MAKE) CFLAGS="$(CFLAGS) -mds390 --model-flat24 \
-               --stack-10bit" objects
+       $(MAKE) CFLAGS="$(CFLAGS) -mds390" objects
        cd ds390; $(MAKE)
        cp *.lib ds390
        mv *.rel *.asm *.cdb ds390
index 5770d98b5b8b281abc727da28d0f1c09b9e4b77c..c30c988956bba4f9240099b836a07e6b1a74d344 100755 (executable)
@@ -7,10 +7,7 @@ OBJECTS = tinibios.rel memcpyx.rel  lcd390.rel i2c390.rel rtc390.rel
 SOURCES = $(patsubst %.rel,%.c,$(OBJECTS))
 
 CPPFLAGS = -I../../include
-CFLAGS = -mds390 \
-        --model-flat24 \
-        --stack-10bit \
-        $(CPPFLAGS) $(VERBOSE)
+CFLAGS = -mds390 $(CPPFLAGS) $(VERBOSE)
 
 all: $(OBJECTS) libds390.lib
 
index 5e05f3be8c6dea36c96b6f63e756347d98498d61..a16e04554407e67a248e7c4b3e298328ffa8d838 100644 (file)
@@ -8,7 +8,8 @@ include $(PRJDIR)/Makefile.common
 
 USE_ALT_LEX    = 0
 
-PORTS          = mcs51 z80 avr ds390 pic izt
+PORTS          = $(shell cat ../ports.build)
+ALLPORTS       = $(shell cat ../ports.all)
 PORT_LIBS      = $(PORTS:%=%/port.a)
 
 LIBS           = -lm @LIBS@
index d1dc54c8e5daf446aef7083773cfc540891f6a1d..268a262ee6cbaa713843774e0419db41d70b7854 100644 (file)
@@ -96,7 +96,7 @@ int otherPathsPresent (eBBlock **, eBBlock *);
 void replaceLabel (eBBlock *, symbol *, symbol *);
 void dumpEbbsToFileExt (char *, eBBlock **, int);
 
-#if defined(_MSC_VER)
+//#if defined(_MSC_VER)
 
 /*-----------------------------------------------------------------*/
 /* dumpLiveRanges - dump liverange information into a file         */
@@ -104,6 +104,6 @@ void dumpEbbsToFileExt (char *, eBBlock **, int);
 
 void dumpLiveRanges (char *ext, hTab * liveRanges);
 
-#endif // _MSC_VER
+//#endif // _MSC_VER
 
 #endif
index 04d4452d978219b2be4aa4759ef02824366191da..43c469a25e5b6298bda9034263fbc8e29cca0404 100644 (file)
@@ -1214,7 +1214,7 @@ fixUpTypes (iCode * ic)
 {
   sym_link *t1 = operandType (IC_LEFT (ic)), *t2;
 
-  if (IS_DS390_PORT)
+  if (TARGET_IS_DS390)
     {
       /* hack-o-matic! */
       return;
index c2fea95f8db60af23fb62ce15a1ddcbbc4ff1c88..3d88ce6de6fd7427f0df2f51717a5550e2c8fa40 100644 (file)
@@ -463,7 +463,7 @@ pointerTypeToGPByte (const int p_type)
 void 
 _printPointerType (FILE * oFile, const char *name)
 {
-  if (IS_DS390_PORT)
+  if (TARGET_IS_DS390)
     {
       fprintf (oFile, "\t.byte %s,(%s >> 8),(%s >> 16)", name, name, name);
     }
index f47e69c54c94e0dfa3a7e629a64d48495f99e0d1..3f7b868c3ebf0c7cee08547a39f2aa21da955b11 100644 (file)
@@ -51,7 +51,7 @@ operand *geniCodeRValue (operand *, bool);
 operand *geniCodeDerefPtr (operand *);
 
 #define PRINTFUNC(x) void x (FILE *of, iCode *ic, char *s)
-/* forward definition of print functions */
+/* forward definition of ic print functions */
 PRINTFUNC (picGetValueAtAddr);
 PRINTFUNC (picSetValueAtAddr);
 PRINTFUNC (picAddrOf);
@@ -1166,7 +1166,7 @@ operandFromSymbol (symbol * sym)
   /* under the following conditions create a
      register equivalent for a local symbol */
   if (sym->level && sym->etype && SPEC_OCLS (sym->etype) &&
-      (IN_FARSPACE (SPEC_OCLS (sym->etype)) && (!IS_DS390_PORT)) &&
+      (IN_FARSPACE (SPEC_OCLS (sym->etype)) && (!TARGET_IS_DS390)) &&
       options.stackAuto == 0)
     ok = 0;
 
@@ -1519,7 +1519,7 @@ geniCodeRValue (operand * op, bool force)
 
   if (IS_SPEC (type) &&
       IS_TRUE_SYMOP (op) &&
-      (!IN_FARSPACE (SPEC_OCLS (etype)) || IS_DS390_PORT))
+      (!IN_FARSPACE (SPEC_OCLS (etype)) || TARGET_IS_DS390))
     {
       op = operandFromOperand (op);
       op->isaddr = 0;
@@ -1678,19 +1678,11 @@ geniCodeMultiply (operand * left, operand * right, bool ptrSizeCalculation,
     }
   else {
          resType = usualBinaryConversions (&left, &right);
-         /*     if (IS_DS390_PORT) { */
-         /* jwk char*char=int
-            Now be can use the 16bit result of "mul a,b" instead of explicit
-            casts and support function calls as with --ansiint
-         */
-         /*       if ((IS_CHAR(letype) || IS_SHORT(letype)) &&  */
-         /*       (IS_CHAR(retype) || IS_SHORT(retype))) { */
          if (resultIsInt) {
                  SPEC_NOUN(getSpec(resType))=V_INT;
                  SPEC_SHORT(getSpec(resType))=0;
          }
   }
-/*   } */
 
   /* if the right is a literal & power of 2 */
   /* then make it a left shift              */
@@ -2794,7 +2786,7 @@ geniCodeReceive (value * args)
 
              if (IN_FARSPACE (SPEC_OCLS (sym->etype)) &&
                  options.stackAuto == 0 &&
-                 !IS_DS390_PORT)
+                 !TARGET_IS_DS390)
                {
                }
              else
index a40d003313df2e278bf17b894328b22c663c33c5..6490748a2da8a2ac11b347e7c69a2126dae23ed5 100644 (file)
@@ -158,7 +158,7 @@ static PORT *_ports[] =
   &ds390_port,
 #endif
 #if !OPT_DISABLE_PIC
-  &pic14_port,
+  &pic_port,
 #endif
 #if !OPT_DISABLE_I186
   &i186_port,
@@ -173,13 +173,13 @@ static PORT *_ports[] =
 /**
    remove me - TSD a hack to force sdcc to generate gpasm format .asm files.
  */
-extern void pic14glue ();
+extern void picglue ();
 
 /** Sets the port to the one given by the command line option.
     @param    The name minus the option (eg 'mcs51')
     @return     0 on success.
 */
-static int
+static void
 _setPort (const char *name)
 {
   int i;
@@ -188,7 +188,7 @@ _setPort (const char *name)
       if (!strcmp (_ports[i]->target, name))
        {
          port = _ports[i];
-         return 0;
+         return;
        }
     }
   /* Error - didnt find */
@@ -283,11 +283,11 @@ printVersionInfo ()
           "SDCC : ");
   for (i = 0; i < NUM_PORTS; i++)
     fprintf (stderr, "%s%s", i == 0 ? "" : "/", _ports[i]->target);
+
   fprintf (stderr, " %s"
 #ifdef SDCC_SUB_VERSION_STR
           "/" SDCC_SUB_VERSION_STR
 #endif
-          " ` "
 #ifdef __CYGWIN32__
           " (CYGWIN32)\n"
 #else
@@ -1034,10 +1034,7 @@ parseCmdLine (int argc, char **argv)
 
            case 'm':
              /* Used to select the port */
-             if (_setPort (argv[i] + 2))
-               {
-                 werror (W_UNSUPP_OPTION, "-m", "Unrecognised processor");
-               }
+             _setPort (argv[i] + 2);
              break;
 
            case 'a':
@@ -1327,7 +1324,7 @@ linkEdit (char **envp)
   /* standard library path */
   if (!options.nostdlib)
     {
-      if (IS_DS390_PORT)
+      if (TARGET_IS_DS390)
        {
          c = "ds390";
        }
@@ -1536,6 +1533,11 @@ main (int argc, char **argv, char **envp)
 
   /*printVersionInfo (); */
 
+  if (NUM_PORTS==0) {
+    fprintf (stderr, "Build error: no ports are enabled.\n");
+    exit (1);
+  }
+
   _findPort (argc, argv);
   /* Initalise the port. */
   if (port->init)
@@ -1583,13 +1585,14 @@ main (int argc, char **argv, char **envp)
 
       if (!fatalError)
        {
-         if (IS_PIC14_PORT)
+         if (!TARGET_IS_PIC) {
            /* TSD PIC port hack - if the PIC port option is enabled
               and SDCC is used to generate PIC code, then we will
               generate .asm files in gpasm's format instead of SDCC's
               assembler's format
            */
-           pic14glue ();
+           picglue ();
+         }
          else
            glue ();
          if (fatalError)
index 24e936aa440381f28daed9610ebfcd484ffd003b..007699edf685e210e45f3e71a5189deeb0dd3570 100644 (file)
@@ -23,6 +23,7 @@
 -------------------------------------------------------------------------*/
 
 #include <stdio.h>
+#include <malloc.h>
 #include "newalloc.h"
 #include <assert.h>
 #include "SDCCset.h"
index aecca442c390de9495d48899af930dd1150297c3..ae694d86d4c97a32c41d9ee59b661f0293a7a34a 100644 (file)
@@ -1111,7 +1111,7 @@ checkSClass (symbol * sym)
           * control this allcoation, but the code was originally that way, and
           * changing it for non-390 ports breaks the compiler badly.
           */
-         bool useXdata = IS_DS390_PORT ? options.model : options.useXstack;
+         bool useXdata = TARGET_IS_DS390 ? 1 : options.useXstack;
          SPEC_SCLS (sym->etype) = (useXdata ?
                                    S_XDATA : S_FIXED);
        }
@@ -1421,7 +1421,7 @@ aggregateArgToPointer (value * val)
          DCL_TYPE (val->type) = PPOINTER;
          break;
        case S_FIXED:
-         if (IS_DS390_PORT)
+         if (TARGET_IS_DS390)
            {
              /* The AUTO and REGISTER classes should probably
               * also become generic pointers, but I haven't yet
index c38e00a94ae3531bf7c5ae4491e5b095aa7e65d3..c2172bf1d7fce084f60845526f1755587d889fea 100644 (file)
@@ -147,6 +147,7 @@ static const char *_asmCmd[] = {
 
 /* Globals */
 PORT avr_port = {
+        TARGET_ID_AVR,
        "avr",
        "ATMEL AVR",            /* Target name */
        {
index b60ad6d7874bb653ed510fe58abad59afaec146d..165682d366ba333fdfa6fe3685d5a324563cc920 100644 (file)
@@ -4,7 +4,7 @@ clean:
        rm -f *core *[%~] *.[oa] *.output
        rm -f .[a-z]*~ \#*
        rm -f $(PRJDIR)/bin/sdcc sdcc
-       for port in $(PORTS) ; do\
+       for port in $(ALLPORTS) ; do\
          $(MAKE) -C $$port -f clean.mk clean ;\
        done
 
index 79c276c958c71b2236473f5db0627f33e844a91a..c1a456725bbdc05064ffb00e389dc1a134860775 100644 (file)
@@ -69,7 +69,7 @@ static char *spname;
 
 #define D(x) x
 
-unsigned fReturnSize_390 = 5;  /* shared with ralloc.c */
+unsigned fReturnSizeDS390 = 5; /* shared with ralloc.c */
 static char *fReturn[] =
 {"dpl", "dph", "dpx", "b", "a"};
 static char *accUse[] =
@@ -769,7 +769,7 @@ aopOp (operand * op, iCode * ic, bool result, bool useDP2)
 
          aop = op->aop = sym->aop = newAsmop (AOP_STR);
          aop->size = getSize (sym->type);
-         for (i = 0; i < (int) fReturnSize_390; i++)
+         for (i = 0; i < (int) fReturnSizeDS390; i++)
            aop->aopu.aop_str[i] = fReturn[i];
          return;
        }
@@ -9194,11 +9194,11 @@ genReceive (iCode * ic)
        IS_TRUE_SYMOP (IC_RESULT (ic))))
     {
       int size = getSize (operandType (IC_RESULT (ic)));
-      int offset = fReturnSize_390 - size;
+      int offset = fReturnSizeDS390 - size;
       while (size--)
        {
-         emitcode ("push", "%s", (strcmp (fReturn[fReturnSize_390 - offset - 1], "a") ?
-                           fReturn[fReturnSize_390 - offset - 1] : "acc"));
+         emitcode ("push", "%s", (strcmp (fReturn[fReturnSizeDS390 - offset - 1], "a") ?
+                           fReturn[fReturnSizeDS390 - offset - 1] : "acc"));
          offset++;
        }
       aopOp (IC_RESULT (ic), ic, FALSE, FALSE);
index c9589a0a64702c817ae6fe6ff0f2f12ed806ca1c..5ff118ec2b4757633c0f62158600d03fa306ef92 100644 (file)
@@ -75,6 +75,6 @@ asmop;
 
 void gen390Code (iCode *);
 
-extern unsigned fReturnSize_390;
+extern unsigned fReturnSizeDS390;
 
 #endif
index cc6887362447ce0bb815ad0883bea7c1d4f4997f..ee85833acdc0c44c981e111a8218840950cbfb1d 100644 (file)
@@ -198,6 +198,7 @@ static const char *_asmCmd[] =
 /* Globals */
 PORT ds390_port =
 {
+  TARGET_ID_DS390,
   "ds390",
   "DS80C390",                  /* Target name */
   {
index cd3947356f2c185d5866269031611e3ddf50d29e..f7ce298b659badc23e9edec29b96e4043fceebc1 100644 (file)
@@ -1885,7 +1885,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
 
   /* only upto 2 bytes since we cannot predict
      the usage of b, & acc */
-  if (getSize (operandType (op)) > (fReturnSize_390 - 2) &&
+  if (getSize (operandType (op)) > (fReturnSizeDS390 - 2) &&
       ic->op != RETURN &&
       ic->op != SEND &&
       !POINTER_SET (ic) &&
index 7b7829e5c8de62f8e0b3afc668fe71edf295c689..d576980438167cd8e4f40c4c28c6006dfb72c999 100644 (file)
@@ -185,6 +185,7 @@ i186_assignRegisters (eBBlock ** ebbs, int count)
 /* Globals */
 PORT i186_port =
 {
+  TARGET_ID_I186,
   "i186",
   "Intel 8086/80186",          /* Target name */
   {
index e0151ea3993b12be881bee3eea17a3e5d74c56fd..f8b2ac9f9dfb0d54848bc57c39d76ca005f4fbe7 100644 (file)
@@ -131,6 +131,7 @@ tlcs900h_assignRegisters (eBBlock ** ebbs, int count)
 /* Globals */
 PORT tlcs900h_port =
 {
+  TARGET_ID_TLCS900H,
   "tlcs900h",
   "Toshiba TLCS-900H",         /* Target name */
   {
index 4a1025f69b3ffa59a9731a068bd065aaffddb8c8..0b99a0242956dc098f62d09111bfa06f5a983acf 100644 (file)
@@ -67,9 +67,7 @@ static char *spname;
 
 char *fReturn8051[] =
 {"dpl", "dph", "b", "a"};
-char *fReturn390[] =
-{"dpl", "dph", "dpx", "b", "a"};
-unsigned fReturnSize = 4;      /* shared with ralloc.c */
+unsigned fReturnSizeMCS51 = 4; /* shared with ralloc.c */
 char **fReturn = fReturn8051;
 static char *accUse[] =
 {"a", "b"};
@@ -297,7 +295,7 @@ aopForSym (iCode * ic, symbol * sym, bool result)
   /* assign depending on the storage class */
   /* if it is on the stack or indirectly addressable */
   /* space we need to assign either r0 or r1 to it   */
-  if ((sym->onStack && !options.stack10bit) || sym->iaccess)
+  if (sym->onStack || sym->iaccess)
     {
       sym->aop = aop = newAsmop (0);
       aop->aopu.aop_ptr = getFreePtr (ic, &aop, result);
@@ -335,35 +333,6 @@ aopForSym (iCode * ic, symbol * sym, bool result)
       return aop;
     }
 
-  if (sym->onStack && options.stack10bit)
-    {
-      /* It's on the 10 bit stack, which is located in
-       * far data space.
-       */
-
-      if (_G.accInUse)
-       emitcode ("push", "acc");
-
-      emitcode ("mov", "a,_bp");
-      emitcode ("add", "a,#0x%02x",
-               ((sym->stack < 0) ?
-                ((char) (sym->stack - _G.nRegsSaved)) :
-                ((char) sym->stack)) & 0xff);
-
-      genSetDPTR (1);
-      emitcode ("mov", "dpx1,#0x40");
-      emitcode ("mov", "dph1,#0x00");
-      emitcode ("mov", "dpl1, a");
-      genSetDPTR (0);
-
-      if (_G.accInUse)
-       emitcode ("pop", "acc");
-
-      sym->aop = aop = newAsmop (AOP_DPTR2);
-      aop->size = getSize (sym->type);
-      return aop;
-    }
-
   /* if in bit space */
   if (IN_BITSPACE (space))
     {
@@ -638,7 +607,7 @@ aopOp (operand * op, iCode * ic, bool result)
          int i;
          aop = op->aop = sym->aop = newAsmop (AOP_STR);
          aop->size = getSize (sym->type);
-         for (i = 0; i < fReturnSize; i++)
+         for (i = 0; i < fReturnSizeMCS51; i++)
            aop->aopu.aop_str[i] = fReturn[i];
          return;
        }
@@ -715,15 +684,6 @@ freeAsmop (operand * op, asmop * aaop, iCode * ic, bool pop)
 
        getFreePtr (ic, &aop, FALSE);
 
-       if (options.stack10bit)
-         {
-           /* I'm not sure what to do here yet... */
-           /* #STUB */
-           fprintf (stderr,
-                    "*** Warning: probably generating bad code for "
-                    "10 bit stack mode.\n");
-         }
-
        if (stk)
          {
            emitcode ("mov", "a,_bp");
@@ -2031,12 +1991,6 @@ genPcall (iCode * ic)
   emitcode ("mov", "a,#(%05d$ >> 8)", (rlbl->key + 100));
   emitcode ("push", "acc");
 
-  if (options.model == MODEL_FLAT24)
-    {
-      emitcode ("mov", "a,#(%05d$ >> 16)", (rlbl->key + 100));
-      emitcode ("push", "acc");
-    }
-
   /* now push the calling address */
   aopOp (IC_LEFT (ic), ic, FALSE);
 
@@ -2222,20 +2176,6 @@ genFunction (iCode * ic)
        emitcode ("push", "dpl");
       if (!inExcludeList ("dph"))
        emitcode ("push", "dph");
-      if (options.model == MODEL_FLAT24 && !inExcludeList ("dpx"))
-       {
-         emitcode ("push", "dpx");
-         /* Make sure we're using standard DPTR */
-         emitcode ("push", "dps");
-         emitcode ("mov", "dps, #0x00");
-         if (options.stack10bit)
-           {
-             /* This ISR could conceivably use DPTR2. Better save it. */
-             emitcode ("push", "dpl1");
-             emitcode ("push", "dph1");
-             emitcode ("push", "dpx1");
-           }
-       }
       /* if this isr has no bank i.e. is going to
          run with bank 0 , then we need to save more
          registers :-) */
@@ -2434,17 +2374,6 @@ genEndFunction (iCode * ic)
            }
        }
 
-      if (options.model == MODEL_FLAT24 && !inExcludeList ("dpx"))
-       {
-         if (options.stack10bit)
-           {
-             emitcode ("pop", "dpx1");
-             emitcode ("pop", "dph1");
-             emitcode ("pop", "dpl1");
-           }
-         emitcode ("pop", "dps");
-         emitcode ("pop", "dpx");
-       }
       if (!inExcludeList ("dph"))
        emitcode ("pop", "dph");
       if (!inExcludeList ("dpl"))
@@ -6966,10 +6895,6 @@ genFarPointerGet (operand * left,
        {                       /* we need to get it byte by byte */
          emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE));
          emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE));
-         if (options.model == MODEL_FLAT24)
-           {
-             emitcode ("mov", "dpx,%s", aopGet (AOP (left), 2, FALSE, FALSE));
-           }
        }
     }
   /* so dptr know contains the address */
@@ -7019,10 +6944,6 @@ emitcodePointerGet (operand * left,
        {                       /* we need to get it byte by byte */
          emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE));
          emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE));
-         if (options.model == MODEL_FLAT24)
-           {
-             emitcode ("mov", "dpx,%s", aopGet (AOP (left), 2, FALSE, FALSE));
-           }
        }
     }
   /* so dptr know contains the address */
@@ -7076,15 +6997,7 @@ genGenPointerGet (operand * left,
        {                       /* we need to get it byte by byte */
          emitcode ("mov", "dpl,%s", aopGet (AOP (left), 0, FALSE, FALSE));
          emitcode ("mov", "dph,%s", aopGet (AOP (left), 1, FALSE, FALSE));
-         if (options.model == MODEL_FLAT24)
-           {
-             emitcode ("mov", "dpx,%s", aopGet (AOP (left), 2, FALSE, FALSE));
-             emitcode ("mov", "b,%s", aopGet (AOP (left), 3, FALSE, FALSE));
-           }
-         else
-           {
-             emitcode ("mov", "b,%s", aopGet (AOP (left), 2, FALSE, FALSE));
-           }
+         emitcode ("mov", "b,%s", aopGet (AOP (left), 2, FALSE, FALSE));
        }
     }
   /* so dptr know contains the address */
@@ -7592,10 +7505,6 @@ genFarPointerSet (operand * right,
        {                       /* we need to get it byte by byte */
          emitcode ("mov", "dpl,%s", aopGet (AOP (result), 0, FALSE, FALSE));
          emitcode ("mov", "dph,%s", aopGet (AOP (result), 1, FALSE, FALSE));
-         if (options.model == MODEL_FLAT24)
-           {
-             emitcode ("mov", "dpx,%s", aopGet (AOP (result), 2, FALSE, FALSE));
-           }
        }
     }
   /* so dptr know contains the address */
@@ -7650,15 +7559,7 @@ genGenPointerSet (operand * right,
        {                       /* we need to get it byte by byte */
          emitcode ("mov", "dpl,%s", aopGet (AOP (result), 0, FALSE, FALSE));
          emitcode ("mov", "dph,%s", aopGet (AOP (result), 1, FALSE, FALSE));
-         if (options.model == MODEL_FLAT24)
-           {
-             emitcode ("mov", "dpx,%s", aopGet (AOP (result), 2, FALSE, FALSE));
-             emitcode ("mov", "b,%s", aopGet (AOP (result), 3, FALSE, FALSE));
-           }
-         else
-           {
-             emitcode ("mov", "b,%s", aopGet (AOP (result), 2, FALSE, FALSE));
-           }
+         emitcode ("mov", "b,%s", aopGet (AOP (result), 2, FALSE, FALSE));
        }
     }
   /* so dptr know contains the address */
@@ -7806,25 +7707,10 @@ genAddrOf (iCode * ic)
       /* fill the result with zero */
       size = AOP_SIZE (IC_RESULT (ic)) - 1;
 
-
-      if (options.stack10bit && size < (FPTRSIZE - 1))
-       {
-         fprintf (stderr,
-                  "*** warning: pointer to stack var truncated.\n");
-       }
-
       offset = 1;
       while (size--)
        {
-         /* Yuck! */
-         if (options.stack10bit && offset == 2)
-           {
-             aopPut (AOP (IC_RESULT (ic)), "#0x40", offset++);
-           }
-         else
-           {
-             aopPut (AOP (IC_RESULT (ic)), zero, offset++);
-           }
+         aopPut (AOP (IC_RESULT (ic)), zero, offset++);
        }
 
       goto release;
@@ -8265,11 +8151,11 @@ genReceive (iCode * ic)
     {
 
       int size = getSize (operandType (IC_RESULT (ic)));
-      int offset = fReturnSize - size;
+      int offset = fReturnSizeMCS51 - size;
       while (size--)
        {
-         emitcode ("push", "%s", (strcmp (fReturn[fReturnSize - offset - 1], "a") ?
-                               fReturn[fReturnSize - offset - 1] : "acc"));
+         emitcode ("push", "%s", (strcmp (fReturn[fReturnSizeMCS51 - offset - 1], "a") ?
+                               fReturn[fReturnSizeMCS51 - offset - 1] : "acc"));
          offset++;
        }
       aopOp (IC_RESULT (ic), ic, FALSE);
index 567948f3d998e6c9a12e3f05ff65f0a8da68e174..4c5045793fc613ddbcf9093e40de992cda06c666 100644 (file)
@@ -40,20 +40,20 @@ enum
 typedef struct asmop
   {
 
-    short type;                        /* can have values
-                                  AOP_LIT    -  operand is a literal value
-                                  AOP_REG    -  is in registers
-                                  AOP_DIR    -  direct just a name
-                                  AOP_DPTR   -  dptr contains address of operand
-                                  AOP_DPTR2  -  dptr2 contains address of operand (DS80C390 only).
-                                  AOP_R0/R1  -  r0/r1 contains address of operand               
-                                  AOP_STK    -  should be pushed on stack this
-                                  can happen only for the result
-                                  AOP_IMMD   -  immediate value for eg. remateriazable 
-                                  AOP_CRY    -  carry contains the value of this
-                                  AOP_STR    -  array of strings
-                                  AOP_ACC    -  result is in the acc:b pair
-                                */
+    short type;                        
+    /* can have values
+       AOP_LIT    -  operand is a literal value
+       AOP_REG    -  is in registers
+       AOP_DIR    -  direct just a name
+       AOP_DPTR   -  dptr contains address of operand
+       AOP_R0/R1  -  r0/r1 contains address of operand               
+       AOP_STK    -  should be pushed on stack this
+       can happen only for the result
+       AOP_IMMD   -  immediate value for eg. remateriazable 
+       AOP_CRY    -  carry contains the value of this
+       AOP_STR    -  array of strings
+       AOP_ACC    -  result is in the acc:b pair
+    */
     short coff;                        /* current offset */
     short size;                        /* total size */
     unsigned code:1;           /* is in Code space */
@@ -75,9 +75,8 @@ asmop;
 
 void gen51Code (iCode *);
 
-extern char *fReturn8051[];
-extern char *fReturn390[];
-extern unsigned fReturnSize;
-extern char **fReturn;
+//extern char *fReturn8051[];
+extern unsigned fReturnSizeMCS51;
+//extern char **fReturn;
 
 #endif
index c9f6cd7f5633b60fc10928b5e70fd9ceb0c9d868..2e85421e4d71e1c6a64c46fab69bcadc8cef2925 100644 (file)
@@ -83,30 +83,6 @@ _mcs51_parseOptions (int *pargc, char **argv, int *i)
 static void
 _mcs51_finaliseOptions (void)
 {
-  /* Hack-o-matic: if we are using the flat24 model,
-   * adjust pointer sizes.
-   */
-  if (options.model == MODEL_FLAT24)
-    {
-
-      fprintf (stderr, "*** WARNING: you should use the '-mds390' option "
-              "for DS80C390 support. This code generator is "
-              "badly out of date and probably broken.\n");
-
-      port->s.fptr_size = 3;
-      port->s.gptr_size = 4;
-      port->stack.isr_overhead++;      /* Will save dpx on ISR entry. */
-#if 1
-      port->stack.call_overhead++;     /* This acounts for the extra byte 
-                                        * of return addres on the stack.
-                                        * but is ugly. There must be a 
-                                        * better way.
-                                        */
-#endif
-      fReturn = fReturn390;
-      fReturnSize = 5;
-    }
-
   if (options.model == MODEL_LARGE)
     {
       port->mem.default_local_map = xdata;
@@ -117,25 +93,6 @@ _mcs51_finaliseOptions (void)
       port->mem.default_local_map = data;
       port->mem.default_globl_map = data;
     }
-
-  if (options.stack10bit)
-    {
-      if (options.model != MODEL_FLAT24)
-       {
-         fprintf (stderr,
-                  "*** warning: 10 bit stack mode is only supported in flat24 model.\n");
-         fprintf (stderr, "\t10 bit stack mode disabled.\n");
-         options.stack10bit = 0;
-       }
-      else
-       {
-         /* Fixup the memory map for the stack; it is now in
-          * far space and requires a FPOINTER to access it.
-          */
-         istack->fmap = 1;
-         istack->ptrType = FPOINTER;
-       }
-    }
 }
 
 static void
@@ -154,45 +111,13 @@ _mcs51_getRegName (struct regs *reg)
 static void
 _mcs51_genAssemblerPreamble (FILE * of)
 {
-  if (options.model == MODEL_FLAT24)
-    {
-      fputs (".flat24 on\t\t; 24 bit flat addressing\n", of);
-      fputs ("dpx = 0x93\t\t; dpx register unknown to assembler\n", of);
-      fputs ("dps = 0x86\t\t; dps register unknown to assembler\n", of);
-      fputs ("dpl1 = 0x84\t\t; dpl1 register unknown to assembler\n", of);
-      fputs ("dph1 = 0x85\t\t; dph1 register unknown to assembler\n", of);
-      fputs ("dpx1 = 0x95\t\t; dpx1 register unknown to assembler\n", of);
-    }
 }
 
 /* Generate interrupt vector table. */
 static int
 _mcs51_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
 {
-  int i;
-
-  if (options.model != MODEL_FLAT24)
-    {
-      /* Let the default code handle it. */
-      return FALSE;
-    }
-
-  fprintf (of, "\tajmp\t__sdcc_gsinit_startup\n");
-
-  /* now for the other interrupts */
-  for (i = 0; i < maxInterrupts; i++)
-    {
-      if (interrupts[i])
-       {
-         fprintf (of, "\tljmp\t%s\n\t.ds\t4\n", interrupts[i]->rname);
-       }
-      else
-       {
-         fprintf (of, "\treti\n\t.ds\t7\n");
-       }
-    }
-
-  return TRUE;
+  return FALSE;
 }
 
 /** $1 is always the basename.
@@ -214,11 +139,12 @@ static const char *_asmCmd[] =
 /* Globals */
 PORT mcs51_port =
 {
+  TARGET_ID_MCS51,
   "mcs51",
   "MCU 8051",                  /* Target name */
   {
     TRUE,                      /* Emit glue around main */
-    MODEL_SMALL | MODEL_LARGE | MODEL_FLAT24,
+    MODEL_SMALL | MODEL_LARGE,
     MODEL_SMALL
   },
   {
index b089c32a901a31fa4cf78a21f8f94b44c3fb2170..e6008fe9520fa31748f7bb4acc720fc31ff03e4d 100644 (file)
@@ -539,20 +539,6 @@ replace {
         orl  a,r%2
 }
 
-replace {
-        mov  %1,a
-        mov  dpl,%2
-        mov  dph,%3
-       mov  dpx,%4
-        mov  a,%1
-} by {
-        ; Peephole 136a   removed redundant moves
-        mov  %1,a
-        mov  dpl,%2
-        mov  dph,%3
-       mov  dpx,%4
-} if 24bitMode
-
 replace {
         mov  %1,a
         mov  dpl,%2
@@ -1041,15 +1027,6 @@ replace {
         clr  a
 }
 
-replace {
-        mov  dpl,#0x00
-        mov  dph,#0x00
-       mov  dpx,#0x00
-} by {
-        ; Peephole 181a   used 24 bit load of dptr
-        mov  dptr,#0x0000
-} if 24bitMode
-
 // saving 3 byte, 2 cycles, return(NULL) profits here
 replace {
         mov  dpl,#0x00
@@ -1059,16 +1036,6 @@ replace {
         mov  dptr,#0x0000
 }
 
-// saves 2 bytes, ?? cycles.
-replace {
-        mov  dpl,#%1
-        mov  dph,#(%1 >> 8)
-       mov  dpx,#(%1 >> 16)
-} by {
-        ; Peephole 182a   used 24 bit load of dptr
-        mov  dptr,#%1
-} if 24bitMode
-
 // saving 3 byte, 2 cycles, return(float_constant) profits here
 replace {
         mov  dpl,#%1
@@ -1608,13 +1575,6 @@ replace {
         inc  %1
 }
 
-replace {
-        mov  dptr,#((((%1 >> 16)) <<16) + (((%1 >> 8)) <<8) + %1)
-} by {
-        ; Peephole 210a   simplified expression
-        mov  dptr,#%1
-} if 24bitMode
-
 replace {
         mov  dptr,#((((%1 >> 8)) <<8) + %1)
 } by {
index a5a61a86d667d0785436453bf504c8c1ba7eac5b..7c0c82b37a28da9128186986b7564f3ab1f75266 100644 (file)
@@ -1889,7 +1889,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
 
   /* only upto 2 bytes since we cannot predict
      the usage of b, & acc */
-  if (getSize (operandType (op)) > (fReturnSize - 2) &&
+  if (getSize (operandType (op)) > (fReturnSizeMCS51 - 2) &&
       ic->op != RETURN &&
       ic->op != SEND &&
       !POINTER_SET (ic) &&
index 4cf02854cbadecec64821547a83ed82d59bc253f..32a45cf081318ba5fe4bc91295d4095957d835ac 100644 (file)
@@ -73,7 +73,7 @@ static char *spname = "sp";
 
 char *fReturnpic14[] = {"FSR","dph","b","a" };
 //char *fReturn390[] = {"dpl","dph","dpx", "b","a" };
-static unsigned fReturnSize = 4; /* shared with ralloc.c */
+unsigned fReturnSizePic = 4; /* shared with ralloc.c */
 static char **fReturn = fReturnpic14;
 
 static char *accUse[] = {"a","b"};
@@ -717,7 +717,7 @@ static void aopOp (operand *op, iCode *ic, bool result)
             int i;
             aop = op->aop = sym->aop = newAsmop(AOP_STR);
             aop->size = getSize(sym->type);
-            for ( i = 0 ; i < fReturnSize ; i++ )
+            for ( i = 0 ; i < fReturnSizePic ; i++ )
              aop->aopu.aop_str[i] = fReturn[i];
            DEBUGemitcode(";","%d",__LINE__);
             return;
@@ -8895,10 +8895,10 @@ static void genReceive (iCode *ic)
          IS_TRUE_SYMOP(IC_RESULT(ic))) ) {
 
        int size = getSize(operandType(IC_RESULT(ic)));
-       int offset =  fReturnSize - size;
+       int offset =  fReturnSizePic - size;
        while (size--) {
-           emitcode ("push","%s", (strcmp(fReturn[fReturnSize - offset - 1],"a") ?
-                                   fReturn[fReturnSize - offset - 1] : "acc"));
+           emitcode ("push","%s", (strcmp(fReturn[fReturnSizePic - offset - 1],"a") ?
+                                   fReturn[fReturnSizePic - offset - 1] : "acc"));
            offset++;
        }
        aopOp(IC_RESULT(ic),ic,FALSE);  
index a2ff10ddac366acd4773eaf3b9f77c4ff3b6ab46..686a818be737fd5a8791150fa60587e51558e1b6 100644 (file)
@@ -76,9 +76,9 @@ asmop;
 
 void genpic14Code (iCode *);
 
-extern char *fReturnpic14[];
-extern char *fReturn390[];
-extern unsigned fReturnSize;
-extern char **fReturn;
+//extern char *fReturnpic14[];
+//extern char *fReturn390[];
+extern unsigned fReturnSizePic;
+//extern char **fReturn;
 
 #endif
index 77f6cc68591e7ba1f91148f514096a8abcd15c55..06616818ea0b3e791b7a172310349f8ad92816ee 100644 (file)
@@ -992,7 +992,7 @@ pic14emitOverlay (FILE * afile)
 /* glue - the final glue that hold the whole thing together        */
 /*-----------------------------------------------------------------*/
 void
-pic14glue ()
+picglue ()
 {
 
   FILE *vFile;
index e55b77aceb66556a75c05764e1119508a5a3da89..ebc5839bde0d96d6aa83d46938e723937e7f276a 100644 (file)
@@ -83,6 +83,7 @@ _pic14_parseOptions (int *pargc, char **argv, int *i)
 static void
 _pic14_finaliseOptions (void)
 {
+#if 0
   /* Hack-o-matic: if we are using the flat24 model,
    * adjust pointer sizes.
    */
@@ -136,6 +137,7 @@ _pic14_finaliseOptions (void)
          istack->ptrType = FPOINTER;
        }
     }
+#endif
 }
 
 static void
@@ -207,8 +209,9 @@ static const char *_asmCmd[] =
 };
 
 /* Globals */
-PORT pic14_port =
+PORT pic_port =
 {
+  TARGET_ID_PIC,
   "pic14",
   "MCU pic",                   /* Target name */
   {
index 244947d8b753d0c490b273c898a6a65008c35659..3a0ab79c178aab7b25dd9715622ec3f627fbfbe5 100644 (file)
@@ -2334,7 +2334,7 @@ packRegsForOneuse (iCode * ic, operand * op, eBBlock * ebp)
 
   /* only upto 2 bytes since we cannot predict
      the usage of b, & acc */
-  if (getSize (operandType (op)) > (fReturnSize - 2) &&
+  if (getSize (operandType (op)) > (fReturnSizePic - 2) &&
       ic->op != RETURN &&
       ic->op != SEND)
     return NULL;
index e23528f807d7211055763cee79b82415f9d8ddef..db0eda65796de2a2baf4500b269e5ee6b5df5880 100644 (file)
@@ -5,9 +5,33 @@
 #ifndef PORT_INCLUDE
 #define PORT_INCLUDE
 
+#define TARGET_ID_MCS51    1
+#define TARGET_ID_GBZ80    2
+#define TARGET_ID_Z80      3
+#define TARGET_ID_AVR      4
+#define TARGET_ID_DS390    5
+#define TARGET_ID_PIC      6
+#define TARGET_ID_I186     7
+#define TARGET_ID_TLCS900H 8
+#define TARGET_ID_XA51     9
+
+/* Macro to test the target we are compiling for.
+   Can only be used after SDCCmain has defined the port
+*/
+#define TARGET_IS_MCS51 (port->id==TARGET_ID_MCS51)
+#define TARGET_IS_GBZ80 (port->id==TARGET_ID_GBZ80)
+#define TARGET_IS_Z80 (port->id==TARGET_ID_Z80)
+#define TARGET_IS_AVR (port->id==TARGET_ID_AVR)
+#define TARGET_IS_DS390 (port->id==TARGET_ID_DS390)
+#define TARGET_IS_PIC   (port->id==TARGET_ID_PIC)
+#define TARGET_IS_I186 (port->id==TARGET_ID_I186)
+#define TARGET_IS_TCLS900H (port->id==TARGET_ID_TCLS900H)
+
 /* Processor specific names */
 typedef struct
   {
+/** Unique id for this target */
+    const int id;
 /** Target name used for -m */
     const char *target;
 
@@ -16,7 +40,7 @@ typedef struct
 
     struct
       {
-       /** TRUE if all types of glue functions should be inseted into
+       /** TRUE if all types of glue functions should be inserted into
            the file that also defines main.
            We dont want this in cases like the z80 where the startup
            code is provided by a seperate module.
@@ -134,7 +158,7 @@ typedef struct
     const char *fun_prefix;
 
     /** Called once the processor target has been selected.
-       First chance to initalise and set any port specific varibles.
+       First chance to initalise and set any port specific variables.
        'port' is set before calling this.  May be NULL.
     */
     void (*init) (void);
@@ -211,7 +235,7 @@ extern PORT avr_port;
 extern PORT ds390_port;
 #endif
 #if !OPT_DISABLE_PIC
-extern PORT pic14_port;
+extern PORT pic_port;
 #endif
 #if !OPT_DISABLE_I186
 extern PORT i186_port;
@@ -220,14 +244,4 @@ extern PORT i186_port;
 extern PORT tlcs900h_port;
 #endif
 
-/* Test to see if we are current compiling in what? port. */
-#define IS_MCS51_PORT (port == &mcs51_port)
-#define IS_GBZ80_PORT (port == &gbz80_port)
-#define IS_Z80_PORT (port == &z80_port)
-#define IS_AVR_PORT (port == &avr_port)
-#define IS_DS390_PORT (port == &ds390_port)
-#define IS_PIC14_PORT (port == &pic14_port)
-#define IS_I186_PORT (port == &i186_port)
-#define IS_TCLS900H_PORT (port == &tlcs900h_port)
-
 #endif PORT_INCLUDE
index 31b090bfb291cc20c9db8b5dd8374f0c5928aee2..4442d5a33ae4d6d904f5308fd1cc9037d0ae221c 100644 (file)
@@ -72,7 +72,7 @@ all:  test
 
 # The asm files are generated by sdcc
 .c.asm:
-       $(CC) -mpic14 -c $*.c
+       $(CC) -mpic -c $*.c
 
 # The .cod files are generated by gpasm
 # these get loaded by gpsim.
index 45ebf1a67badb25958b7e4aa7028d6a513c0c5a2..78dfad948350d8ff049ba5f06451ffde26513187 100644 (file)
@@ -317,6 +317,7 @@ static const char *_gbz80_asmCmd[] =
 /* Globals */
 PORT z80_port =
 {
+  TARGET_ID_Z80,
   "z80",
   "Zilog Z80",                 /* Target name */
   {
@@ -391,6 +392,7 @@ PORT z80_port =
 /* Globals */
 PORT gbz80_port =
 {
+  TARGET_ID_GBZ80,
   "gbz80",
   "Gameboy Z80-like",          /* Target name */
   {