From ebafd5b16dab393ffce489e5ea7aabcca02b652c Mon Sep 17 00:00:00 2001 From: vrokas Date: Mon, 13 Sep 2004 21:48:14 +0000 Subject: [PATCH] * src/pic16/device.h (pic16_options): removed field use_crt, * src/pic16/gen.c (genUnpackBits): added call to pic16_loadFSR0 until an optimization to handle single bits is added, * (pic16_loadFSR0): moved before genUnpackBits, * (genAnd): some white lines removed, * src/pic16/main.c (_pic16_finaliseOptions): set omit_ivt and clear leave_reset flags in pic16_options when using crt modules, git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3494 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 13 ++++++-- src/pic16/device.h | 1 - src/pic16/gen.c | 26 ++++++++-------- src/pic16/main.c | 76 ++++++++++++++++------------------------------ 4 files changed, 52 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73ebdecd..d2a1ebd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-09-14 Vangelis Rokas + + * src/pic16/device.h (pic16_options): removed field use_crt, + * src/pic16/gen.c (genUnpackBits): added call to pic16_loadFSR0 + until an optimization to handle single bits is added, + * (pic16_loadFSR0): moved before genUnpackBits, + * (genAnd): some white lines removed, + * src/pic16/main.c (_pic16_finaliseOptions): set omit_ivt and clear + leave_reset flags in pic16_options when using crt modules, + 2004-09-12 Maarten Brock * src/mcs51/ralloc.c (packRegisters): applied fix by Bernhard Held @@ -20,7 +30,7 @@ linker command line except than when --no-crt is specified, * src/pic16/pcode.c, * src/pic16/pcode.h: added some structures and functions for a new - optimization scheme to compansete for instruction overhead between + optimization scheme to compansate for instruction overhead between same iCodes, this scheme is currently under development and is not working in any way, * src/pic16/gen.c (genAnd): added patch provided by Aaron Collwell @@ -29,7 +39,6 @@ * device/lib/pic16/startup/crt0iz.c: added global char variable __uflags to force the generation of an idata section - 2004-09-12 Bernhard Held * doc/Makefile, diff --git a/src/pic16/device.h b/src/pic16/device.h index 468e1823..0b378b99 100644 --- a/src/pic16/device.h +++ b/src/pic16/device.h @@ -100,7 +100,6 @@ typedef struct { int ivt_loc; int nodefaultlibs; int dumpcalltree; - int use_crt; char *crt_name; int no_crt; } pic16_options_t; diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 2a1b26c8..1d4021ff 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -6605,21 +6605,16 @@ static void genAnd (iCode *ic, iCode *ifx) symbol *tlbl = newiTempLabel(NULL); int sizel = AOP_SIZE(left); - /* here to add patch from Aaron */ if(size) - emitSETC; //pic16_emitcode("setb","c"); - + emitSETC; while(sizel--) { - if((bytelit = ((lit >> (offset*8)) & 0x0FFL)) != 0x0L){ - + if((bytelit = ((lit >> (offset*8)) & 0x0FFL)) != 0x0L) { /* patch provided by Aaron Colwell */ if((posbit = isLiteralBit(bytelit)) != 0) { pic16_emitpcode(((rIfx.condition) ? POC_BTFSS : POC_BTFSC ), - pic16_newpCodeOpBit(pic16_aopGet(AOP(left), - offset,FALSE, - FALSE), + pic16_newpCodeOpBit(pic16_aopGet(AOP(left), offset,FALSE,FALSE), (posbit-1),0, PO_GPR_REGISTER)); pic16_emitpcode(POC_BRA, pic16_popGetLabel(tlbl->key)); @@ -9219,6 +9214,12 @@ release: pic16_freeAsmop(result,NULL,ic,TRUE); } + +void pic16_loadFSR0(operand *op) +{ + pic16_emitpcode(POC_LFSR, pic16_popGetLit2(0, pic16_popGet(AOP(op), 0))); +} + /*-----------------------------------------------------------------*/ /* genUnpackBits - generates code for unpacking bits */ /*-----------------------------------------------------------------*/ @@ -9232,6 +9233,11 @@ static void genUnpackBits (operand *result, operand *left, char *rname, int ptyp DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); etype = getSpec(operandType(result)); + /* the following call to pic16_loadFSR0 is temporary until + * optimization to handle single bit assignments is added + * to the function. Until then use the old safe way! -- VR */ + pic16_loadFSR0( left ); + /* read the first byte */ switch (ptype) { case POINTER: @@ -9407,10 +9413,6 @@ release: pic16_freeAsmop(result,NULL,ic,TRUE); } -void pic16_loadFSR0(operand *op) -{ - pic16_emitpcode(POC_LFSR, pic16_popGetLit2(0, pic16_popGet(AOP(op), 0))); -} /*-----------------------------------------------------------------*/ diff --git a/src/pic16/main.c b/src/pic16/main.c index 413a5f43..8f667fb5 100644 --- a/src/pic16/main.c +++ b/src/pic16/main.c @@ -407,9 +407,8 @@ _pic16_parseOptions (int *pargc, char **argv, int *i) if(ISOPT(USE_CRT)) { char *tmp; - tmp = Safe_strdup( getStringArg(USE_CRT, argv, i, *pargc) ); - pic16_options.use_crt = 1; pic16_options.no_crt = 0; - pic16_options.crt_name = tmp; + pic16_options.no_crt = 0; + pic16_options.crt_name = Safe_strdup( getStringArg(USE_CRT, argv, i, *pargc) ); } return FALSE; @@ -482,12 +481,12 @@ static void _pic16_linkEdit(void) if(fullSrcFileName) { sprintf(temp, "%s.o", dstFileName); -// shash_add(&linkValues, "srcofile", temp); - addSetHead(&relFilesSet, temp); + addSetHead(&relFilesSet, Safe_strdup(temp)); } - if(pic16_options.use_crt && !pic16_options.no_crt) - shash_add(&linkValues, "spec_ofiles", pic16_options.crt_name); //"crt0i.o"); + if(!pic16_options.no_crt) + shash_add(&linkValues, "spec_ofiles", pic16_options.crt_name); + shash_add(&linkValues, "ofiles", joinStrSet(relFilesSet)); shash_add(&linkValues, "libs", joinStrSet(libFilesSet)); @@ -509,55 +508,35 @@ extern const char *pic16_asmCmd[]; static void _pic16_finaliseOptions (void) { - port->mem.default_local_map = data; - port->mem.default_globl_map = data; + port->mem.default_local_map = data; + port->mem.default_globl_map = data; - /* peepholes are disabled for the time being */ - options.nopeep = 1; + /* peepholes are disabled for the time being */ + options.nopeep = 1; - /* explicit enable peepholes for testing */ - if(pic16_enable_peeps) - options.nopeep = 0; + /* explicit enable peepholes for testing */ + if(pic16_enable_peeps) + options.nopeep = 0; - options.all_callee_saves = 1; // always callee saves -// options.float_rent = 1; -// options.intlong_rent = 1; + options.all_callee_saves = 1; // always callee saves +// options.float_rent = 1; +// options.intlong_rent = 1; - if(alt_asm && strlen(alt_asm)) - pic16_asmCmd[0] = alt_asm; + if(alt_asm && strlen(alt_asm)) + pic16_asmCmd[0] = alt_asm; - if(alt_link && strlen(alt_link)) - pic16_linkCmd[0] = alt_link; + if(alt_link && strlen(alt_link)) + pic16_linkCmd[0] = alt_link; + + if(!pic16_options.no_crt) { + pic16_options.omit_ivt = 1; + pic16_options.leave_reset = 0; + } } -/* all the rest is commented ifdef'd out */ #if 0 - /* Hack-o-matic: if we are using the flat24 model, - * adjust pointer sizes. - */ - if (options.model == MODEL_FLAT24) - { - - fprintf (stderr, "*** WARNING: you should use the '-mds390' option " - "for DS80C390 support. This code generator is " - "badly out of date and probably broken.\n"); - - port->s.fptr_size = 3; - port->s.gptr_size = 4; - port->stack.isr_overhead++; /* Will save dpx on ISR entry. */ -#if 1 - port->stack.call_overhead++; /* This acounts for the extra byte - * of return addres on the stack. - * but is ugly. There must be a - * better way. - */ -#endif - fReturn = fReturn390; - fReturnSize = 5; - } - if (options.model == MODEL_LARGE) { port->mem.default_local_map = xdata; @@ -606,9 +585,8 @@ _pic16_setDefaultOptions (void) pic16_options.ivt_loc = 0x000000; pic16_options.nodefaultlibs = 0; pic16_options.dumpcalltree = 0; - pic16_options.use_crt = 1; - pic16_options.crt_name = "crt0i"; /* the default crt to link */ - pic16_options.no_crt = 0; + pic16_options.crt_name = "crt0i.o"; /* the default crt to link */ + pic16_options.no_crt = 0; /* use crt by default */ } static const char * -- 2.47.2