From 1d082beac320de41d76575b9a44822c09222b449 Mon Sep 17 00:00:00 2001 From: tecodev Date: Fri, 19 Jan 2007 10:18:16 +0000 Subject: [PATCH] * src/pic/device.c (register_map): fixed list construction * src/pic/gen.c (genDivOneByte,genModOneByte): accept result > 1 byte, (genMod): removed case for genModbits, (genModbits): removed as now unused/unimplemented * src/pic/glue.c (picglue): prevent name clash with sources 'init.c' git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4581 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 ++++++++ src/pic/device.c | 7 +++---- src/pic/gen.c | 47 ++++++++++------------------------------------- src/pic/glue.c | 3 ++- 4 files changed, 23 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index fd1be24f..dd664b98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-19 Raphael Neider + + * src/pic/device.c (register_map): fixed list construction + * src/pic/gen.c (genDivOneByte,genModOneByte): accept result > 1 byte, + (genMod): removed case for genModbits, + (genModbits): removed as now unused/unimplemented + * src/pic/glue.c (picglue): prevent name clash with sources 'init.c' + 2007-01-18 Frieder Ferlemann * support/regression/tests/swap.c: added in response to #1638622 diff --git a/src/pic/device.c b/src/pic/device.c index fc35b7e1..b20b01d5 100644 --- a/src/pic/device.c +++ b/src/pic/device.c @@ -166,11 +166,10 @@ static void register_map(int num_words, char word[SPLIT_WORDS_MAX][PIC14_STRING_ r->end_address = parse_config_value(word[pcount]); r->alias = parse_config_value(word[1]); r->bank = (r->start_address >> 7) & 3; + // add memRange to device entry for future lookup (sharebanks) + r->next = rangeRAM; + rangeRAM = r; } - - // add memRange to device entry for future lookup (sharebanks) - r->next = rangeRAM; - rangeRAM = r; } diff --git a/src/pic/gen.c b/src/pic/gen.c index c3328398..baa457df 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -3454,22 +3454,24 @@ static void genDivOneByte (operand *left, operand *result) { int size; + int sign; FENTRY; DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); - assert (AOP_SIZE(result) == 1); assert (AOP_SIZE(right) == 1); assert (AOP_SIZE(left) == 1); size = min(AOP_SIZE(result),AOP_SIZE(left)); + sign = !(SPEC_USIGN(operandType(left)) + && SPEC_USIGN(operandType(right))); if (AOP_TYPE(right) == AOP_LIT) { /* XXX: might add specialized code */ } - if (SPEC_USIGN(operandType(left)) && SPEC_USIGN(operandType(right))) + if (!sign) { /* unsigned division */ #if 1 @@ -3529,7 +3531,7 @@ static void genDivOneByte (operand *left, } /* now performed the signed/unsigned division -- extend result */ - addSign(result, 1, !SPEC_USIGN(operandType(result))); + addSign(result, 1, sign); } /*-----------------------------------------------------------------*/ @@ -3571,29 +3573,6 @@ release : freeAsmop(result,NULL,ic,TRUE); } -/*-----------------------------------------------------------------*/ -/* genModbits :- modulus of bits */ -/*-----------------------------------------------------------------*/ -static void genModbits (operand *left, - operand *right, - operand *result) -{ - - char *l; - - FENTRY; - /* the result must be bit */ - pic14_emitcode("mov","b,%s",aopGet(AOP(right),0,FALSE,FALSE)); - l = aopGet(AOP(left),0,FALSE,FALSE); - - MOVA(l); - - pic14_emitcode("div","ab"); - pic14_emitcode("mov","a,b"); - pic14_emitcode("rrc","a"); - aopPut(AOP(result),"c",0); -} - /*-----------------------------------------------------------------*/ /* genModOneByte : 8 bit modulus */ /*-----------------------------------------------------------------*/ @@ -3602,22 +3581,24 @@ static void genModOneByte (operand *left, operand *result) { int size; + int sign; FENTRY; DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); - assert (AOP_SIZE(result) == 1); assert (AOP_SIZE(right) == 1); assert (AOP_SIZE(left) == 1); size = min(AOP_SIZE(result),AOP_SIZE(left)); + sign = !(SPEC_USIGN(operandType(left)) + && SPEC_USIGN(operandType(right))); if (AOP_TYPE(right) == AOP_LIT) { /* XXX: might add specialized code */ } - if (SPEC_USIGN(operandType(left)) && SPEC_USIGN(operandType(right))) + if (!sign) { /* unsigned division */ #if 1 @@ -3677,7 +3658,7 @@ static void genModOneByte (operand *left, } /* now we performed the signed/unsigned modulus -- extend result */ - addSign(result, 1, !SPEC_USIGN(operandType(result))); + addSign(result, 1, sign); } /*-----------------------------------------------------------------*/ @@ -3696,14 +3677,6 @@ static void genMod (iCode *ic) aopOp (right,ic,FALSE); aopOp (result,ic,TRUE); - /* special cases first */ - /* both are bits */ - if (AOP_TYPE(left) == AOP_CRY && - AOP_TYPE(right)== AOP_CRY) { - genModbits(left,right,result); - goto release ; - } - /* if both are of size == 1 */ if (AOP_SIZE(left) == 1 && AOP_SIZE(right) == 1 ) { diff --git a/src/pic/glue.c b/src/pic/glue.c index da91bf8a..1ad65c0b 100644 --- a/src/pic/glue.c +++ b/src/pic/glue.c @@ -1443,7 +1443,8 @@ picglue () if (mainf && IFFUNC_HASBODY(mainf->type)) { /* initialize data memory */ - fprintf (asmFile, "code_init\t%s\n", CODE_NAME); // Note - for mplink may have to enlarge section vectors in .lnk file + /* do NOT name this code_init to avoid conflicts with init.c */ + fprintf (asmFile, "c_init\t%s\n", CODE_NAME); // Note - for mplink may have to enlarge section vectors in .lnk file fprintf (asmFile,"__sdcc_gsinit_startup\n"); /* FIXME: This is temporary. The idata section should be used. If not, we could add a special feature to the linker. This will -- 2.39.5