From ea36ef2b25c81c605f06f882cfb82698121cf315 Mon Sep 17 00:00:00 2001 From: vrokas Date: Thu, 27 May 2004 22:19:52 +0000 Subject: [PATCH] * src/pic16/glue.c (pic16emitStaticSeg): do not print as publics or externs configuration variables, * src/pic16/ralloc.h, * src/pic16/ralloc.cc: IS_CONFIG_ADDRESS is made public and added prototype in header, commented out some debug messages git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3330 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 ++++++++ src/pic16/device.c | 2 +- src/pic16/glue.c | 38 +++++++++++++++++++++++++------------- src/pic16/ralloc.c | 16 +++++++++------- src/pic16/ralloc.h | 2 ++ 5 files changed, 45 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce68e5c8..60bb9d11 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-05-28 Vangelis Rokas + + * src/pic16/glue.c (pic16emitStaticSeg): do not print as publics or + externs configuration variables, + * src/pic16/ralloc.h, + * src/pic16/ralloc.cc: IS_CONFIG_ADDRESS is made public and added + prototype in header, commented out some debug messages + 2004-05-26 Vangelis Rokas * src/pic16/glue.c, diff --git a/src/pic16/device.c b/src/pic16/device.c index 294fc187..97017bfe 100644 --- a/src/pic16/device.c +++ b/src/pic16/device.c @@ -763,7 +763,7 @@ void pic16_assignConfigWordValue(int address, int value) break; } - fprintf(stderr,"setting config word to 0x%x\n",value); +// fprintf(stderr,"setting config word to 0x%x\n",value); } /*-----------------------------------------------------------------* diff --git a/src/pic16/glue.c b/src/pic16/glue.c index afb296d0..c797808f 100644 --- a/src/pic16/glue.c +++ b/src/pic16/glue.c @@ -614,23 +614,29 @@ pic16emitStaticSeg (memmap * map) #if 0 fprintf(stderr, "\t%s: sym: %s\tused: %d\n", map->sname, sym->name, sym->used); printTypeChain( sym->type, stderr ); - printf("\n"); + fprintf(stderr, "\n"); #endif - /* if it is "extern" then do nothing */ - if (IS_EXTERN (sym->etype)) { - checkAddSym(&externs, sym); -// addSetHead(&externs, sym); - continue; - } + /* if it is "extern" then do nothing */ + if (IS_EXTERN (sym->etype)) { - /* if it is not static add it to the public - table */ - if (!IS_STATIC (sym->etype)) { - checkAddSym(&publics, sym); -// addSetHead (&publics, sym); - } + /* do not emit if it is a config word declaration */ + if(!SPEC_ABSA(sym->etype) + || (SPEC_ABSA(sym->etype) && !IS_CONFIG_ADDRESS(SPEC_ADDR(sym->etype)))) + checkAddSym(&externs, sym); + continue; + } + + /* if it is not static add it to the public + table */ + if (!IS_STATIC (sym->etype)) { + + /* do not emit if it is a config word declaration */ + if(!SPEC_ABSA(sym->etype) + || (SPEC_ABSA(sym->etype) && !IS_CONFIG_ADDRESS(SPEC_ADDR(sym->etype)))) + checkAddSym(&publics, sym); + } #if 0 /* print extra debug info if required */ @@ -660,6 +666,9 @@ pic16emitStaticSeg (memmap * map) /* if it has an absolute address */ if (SPEC_ABSA (sym->etype)) { + fprintf(stderr, "%s:%d spec_absa is true for symbol: %s\n", + __FILE__, __LINE__, sym->name); + if (options.debug || sym->level == 0) fprintf (code->oFile, " == 0x%04x\n", SPEC_ADDR (sym->etype)); @@ -669,6 +678,9 @@ pic16emitStaticSeg (memmap * map) } else { + fprintf(stderr, "%s:%d spec_absa is false for symbol: %s\n", + __FILE__, __LINE__, sym->name); + if (options.debug || sym->level == 0) fprintf (code->oFile, " == .\n"); diff --git a/src/pic16/ralloc.c b/src/pic16/ralloc.c index 655a3d58..dca8addf 100644 --- a/src/pic16/ralloc.c +++ b/src/pic16/ralloc.c @@ -557,7 +557,7 @@ pic16_dirregWithName (char *name) return NULL; // name wasn't found in the hash table } -static int IS_CONFIG_ADDRESS(int address) +int IS_CONFIG_ADDRESS(int address) { return address >= 0x300000 && address <= 0x300000d; @@ -589,7 +589,7 @@ pic16_allocDirReg (operand *op ) return NULL; // } // patch 13 - debugLog ("%s symbol name %s\n", __FUNCTION__,name); + debugLog ("%s:%d symbol name %s\n", __FUNCTION__, __LINE__, name); // fprintf(stderr, "%s symbol name %s\n", __FUNCTION__,name); { @@ -654,8 +654,8 @@ pic16_allocDirReg (operand *op ) * dynDirectRegNames set */ if(IN_CODESPACE( SPEC_OCLS( OP_SYM_ETYPE(op)))) { if(pic16_debug_verbose) -// fprintf(stderr, "%s:%d symbol %s in codespace\n", __FILE__, __LINE__, -// OP_SYMBOL(op)->name); + fprintf(stderr, "%s:%d symbol %s in codespace\n", __FILE__, __LINE__, + OP_SYMBOL(op)->name); debugLog("%s:%d sym: %s in codespace\n", __FUNCTION__, __LINE__, OP_SYMBOL(op)->name); return NULL; } @@ -711,7 +711,7 @@ pic16_allocDirReg (operand *op ) } else { debugLog (" -- %s is declared at address 0x30000x\n",name); - fprintf(stderr, " -- %s is declared at address 0x30000x\n",name); +// fprintf(stderr, " -- %s is declared at address 0x30000x\n",name); return NULL; } @@ -2784,6 +2784,8 @@ packRegsForAssign (iCode * ic, eBBlock * ebp) debugAopGet (" left:", IC_LEFT (ic)); debugAopGet (" right:", IC_RIGHT (ic)); +// fprintf(stderr, "%s:%d symbol = %s\n", __FILE__, __LINE__, OP_SYMBOL( IC_RESULT(ic))->name); + /* if this is at an absolute address, then get the address. */ if (SPEC_ABSA ( OP_SYM_ETYPE(IC_RESULT(ic))) ) { if(IS_CONFIG_ADDRESS( SPEC_ADDR ( OP_SYM_ETYPE(IC_RESULT(ic))))) { @@ -2791,8 +2793,8 @@ packRegsForAssign (iCode * ic, eBBlock * ebp) if(IS_VALOP(IC_RIGHT(ic))) { debugLog (" setting config word to %x\n", (int) floatFromVal (IC_RIGHT(ic)->operand.valOperand)); - fprintf(stderr, " setting config word to %x\n", - (int) floatFromVal (IC_RIGHT(ic)->operand.valOperand)); +// fprintf(stderr, " setting config word to %x\n", +// (int) floatFromVal (IC_RIGHT(ic)->operand.valOperand)); pic16_assignConfigWordValue( SPEC_ADDR ( OP_SYM_ETYPE(IC_RESULT(ic))), (int) floatFromVal (IC_RIGHT(ic)->operand.valOperand)); } diff --git a/src/pic16/ralloc.h b/src/pic16/ralloc.h index 3d7bc269..989347bd 100644 --- a/src/pic16/ralloc.h +++ b/src/pic16/ralloc.h @@ -121,6 +121,8 @@ regs *pic16_allocRegByName (char *name, int size ); regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alias, operand *refop); +int IS_CONFIG_ADDRESS(int address); + /* Define register address that are constant across PIC16 family */ #define IDX_TMR0 0xfd6 #define IDX_PCL 0xff9 -- 2.47.2