From 41dcb1719a48d2e6b08a12d089391c769fc781f3 Mon Sep 17 00:00:00 2001 From: tecodev Date: Mon, 4 Aug 2008 15:54:43 +0000 Subject: [PATCH 1/1] * doc/sdccman.lyx, * src/pic16/device.h, * src/pic16/glue.c, * src/pic16/main.c: enable --optimize-goto by default * device/lib/pic16/Makefile.common.in: suppress removed option * src/pic16/gen.c, * src/pic16/genutils.c: avoid too long relative branches (#2031890) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5204 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 16 ++++++++++++++-- device/lib/pic16/Makefile.common.in | 2 +- doc/sdccman.lyx | 2 +- src/pic16/device.h | 2 +- src/pic16/gen.c | 12 ++++++------ src/pic16/genutils.c | 2 +- src/pic16/glue.c | 2 +- src/pic16/main.c | 12 ++++++------ 8 files changed, 31 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index a260ce27..069ab8ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,18 @@ +2008-08-04 Raphael Neider + + * doc/sdccman.lyx, + * src/pic16/device.h, + * src/pic16/glue.c, + * src/pic16/main.c: enable --optimize-goto by default + + * device/lib/pic16/Makefile.common.in: suppress removed option + + * src/pic16/gen.c, + * src/pic16/genutils.c: avoid too long relative branches (#2031890) + 2008-07-30 Borut Razem - * src\pic16\device.c, src\pic16\glue.c, src\pic16\pcode.c: + * src/pic16/device.c, src/pic16/glue.c, src/pic16/pcode.c: applied patch 22032433: PIC16: fix constant strings, thanks Mauro Giachero @@ -18,7 +30,7 @@ 2008-07-12 Philipp Klaus Krause * src/z80/mappings.i: Implemented RFE #1919415 * src/z80/peeph-z80.def: Implemented RFE #1919415, #1861376, - #1880202, #1914434, prepared for RFE #1703943 + #1880202, #1914434, prepared for RFE #1703943 2008-07-12 Philipp Klaus Krause diff --git a/device/lib/pic16/Makefile.common.in b/device/lib/pic16/Makefile.common.in index a5ac1c1a..27a29a16 100644 --- a/device/lib/pic16/Makefile.common.in +++ b/device/lib/pic16/Makefile.common.in @@ -38,7 +38,7 @@ CFLAGS += -Wa,-q CFLAGS += --fommit-frame-pointer CFLAGS += --obanksel=9 CFLAGS += --denable-peeps -CFLAGS += --optimize-goto +#CFLAGS += --no-optimize-goto CFLAGS += --optimize-cmp CFLAGS += --optimize-df diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index 0abeacc6..746bb8be 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -24787,7 +24787,7 @@ status collapsed \end_inset --optimize-goto Try to use (conditional) BRA instead of GOTO. +-no-optimize-goto Do not use (conditional) BRA instead of GOTO. \end_layout \begin_layout Description diff --git a/src/pic16/device.h b/src/pic16/device.h index 0bda0f11..c3dbd623 100644 --- a/src/pic16/device.h +++ b/src/pic16/device.h @@ -76,7 +76,7 @@ extern PIC16_device *pic16; #define REG_ADDR(r) ((r)->isBitField ? (((r)->address)>>3) : (r)->address) #define OF_LR_SUPPORT 0x00000001 -#define OF_OPTIMIZE_GOTO 0x00000002 +#define OF_NO_OPTIMIZE_GOTO 0x00000002 #define OF_OPTIMIZE_CMP 0x00000004 #define OF_OPTIMIZE_DF 0x00000008 diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 062810bc..46f7b482 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -5471,7 +5471,7 @@ static void genAnd (iCode *ic, iCode *ifx) if (nonnull) { pic16_emitpcode (POC_BTFSC, pic16_newpCodeOpBit(pic16_aopGet (AOP (left), offset, FALSE, FALSE), posbit - 1, 0, PO_GPR_REGISTER)); - pic16_emitpcode (POC_BRA, pic16_popGetLabel (rIfx.condition ? rIfx.lbl->key : tlbl->key)); + pic16_emitpcode (POC_GOTO, pic16_popGetLabel (rIfx.condition ? rIfx.lbl->key : tlbl->key)); } else { @@ -5496,7 +5496,7 @@ static void genAnd (iCode *ic, iCode *ifx) if (rIfx.condition) { emitSKPZ; - pic16_emitpcode (POC_BRA, pic16_popGetLabel (rIfx.lbl->key)); /* to false */ + pic16_emitpcode (POC_GOTO, pic16_popGetLabel (rIfx.lbl->key)); /* to false */ } else { @@ -5528,7 +5528,7 @@ static void genAnd (iCode *ic, iCode *ifx) if (ifx) { if (emitBra) - pic16_emitpcode (POC_BRA, pic16_popGetLabel (rIfx.lbl->key)); + pic16_emitpcode (POC_GOTO, pic16_popGetLabel (rIfx.lbl->key)); ifx->generated = 1; } pic16_emitpLabel (tlbl->key); @@ -5812,7 +5812,7 @@ static void genOr (iCode *ic, iCode *ifx) if (lit) { if (rIfx.condition) - pic16_emitpcode (POC_BRA, pic16_popGetLabel (rIfx.lbl->key)); /* to false */ + pic16_emitpcode (POC_GOTO, pic16_popGetLabel (rIfx.lbl->key)); /* to false */ ifx->generated = 1; } else @@ -6092,7 +6092,7 @@ static void genXor (iCode *ic, iCode *ifx) { /* rIfx.lbl might be far away... */ emitSKPZ; - pic16_emitpcode (POC_BRA, pic16_popGetLabel (rIfx.lbl->key)); /* to false */ + pic16_emitpcode (POC_GOTO, pic16_popGetLabel (rIfx.lbl->key)); /* to false */ } else { @@ -6120,7 +6120,7 @@ static void genXor (iCode *ic, iCode *ifx) { if (ifx) { - pic16_emitpcode (POC_BRA, pic16_popGetLabel (rIfx.lbl->key)); + pic16_emitpcode (POC_GOTO, pic16_popGetLabel (rIfx.lbl->key)); ifx->generated = 1; } pic16_emitpLabel (tlbl->key); diff --git a/src/pic16/genutils.c b/src/pic16/genutils.c index f36b7ab4..c4743a58 100644 --- a/src/pic16/genutils.c +++ b/src/pic16/genutils.c @@ -607,7 +607,7 @@ int pic16_genCmp_special(operand *left, operand *right, operand *result, tmplbl = newiTempLabel( NULL ); pic16_emitpcode(POC_TSTFSZ, pic16_popGet(AOP(left), 0)); pic16_emitpcode(POC_BRA, pic16_popGetLabel(tmplbl->key)); - pic16_emitpcode(POC_BRA, pic16_popGetLabel(rIfx->lbl->key)); + pic16_emitpcode(POC_GOTO, pic16_popGetLabel(rIfx->lbl->key)); pic16_emitpLabel(tmplbl->key); ifx->generated = 1; diff --git a/src/pic16/glue.c b/src/pic16/glue.c index 0b1096b9..da95d2e0 100644 --- a/src/pic16/glue.c +++ b/src/pic16/glue.c @@ -1850,7 +1850,7 @@ pic16glue () } /* turn GOTOs into BRAs -- added by RN 2004-11-16 */ - if(pic16_options.opt_flags & OF_OPTIMIZE_GOTO) { + if(!(pic16_options.opt_flags & OF_NO_OPTIMIZE_GOTO)) { pic16_OptimizeJumps(); } diff --git a/src/pic16/main.c b/src/pic16/main.c index 648f64e4..3ca6844e 100644 --- a/src/pic16/main.c +++ b/src/pic16/main.c @@ -503,9 +503,9 @@ _process_pragma(const char *s) #define OFMSG_LRSUPPORT "--flr-support" -#define OPTIMIZE_GOTO "--optimize-goto" -#define OPTIMIZE_CMP "--optimize-cmp" -#define OPTIMIZE_DF "--optimize-df" +#define NO_OPTIMIZE_GOTO "--no-optimize-goto" +#define OPTIMIZE_CMP "--optimize-cmp" +#define OPTIMIZE_DF "--optimize-df" char *alt_asm=NULL; char *alt_link=NULL; @@ -528,7 +528,7 @@ OPTION pic16_optionsTable[]= { /* optimization options */ { 0, OPT_BANKSEL, &pic16_options.opt_banksel, "set banksel optimization level (default=0 no)", CLAT_INTEGER }, { 0, "--denable-peeps", &pic16_enable_peeps, "explicit enable of peepholes"}, - { 0, OPTIMIZE_GOTO, NULL, "try to use (conditional) BRA instead of GOTO"}, + { 0, NO_OPTIMIZE_GOTO, NULL, "do NOT use (conditional) BRA instead of GOTO"}, { 0, OPTIMIZE_CMP, NULL, "try to optimize some compares"}, { 0, OPTIMIZE_DF, NULL, "thoroughly analyze data flow (memory and time intensive!)"}, @@ -606,8 +606,8 @@ _pic16_parseOptions (int *pargc, char **argv, int *i) } #endif - if (ISOPT(OPTIMIZE_GOTO)) { - pic16_options.opt_flags |= OF_OPTIMIZE_GOTO; + if (ISOPT(NO_OPTIMIZE_GOTO)) { + pic16_options.opt_flags |= OF_NO_OPTIMIZE_GOTO; return TRUE; } -- 2.30.2