+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
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
[ -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
DIRS = libdev \
libsdcc \
+ libc \
startup \
debug
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))
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))
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))
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))
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))
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
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
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))
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))
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))
uint2fs \
ulong2fs
-COMPILE_FLAGS += --obanksel=9
+#COMPILE_FLAGS += --obanksel=9
include ../Makefile.rules
# 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))
\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
/
\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
\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
} // 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));
#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 ***/
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;
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) );