From 9c6c1babff326d85dc75373ef4b1fa336ffcee41 Mon Sep 17 00:00:00 2001 From: vrokas Date: Sun, 10 Oct 2004 20:45:19 +0000 Subject: [PATCH] * src/pic16/device.c (pic16_dump_gsection, * pic16_groupRegistersInSection): handle symbols declared to be in access bank differently, * src/pic16/gen.c (struct _G): added field resDirect, * (aopForSym): if symbol on stack and iCode is '=' and result exists, send values read from stack directly to result and don't allocate temporary values, * (pic16_sameRegs): fixed bug that allowed MOVFF to move between same registers, * (pic16_sameRegsOfs): NEW, * (freeAsmop): if _G.resDirect is set then do not mark registers as free because they were not allocated from temporary pool, * pic16_popRegFromString): workaround to fix a problem with allocating variables twice or never, * (genGenPointerGet): using PRODL instead of FSR0H, * (genGenPointerSet): using POSTDEC1 (that is a stack location) instead of FSR0H, * (genAssign): take advantage of the _G.resDirect flag, * (genCast): around line 11844, use mov2f instead of directly MOVFF'ing between operands to account for literal values, * src/pic16/genutils.c: some new debug functions for gpsim have been added, * src/pic16/glue.c (pic16_printIvalType): fixed bug that initialized float with integer part only, * src/pic16/main.c (_process_pragma): handle pragma udata access to place variables in access bank * device/lib/pic16/libsdcc/gptr/gptr*.c: using BRA instead of GOTO, updated sources to reflect recent changes in gen.c git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3527 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- device/lib/pic16/libsdcc/gptr/Makefile | 8 ++++++- device/lib/pic16/libsdcc/gptr/gptrget1.c | 29 +++++++++++++----------- device/lib/pic16/libsdcc/gptr/gptrget2.c | 12 ++++++---- device/lib/pic16/libsdcc/gptr/gptrget3.c | 12 ++++++---- device/lib/pic16/libsdcc/gptr/gptrget4.c | 12 ++++++---- device/lib/pic16/libsdcc/gptr/gptrput1.c | 11 +++++---- device/lib/pic16/libsdcc/gptr/gptrput2.c | 12 ++++++---- device/lib/pic16/libsdcc/gptr/gptrput3.c | 10 +++++--- device/lib/pic16/libsdcc/gptr/gptrput4.c | 10 +++++--- 9 files changed, 73 insertions(+), 43 deletions(-) diff --git a/device/lib/pic16/libsdcc/gptr/Makefile b/device/lib/pic16/libsdcc/gptr/Makefile index 9e36970e..1659055d 100644 --- a/device/lib/pic16/libsdcc/gptr/Makefile +++ b/device/lib/pic16/libsdcc/gptr/Makefile @@ -20,11 +20,17 @@ SRCS = gptrget1 \ gptrput2 \ gptrput3 \ gptrput4 - + include ../Makefile.rules +#OFILES += gptrcommon.o + + all: build-library +#gptrcommon.o: gptrcommon.S +# $(AS) -c $< -o $@ + build-library: $(OFILES) # @$(CP) -v $(OFILES) ../../bin diff --git a/device/lib/pic16/libsdcc/gptr/gptrget1.c b/device/lib/pic16/libsdcc/gptr/gptrget1.c index cbf36b22..4b208b1e 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrget1.c +++ b/device/lib/pic16/libsdcc/gptr/gptrget1.c @@ -29,10 +29,12 @@ */ /* the return value is expected to be in WREG, therefore we choose return - * type void here. Generic pointer is expected to be in WREG:FSR0H:FSR0L, + * type void here. Generic pointer is expected to be in WREG:PRODL:FSR0L, * so function arguments are void, too */ extern POSTINC0; +extern POSTINC1; +extern PREINC1; extern INDF0; extern FSR0L; extern FSR0H; @@ -43,6 +45,7 @@ extern TBLPTRU; extern TABLAT; extern PRODL; + void _gptrget1(void) _naked { _asm @@ -53,38 +56,38 @@ void _gptrget1(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ - /* data pointer */ - /* data are already in FSR0 */ + ; data pointer + ; data are already in FSR0 + movff _PRODL, _FSR0H - /* debug info */ movf _POSTINC0, w return _lab_01_: - /* code or eeprom */ + ; code or eeprom btfsc _WREG, 6 - goto _lab_02_ + bra _lab_02_ ; code pointer + movff _FSR0L, _TBLPTRL + movff _PRODL, _TBLPTRH movwf _TBLPTRU - movff _FSR0L, _TBLPTRL - movff _FSR0H, _TBLPTRH - TBLRD* + tblrd*+ - /* result in TBLAT */ + ; result in WREG movf _TABLAT, w return _lab_02_: - /* EEPROM pointer */ + ; EEPROM pointer - /* unimplemented yet */ + ; unimplemented yet _end_: diff --git a/device/lib/pic16/libsdcc/gptr/gptrget2.c b/device/lib/pic16/libsdcc/gptr/gptrget2.c index 485fa4f3..c6b2eb36 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrget2.c +++ b/device/lib/pic16/libsdcc/gptr/gptrget2.c @@ -30,7 +30,7 @@ */ /* the return value is expected to be in WREG:PRODL, therefore we choose return - * type void here. Generic pointer is expected to be in WREG:FSR0H:FSR0L, + * type void here. Generic pointer is expected to be in WREG:PRODL:FSR0L, * so function arguments are void, too */ extern POSTINC0; @@ -54,10 +54,12 @@ void _gptrget2(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ + movff _PRODL, _FSR0H + movf _POSTINC0, w movff _POSTINC0, _PRODL @@ -67,12 +69,12 @@ void _gptrget2(void) _naked _lab_01_: /* code or eeprom */ btfsc _WREG, 6 - goto _lab_02_ + bra _lab_02_ ; code pointer - movwf _TBLPTRU movff _FSR0L, _TBLPTRL - movff _FSR0H, _TBLPTRH + movff _PRODL, _TBLPTRH + movwf _TBLPTRU /* fetch first byte */ TBLRD*+ diff --git a/device/lib/pic16/libsdcc/gptr/gptrget3.c b/device/lib/pic16/libsdcc/gptr/gptrget3.c index 3b4eb25a..932b96f3 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrget3.c +++ b/device/lib/pic16/libsdcc/gptr/gptrget3.c @@ -30,7 +30,7 @@ */ /* the return value is expected to be in WREG:PRODL:PRODH, therefore we choose return - * type void here. Generic pointer is expected to be in WREG:FSR0H:FSR0L, + * type void here. Generic pointer is expected to be in WREG:PRODL:FSR0L, * so function arguments are void, too */ extern POSTINC0; @@ -55,10 +55,12 @@ void _gptrget3(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ + movff _PRODL, _FSR0H + movf _POSTINC0, w movff _POSTINC0, _PRODL movff _POSTINC0, _PRODH @@ -69,12 +71,12 @@ void _gptrget3(void) _naked _lab_01_: /* code or eeprom */ btfsc _WREG, 6 - goto _lab_02_ + bra _lab_02_ ; code pointer - movwf _TBLPTRU movff _FSR0L, _TBLPTRL - movff _FSR0H, _TBLPTRH + movff _PRODL, _TBLPTRH + movwf _TBLPTRU /* fetch first byte */ TBLRD*+ diff --git a/device/lib/pic16/libsdcc/gptr/gptrget4.c b/device/lib/pic16/libsdcc/gptr/gptrget4.c index c57b9e54..821261a9 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrget4.c +++ b/device/lib/pic16/libsdcc/gptr/gptrget4.c @@ -30,7 +30,7 @@ */ /* the return value is expected to be in WREG:PRODL, therefore we choose return - * type void here. Generic pointer is expected to be in WREG:FSR0H:FSR0L, + * type void here. Generic pointer is expected to be in WREG:PRODL:FSR0L, * so function arguments are void, too */ extern POSTINC0; @@ -55,10 +55,12 @@ void _gptrget4(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ + movff _PRODL, _FSR0H + movf _POSTINC0, w movff _POSTINC0, _PRODL movff _POSTINC0, _PRODH @@ -70,12 +72,12 @@ void _gptrget4(void) _naked _lab_01_: /* code or eeprom */ btfsc _WREG, 6 - goto _lab_02_ + bra _lab_02_ ; code pointer - movwf _TBLPTRU movff _FSR0L, _TBLPTRL - movff _FSR0H, _TBLPTRH + movff _PRODL, _TBLPTRH + movwf _TBLPTRU /* fetch first byte */ TBLRD*+ diff --git a/device/lib/pic16/libsdcc/gptr/gptrput1.c b/device/lib/pic16/libsdcc/gptr/gptrput1.c index decbadf6..1d57533a 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrput1.c +++ b/device/lib/pic16/libsdcc/gptr/gptrput1.c @@ -29,10 +29,11 @@ ** $Id$ */ -/* write address is expected to be in WREG:FSR0H:FSR0L while - * write value is in TBLPTRL:TBLPTRH:PRODH:PRODL */ +/* write address is expected to be in WREG:PRODL:FSR0L while + * write value is in TBLPTRL:TBLPTRH:PRODH:[stack] */ extern POSTINC0; +extern PREINC1; extern INDF0; extern FSR0L; extern FSR0H; @@ -54,11 +55,13 @@ void _gptrput1(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ - movff _PRODL, _POSTINC0 + movff _PRODL, _FSR0H + + movff _PREINC1, _POSTINC0 return diff --git a/device/lib/pic16/libsdcc/gptr/gptrput2.c b/device/lib/pic16/libsdcc/gptr/gptrput2.c index 514a7914..3bef2928 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrput2.c +++ b/device/lib/pic16/libsdcc/gptr/gptrput2.c @@ -29,10 +29,11 @@ ** $Id$ */ -/* write address is expected to be in WREG:FSR0H:FSR0L while - * write value is in TBLPTRL:TBLPTRH:PRODH:PRODL */ +/* write address is expected to be in WREG:PRODL:FSR0L while + * write value is in TBLPTRL:TBLPTRH:PRODH:[stack] */ extern POSTINC0; +extern PREINC1; extern INDF0; extern FSR0L; extern FSR0H; @@ -43,6 +44,7 @@ extern TBLPTRU; extern TABLAT; extern PRODL; extern PRODH; +extern _GPTRREG; void _gptrput2(void) _naked { @@ -54,11 +56,13 @@ void _gptrput2(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ - movff _PRODL, _POSTINC0 + movff _PRODL, _FSR0H + + movff _PREINC1, _POSTINC0 movff _PRODH, _POSTINC0 return diff --git a/device/lib/pic16/libsdcc/gptr/gptrput3.c b/device/lib/pic16/libsdcc/gptr/gptrput3.c index d5eea4e6..80e562e5 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrput3.c +++ b/device/lib/pic16/libsdcc/gptr/gptrput3.c @@ -30,9 +30,10 @@ */ /* write address is expected to be in WREG:FSR0H:FSR0L while - * write value is in TBLPTRH:TBLPTRL:PRODH:PRODL */ + * write value is in TBLPTRH:TBLPTRL:PRODH:[stack] */ extern POSTINC0; +extern PREINC1; extern INDF0; extern FSR0L; extern FSR0H; @@ -43,6 +44,7 @@ extern TBLPTRU; extern TABLAT; extern PRODL; extern PRODH; +extern _GPTRREG; void _gptrput3(void) _naked { @@ -54,11 +56,13 @@ void _gptrput3(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ - movff _PRODL, _POSTINC0 + movff _PRODL, _FSR0H + + movff _PREINC1, _POSTINC0 movff _PRODH, _POSTINC0 movff _TBLPTRL, _POSTINC0 diff --git a/device/lib/pic16/libsdcc/gptr/gptrput4.c b/device/lib/pic16/libsdcc/gptr/gptrput4.c index 01b7db2b..d8358e5e 100644 --- a/device/lib/pic16/libsdcc/gptr/gptrput4.c +++ b/device/lib/pic16/libsdcc/gptr/gptrput4.c @@ -30,9 +30,10 @@ */ /* write address is expected to be in WREG:FSR0H:FSR0L while - * write value is in TBLPTRH:TBLPTRL:PRODH:PRODL */ + * write value is in TBLPTRH:TBLPTRL:PRODH:[stack] */ extern POSTINC0; +extern PREINC1; extern INDF0; extern FSR0L; extern FSR0H; @@ -43,6 +44,7 @@ extern TBLPTRU; extern TABLAT; extern PRODL; extern PRODH; +extern _GPTRREG; void _gptrput4(void) _naked { @@ -54,11 +56,13 @@ void _gptrput4(void) _naked * 11 -> unimplemented */ btfss _WREG, 7 - goto _lab_01_ + bra _lab_01_ /* data pointer */ /* data are already in FSR0 */ - movff _PRODL, _POSTINC0 + movff _PRODL, _FSR0H + + movff _PREINC1, _POSTINC0 movff _PRODH, _POSTINC0 movff _TBLPTRL, _POSTINC0 movff _TBLPTRH, _POSTINC0 -- 2.30.2