* src/port.h (struct PORT): added field gp_tags, to hold the tag
authorvrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 13 Jun 2006 08:32:55 +0000 (08:32 +0000)
committervrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 13 Jun 2006 08:32:55 +0000 (08:32 +0000)
value of generic pointers,
* src/avr/main.c,
src/ds390/main.c,
src/hc08/main.c,
src/izt/i186.c,
src/izt/tlcs900h.c,
src/mcs51/main.c,
src/pic/main.c,
src/pic16/main.c,
src/xa51/main.c,
src/z80/main.c: PORT structure, added elements for gp_tags field,
* src/SDCCsymt.h: replaced hardwired values of GPTYPE_* macros with
fields in the PORT structure of each port,
* src/SDCCast.c (decorateType): allow processing of generic pointers
for PIC16 port (FPTRSIZE equals GPTRSIZE), also set GPTYPE_NEAR for
S_FIXED symbols

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

15 files changed:
ChangeLog
src/SDCCast.c
src/SDCCsymt.h
src/avr/main.c
src/ds390/main.c
src/hc08/main.c
src/izt/i186.c
src/izt/tlcs900h.c
src/mcs51/main.c
src/pic/main.c
src/pic16/gen.c
src/pic16/main.c
src/port.h
src/xa51/main.c
src/z80/main.c

index 84f9228923a85726db043fe46522c1d31bddcad9..c6a0511b0a5d369b703029353e1e34f0abed2914 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2006-06-13 Vangelis Rokas <vrokas AT users.sourceforge.net>
+
+       * src/port.h (struct PORT): added field gp_tags, to hold the tag
+       value of generic pointers,
+       * src/avr/main.c,
+         src/ds390/main.c,
+         src/hc08/main.c,
+         src/izt/i186.c,
+         src/izt/tlcs900h.c,
+         src/mcs51/main.c,
+         src/pic/main.c,
+         src/pic16/main.c,
+         src/xa51/main.c,
+         src/z80/main.c: PORT structure, added elements for gp_tags field,
+       * src/SDCCsymt.h: replaced hardwired values of GPTYPE_* macros with
+       fields in the PORT structure of each port,
+       * src/SDCCast.c (decorateType): allow processing of generic pointers
+       for PIC16 port (FPTRSIZE equals GPTRSIZE), also set GPTYPE_NEAR for
+       S_FIXED symbols
+
 2006-06-12 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * link/z80/lkgb.c,
index f3ae4175283b5039a973591c53ddbcea72da5e21..d607641a39d978a0837532d06d4de8e0bcc3d569 100644 (file)
@@ -3866,7 +3866,8 @@ decorateType (ast * tree, RESULT_TYPE resultType)
         unsigned int gptype = 0;
         unsigned int addr = SPEC_ADDR (sym->etype);
 
-        if (IS_GENPTR (LTYPE (tree)) && GPTRSIZE > FPTRSIZE)
+        if (IS_GENPTR (LTYPE (tree)) && ((GPTRSIZE > FPTRSIZE)
+                                        || TARGET_IS_PIC16) )
           {
             switch (SPEC_SCLS (sym->etype))
               {
@@ -3885,6 +3886,9 @@ decorateType (ast * tree, RESULT_TYPE resultType)
                 break;
               default:
                 gptype = 0;
+
+                if(TARGET_IS_PIC16 && (SPEC_SCLS(sym->etype) == S_FIXED))
+                    gptype = GPTYPE_NEAR;
               }
             addr |= gptype << (8*(GPTRSIZE - 1));
           }
index 8455dbcfb2bdda4ae4b78b39ddd160253c0c336d..1d54708f3f1a80ae38d87ac3fb1cba33a2d4f571 100644 (file)
@@ -60,10 +60,17 @@ enum {
 };
 
 // values for first byte (or 3 most significant bits) of generic pointer.
+#if 0
 #define GPTYPE_FAR       0x00
 #define GPTYPE_NEAR      0x40
 #define GPTYPE_XSTACK    0x60
 #define GPTYPE_CODE      0x80
+#else
+#define GPTYPE_FAR     (port->gp_tags.tag_far)
+#define GPTYPE_NEAR    (port->gp_tags.tag_near)
+#define GPTYPE_XSTACK  (port->gp_tags.tag_xstack)
+#define GPTYPE_CODE    (port->gp_tags.tag_code)
+#endif
 
 #define HASHTAB_SIZE 256
 
