* device/lib/Makefile.in: fixed test for pic16 install dir
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 21 Jan 2005 10:45:54 +0000 (10:45 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 21 Jan 2005 10:45:54 +0000 (10:45 +0000)
* device/lib/pic16/*/Makefile*: modified compile flags to enable
  optimizations
* doc/sdccman.lyx: updated banksel optimization, removed --flr-support and
  added --optimize-goto compiler switch and pragma wparam documentation
* src/pic16/pcode.c (pic16_OptimizeBanksel): removed statistics dump
* src/pic16/pcodepeep.c (pic16_pCodeOpCopy): fixed copying of WREG, PRODL
  and PRODH closing bug #1071770 (peephole optimizer)

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

18 files changed:
ChangeLog
device/lib/Makefile.in
device/lib/pic16/Makefile
device/lib/pic16/debug/Makefile.rules
device/lib/pic16/libc/Makefile.rules
device/lib/pic16/libc/ctype/Makefile
device/lib/pic16/libc/stdlib/Makefile
device/lib/pic16/libc/string/Makefile
device/lib/pic16/libc/utils/Makefile
device/lib/pic16/libdev/Makefile
device/lib/pic16/libio/Makefile.rules
device/lib/pic16/libio/adc/Makefile
device/lib/pic16/libsdcc/Makefile.rules
device/lib/pic16/libsdcc/float/Makefile
device/lib/pic16/startup/Makefile
doc/sdccman.lyx
src/pic16/pcode.c
src/pic16/pcodepeep.c

index 72426368c4a4be9c04ff339bd0f4d6f57ae1129a..823e3be04094f691f83ffab1dffdc53842f8ffc9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-01-21 Raphael Neider <rneider AT web.de>
+
+       * device/lib/Makefile.in: fixed test for pic16 install dir
+       * device/lib/pic16/*/Makefile*: modified compile flags to enable
+         optimizations
+       * doc/sdccman.lyx: updated banksel optimization, removed --flr-support and
+         added --optimize-goto compiler switch and pragma wparam documentation
+       * src/pic16/pcode.c (pic16_OptimizeBanksel): removed statistics dump
+       * src/pic16/pcodepeep.c (pic16_pCodeOpCopy): fixed copying of WREG, PRODL
+         and PRODH closing bug #1071770 (peephole optimizer)
+
 2005-01-19 Raphael Neider <rneider AT web.de>
 
        * src/SDCCglobl.h: ensure that PATH_MAX >= 2048 to guarantee
index 9a662a9fa104d29571b51c672279d5e03648ac11..0c89b270d2ec4aa72fb48feffe854786dc66f8bb 100644 (file)
@@ -166,6 +166,7 @@ include incl.mk
 all: checkconf models model-ds390 model-ds400 model-z80 model-gbz80 model-hc08
 
 # model-pic16
+# (needs gputils curently not available of sourceforge's compile farm)
 
 objects: build-dir $(OBJECTS) port-specific-objects lib-files clean_intermediate
 
@@ -297,7 +298,7 @@ installdirs:
        [ -d $(sdcc_libdir)/ds390 ] || mkdir -p $(sdcc_libdir)/ds390
        [ -d $(sdcc_libdir)/ds400 ] || mkdir -p $(sdcc_libdir)/ds400
        [ -d $(sdcc_libdir)/hc08 ] || mkdir -p $(sdcc_libdir)/hc08
-       [ -f $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
+       [ -d $(sdcc_libdir)/pic16 ] || mkdir -p $(sdcc_libdir)/pic16
        mkdir -p $(sdcc_libdir)/src
 
 # Creating dependencies
index 1592f5803c908734acfc148642775b2cd57bab0c..fee486adceab2db2e296eb20d245e94d5dcd8b3c 100644 (file)
@@ -17,6 +17,7 @@ include ./Makefile.common
 
 DIRS   =       libdev  \
                libsdcc \
+               libc    \
                startup \
                debug
 
index 3faf72750afeb0bc2c0fb9136a54d7136473243d..82548825587a612919b19cd30605f3a9c32be73e 100644 (file)
@@ -19,7 +19,7 @@ PRJDIR        = ../../../../..
 
 LIBC_INC_DIR   = $(PRJDIR)/device/include/pic16
 
-COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --no-peep --i-code-in-asm
+COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2 --i-code-in-asm
 CFLAGS = --nostdinc -I$(LIBC_INC_DIR)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 4e11eb3a0e672e10b7fb52bafad9d95ba341d15d..b54bc5798464c8a3e25e84eab1d1c129c53f9506 100644 (file)
@@ -18,7 +18,7 @@ PRJDIR        = ../../../../..
 
 LIBC_INC_DIR   = $(PRJDIR)/device/include/pic16
 
-COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --no-peep --i-code-in-asm
+COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2 --i-code-in-asm
 CFLAGS = -I$(LIBC_INC_DIR)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index e8160f8256f3bed44ab3a18c10a6974d9bf373f0..19a7382d8ac733699c7d84b45aa5e109be546bda 100644 (file)
@@ -29,7 +29,7 @@ OFILES        = $(patsubst %.c,%.o,$(CFILES))
 
 
 DEBUG=
-#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --no-peep
+#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2
 COMPILE_FLAGS  += $(DEBUG)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index e0bc36fd449669f8cf1ed21293f78eec31c1275a..cb2da82d01deeffcf8f970ebfd16a80915846bb4 100644 (file)
@@ -29,7 +29,7 @@ OFILES        = $(patsubst %.c,%.o,$(CFILES))
 
 
 DEBUG=
-#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --no-peep
+#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2
 COMPILE_FLAGS  += $(DEBUG)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 93b5c50469d5b673a8046b4b098a4677b699e07e..4ce5b8a0d29ab14ab784c63d7584ab02092f1deb 100644 (file)
@@ -47,7 +47,7 @@ OFILES        = $(patsubst %.c,%.o,$(CFILES))
 
 
 DEBUG=
-#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --no-peep
+#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2
 COMPILE_FLAGS  += $(DEBUG)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index cd68f02b77395a07dcbd468d31983c9d04d73f06..258f7c92fc245d3038b31f1a8d5ede9a0f6f30ce 100644 (file)
@@ -46,7 +46,7 @@ OFILES        = $(COFILES)
 OFILES += $(SOFILES)
 
 DEBUG=
-#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --no-peep
+#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2
 COMPILE_FLAGS  += $(DEBUG)
 
 %.o: %.c
index f0c2f073089932cc26ed35143325f035a0e3386d..3d504a637b496c0cfd6cb5afdbf5658c4f77836b 100644 (file)
@@ -46,7 +46,7 @@ PIC16_INCDIR  = $(INCDIR)/pic16
 
 CFLAGS = -I$(PIC16_INCDIR)
 
-#COMPILE_FLAGS = --pomit-config-words --pomit-ivt --no-peep
+#COMPILE_FLAGS = --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2
 COMPILE_FLAGS  += $(MODELFLAGS) --nostdinc
 
 
index c571aaf2cbe5c67d4568281821abe4750c647222..4a8e9fbe0c11c5f99c2ea083b04bb7c83d3e8849 100644 (file)
@@ -18,7 +18,7 @@ PRJDIR        = ../../../../..
 
 LIBC_INC_DIR   = $(PRJDIR)/device/include/pic16
 
-COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --no-peep --i-code-in-asm
+COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2 --i-code-in-asm
 CFLAGS = -I$(LIBC_INC_DIR)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 03db167a418c8cf4ec314f0643f2537b9f59eaf5..f83358bf86d1720cb5e7ed9f85e316b800a7daa0 100644 (file)
@@ -26,7 +26,7 @@ OFILES        = $(patsubst %.c,%.o,$(CFILES))
 
 
 DEBUG=
-#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --no-peep
+#COMPILE_FLAGS   += --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2
 COMPILE_FLAGS  += $(DEBUG)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index bf5f42fde2a937a6ea1f43563af571748c2cf36d..eba686d7e367b5b2a8179270721c94baa1adf3ed 100644 (file)
@@ -19,7 +19,7 @@ PRJDIR        = ../../../../..
 
 LIBC_INC_DIR   = $(PRJDIR)/device/include/pic16
 
-COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --no-peep --i-code-in-asm
+COMPILE_FLAGS  += $(MODELFLAGS) --pomit-config-words --pomit-ivt --denable-peeps --optimize-goto --obanksel=2 --i-code-in-asm
 CFLAGS = --nostdinc -I$(LIBC_INC_DIR)
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 58fb3f871b9bc8f87350d93e8887dd989b3639df..917bac8d55d51e89492129762fea91b85016f15c 100644 (file)
@@ -35,7 +35,7 @@ SRCS  =       fs2schar \
                uint2fs \
                ulong2fs
 
-COMPILE_FLAGS  += --obanksel=9
+#COMPILE_FLAGS += --obanksel=9
 
 include ../Makefile.rules
 
index f13ee80de23b810f4199132a2460c62977639ab4..bd266eb52dcad92dbf89a72ea4ac46d04b22f4b6 100644 (file)
@@ -22,7 +22,7 @@ SRCS  =       crt0    \
 
 
 # add nostdinc and nostdlib for this device libraries
-COMPILE_FLAGS  += --no-peep --pomit-config-words --pomit-ivt
+COMPILE_FLAGS  += --denable-peeps --optimize-goto --obanksel=2 --pomit-config-words --pomit-ivt
 COMPILE_FLAGS  += $(MODELFLAGS) --nostdinc --nostdlib
 
 CFILES = $(patsubst %,%.c,$(SRCS))
index 0e5c14bbe5f8d871933e3684f0645b00f19db89f..752113cade8fa3eb42d90812ea2ef3847b4b9b5a 100644 (file)
@@ -15406,8 +15406,15 @@ status Collapsed
 \layout List
 \labelwidthstring 00.00.0000
 
-1 checkes previous used register and if it is the same then doesn't emit
+1 checks previous used register and if it is the same then does not emit
  BANKSEL, accounts only for labels.
+\layout List
+\labelwidthstring 00.00.0000
+
+2 tries to check the location of (even different) symbols and removes BANKSELs
+ if they are in the same bank.
+ Important: This will only work properly if the linker script does not have
+ sections across bank borders!
 \end_deeper 
 \layout List
 \labelwidthstring 00.00.0000
@@ -15627,8 +15634,7 @@ status Collapsed
 /
 \end_inset 
 
--flr-support When entering/leaving a function, call support functions to
- store/restore used registers
+-optimize-goto Try to use (conditional) BRA instead of GOTO
 \layout Subsubsection
 
 Debugging Options
@@ -15961,6 +15967,34 @@ Example:
 \layout List
 \labelwidthstring 00.00.0000
 
+wparam use the WREG to pass one byte of the first function argument.
+ This improves speed but you may not use this for functions with arguments
+ that are called via function pointers, otherwise one byte of the first
+ parameter will get lost.
+ This pragma should be placed in the header file to propagate the calling
+ convention to all callers.
+\layout LyX-Code
+
+#pragma wparam function1[, function2, ...]
+\layout LyX-Code
+
+\layout LyX-Code
+
+Example:
+\layout LyX-Code
+
+\layout LyX-Code
+
+/* pass one byte via stack and one byte via WREG */
+\layout LyX-Code
+
+#pragma wparam foo
+\layout LyX-Code
+
+void foo(int x);
+\layout List
+\labelwidthstring 00.00.0000
+
 code place a function symbol at static FLASH address
 \layout LyX-Code
 
index 7d04d89db199f6267cd9d55ffd2f295da412791b..98854b6b725f2400d1fb6755bb18ef683ef383a0 100644 (file)
@@ -9148,7 +9148,7 @@ void pic16_OptimizeBanksel ()
     } // while
     
     if (maxWeight > 0) {
-#if 1
+#if 0
       fprintf (stderr, "%s:%d: merging (%4u) %d(%s) and %d(%s)\n", __FUNCTION__, __LINE__, maxWeight,
               max->src->hash, getSymFromBank (max->src->hash),
               max->node->hash, getSymFromBank (max->node->hash));
@@ -9188,7 +9188,7 @@ void pic16_OptimizeBanksel ()
 #endif
 
   deleteGraph (adj);
-  fprintf (stderr, "%s:%s:%d: leaving, %u/%u BANKSELs removed...\n", __FILE__, __FUNCTION__, __LINE__, bankselsRemoved, bankselsTotal);
+  //fprintf (stderr, "%s:%s:%d: leaving, %u/%u BANKSELs removed...\n", __FILE__, __FUNCTION__, __LINE__, bankselsRemoved, bankselsTotal);
 }
 
 /*** END of stuff belonging to the BANKSEL optimization ***/
index dbd3558aa5074fc3dcca2631dab81641dee2a186..ecd6e11d8ee8aaef3eb591b8e18b46297e108987 100644 (file)
@@ -2243,6 +2243,9 @@ pCodeOp *pic16_pCodeOpCopy(pCodeOp *pcop)
   case PO_GPR_TEMP:
   case PO_FSR0:
   case PO_INDF0:
+  case PO_WREG: // moved from below
+  case PO_PRODL: // moved from below
+  case PO_PRODH: // moved from below
     //DFPRINTF((stderr,"pCodeOpCopy GPR register\n"));
     pcopnew = Safe_calloc(1,sizeof(pCodeOpReg) );
     PCOR(pcopnew)->r = PCOR(pcop)->r;
@@ -2266,13 +2269,13 @@ pCodeOp *pic16_pCodeOpCopy(pCodeOp *pcop)
   case PO_STR:
   case PO_NONE:
   case PO_W:
-  case PO_WREG:
+  //case PO_WREG: // moved up
   case PO_INTCON:
   case PO_PCL:
   case PO_PCLATH:
   case PO_PCLATU:
-  case PO_PRODL:
-  case PO_PRODH:
+  //case PO_PRODL: // moved up
+  //case PO_PRODH: // moved up
   case PO_REL_ADDR:
     //DFPRINTF((stderr,"pCodeOpCopy register type %d\n", pcop->type));
     pcopnew = Safe_calloc(1,sizeof(pCodeOp) );