From: vrokas Date: Tue, 13 Jun 2006 08:32:55 +0000 (+0000) Subject: * src/port.h (struct PORT): added field gp_tags, to hold the tag X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=d0b75a25e014ff9924b4961e7927de9f591f5d0d;p=fw%2Fsdcc * 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 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4223 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 84f92289..c6a0511b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2006-06-13 Vangelis Rokas + + * 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 * link/z80/lkgb.c, diff --git a/src/SDCCast.c b/src/SDCCast.c index f3ae4175..d607641a 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -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)); } diff --git a/src/SDCCsymt.h b/src/SDCCsymt.h index 8455dbcf..1d54708f 100644 --- a/src/SDCCsymt.h +++ b/src/SDCCsymt.h @@ -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 diff --git a/src/avr/main.c b/src/avr/main.c index 828c3c03..c2ea6a0c 100644 --- a/src/avr/main.c +++ b/src/avr/main.c @@ -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", diff --git a/src/ds390/main.c b/src/ds390/main.c index 7f735daa..f39dbc62 100644 --- a/src/ds390/main.c +++ b/src/ds390/main.c @@ -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)", diff --git a/src/hc08/main.c b/src/hc08/main.c index a86d3a12..be780ab4 100644 --- a/src/hc08/main.c +++ b/src/hc08/main.c @@ -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", diff --git a/src/izt/i186.c b/src/izt/i186.c index 1a3f0fe6..da67d9ef 100644 --- a/src/izt/i186.c +++ b/src/izt/i186.c @@ -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", diff --git a/src/izt/tlcs900h.c b/src/izt/tlcs900h.c index 7810233f..f3b42af6 100644 --- a/src/izt/tlcs900h.c +++ b/src/izt/tlcs900h.c @@ -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)", diff --git a/src/mcs51/main.c b/src/mcs51/main.c index c1b18ea0..40dcc69e 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -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 diff --git a/src/pic/main.c b/src/pic/main.c index efca60ea..760ad9a0 100644 --- a/src/pic/main.c +++ b/src/pic/main.c @@ -540,6 +540,8 @@ PORT pic_port = 16f877) */ }, + /* tags for generic pointers */ + { 0x00, 0x00, 0x00, 0x80 }, /* far, near, xstack, code */ { "XSEG (XDATA)", "STACK (DATA)", diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 1b16d206..2d4bfe00 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -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) diff --git a/src/pic16/main.c b/src/pic16/main.c index 7b064565..e67b89c1 100644 --- a/src/pic16/main.c +++ b/src/pic16/main.c @@ -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 diff --git a/src/port.h b/src/port.h index 1b7033d2..350e9b29 100644 --- a/src/port.h +++ b/src/port.h @@ -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 { diff --git a/src/xa51/main.c b/src/xa51/main.c index a9b329cb..fee63186 100755 --- a/src/xa51/main.c +++ b/src/xa51/main.c @@ -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)", diff --git a/src/z80/main.c b/src/z80/main.c index 3de32035..7e589c07 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -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",