index 828c3c033f19bee402fa721fa54dd7f2210cde01..c2ea6a0c73b9063700cfa7fb09d9afbf27482102 100644 (file)
@@ -201,6 +201,10 @@ PORT avr_port = {
        {
         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
         1, 2, 2, 4, 2, 2, 3, 1, 4, 4},
+       
+        /* tags for generic pointers */
+       { 0x00, 0x40, 0x60, 0x80 },             /* far, near, xstack, code */
+       
        {
         "XSEG",
         "STACK",
index 7f735daae2c767b140325effde37255bc5fdfd26..f39dbc62cc14f7c465e0b5903ed55ff666a5b133 100644 (file)
@@ -861,6 +861,10 @@ PORT ds390_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 1, 2, 3, 1, 4, 4
   },
+  
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
+
   {
     "XSEG    (XDATA)",
     "STACK   (DATA)",
@@ -1174,6 +1178,9 @@ PORT tininative_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 1, 3, 3, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
+
   {
     "XSEG    (XDATA)",
     "STACK   (DATA)",
@@ -1402,6 +1409,10 @@ PORT ds400_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 1, 2, 3, 1, 4, 4
   },
+
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
+
   {
     "XSEG    (XDATA)",
     "STACK   (DATA)",
index a86d3a127bdc1160baf373b2b9931b74e06a475a..be780ab42b182f99dd7a5fd9c381732b6b6f9f39 100644 (file)
@@ -419,6 +419,9 @@ PORT hc08_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
+  
   {
     "XSEG",
     "STACK",
index 1a3f0fe6bff05dcfe3b44db413707b6ef98002aa..da67d9efc095d2349ceeb14eaeeeecf7d0f7db93 100644 (file)
@@ -165,6 +165,9 @@ PORT i186_port = {
         /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
         1, 2, 2, 4, 2, 2, 2, 1, 4, 4
     },
+    /* tags for generic pointers */
+    { 0x00, 0x40, 0x60, 0x80 },                /* far, near, xstack, code */
+
     {
         ".BSS",
         ".BSS",
index 7810233f6843490b04997e912e7242fd637b432d..f3b42af648791e5ab61e6e868a4a68406648ee59 100644 (file)
@@ -164,6 +164,8 @@ PORT tlcs900h_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
   {
     "XSEG    (XDATA)",
     "STACK   (DATA)",
index c1b18ea0b34b13abacb85fd877a23162dc320b7c..40dcc69e5c3291711f5de13b724e2264d8287f29 100644 (file)
@@ -735,6 +735,8 @@ PORT mcs51_port =
     /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 1, 2, 3, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
   {
     "XSTK    (PAG,XDATA)",      // xstack_name
     "STACK   (DATA)",           // istack_name
index efca60eaa99c71149c5cc9e9e7794cf663253cf4..760ad9a0e6ec1670b1017da93098b619ad00e377 100644 (file)
@@ -540,6 +540,8 @@ PORT pic_port =
                   16f877)
                 */
        },
+       /* tags for generic pointers */
+       { 0x00, 0x00, 0x00, 0x80 },             /* far, near, xstack, code */
        {
                "XSEG    (XDATA)",
                "STACK   (DATA)",
index 1b16d206a74b70399d21944942d8fe8dbe04dfab..2d4bfe00fe353bfedefa20cb16d0a7756b622c10 100644 (file)
@@ -3980,7 +3980,7 @@ void pic16_storeForReturn(iCode *ic, /*operand *op,*/ int offset, pCodeOp *dest)
 {
   unsigned long lit=1;
   operand *op;
-
+  
     op = IC_LEFT(ic);
   
     // this fails for is_LitOp(op) (if op is an AOP_PCODE)
index 7b064565cf4dd6eb2dfa7cd6899ce96c3cc6f844..e67b89c124bd4af241fec0a0924a399e0fe5aff4 100644 (file)
@@ -1127,6 +1127,15 @@ PORT pic16_port =
     4,         /* float */
     4          /* max */
   },
+
+    /* generic pointer tags */
+  {
+    0x00,      /* far */
+    0x80,      /* near */
+    0x00,      /* xstack */
+    0x00       /* code */
+  },
+  
   {
     "XSEG    (XDATA)",         // xstack
     "STACK   (DATA)",          // istack
index 1b7033d2ae6e06c53fa3f4b6569f10c1e7d12b8e..350e9b29894630ffc509aebd121059ed9396a6d3 100644 (file)
@@ -138,6 +138,16 @@ typedef struct
       }
     s;
 
+/** tags for far, near, xstack, code generic pointers */
+    struct
+      {
+        int tag_far;
+        int tag_near;
+        int tag_xstack;
+        int tag_code;
+      }
+    gp_tags;
+      
 /** memory regions related stuff */
     struct
       {
index a9b329cbcab4f3db73732f0b3199852fac466383..fee631866229a848724a3d8864a377f6ab2bf784 100755 (executable)
@@ -269,6 +269,8 @@ PORT xa51_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 2, 2, 3, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
   {
     "XSEG    (XDATA)",
     "STACK   (XDATA)",
index 3de32035b08cdc2eb58c6ed6e628167a7fd347d7..7e589c0790cbd80f7242a478672b2a9a8513684d 100644 (file)
@@ -598,6 +598,8 @@ PORT z80_port =
        /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
   {
     "XSEG",
     "STACK",
@@ -715,6 +717,8 @@ PORT gbz80_port =
     /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */
     1, 2, 2, 4, 2, 2, 2, 1, 4, 4
   },
+  /* tags for generic pointers */
+  { 0x00, 0x40, 0x60, 0x80 },          /* far, near, xstack, code */
   {
     "XSEG",
     "STACK",