From 2b986bde11505c465b28ead0d89722ed55979cf3 Mon Sep 17 00:00:00 2001 From: MaartenBrock Date: Wed, 18 Jul 2007 15:17:51 +0000 Subject: [PATCH] * configure.in, * doc/sdccman.lyx: bumped version to 2.7.3 * device/include/mcs51/compiler.h: fixed elif->else * src/mcs51/gen.c (genAnd, genOr): handle accuse for pure bit operands * src/mcs51/ralloc.c (createStackSpil): fixed SCLS bug with sloc for sbit, (operandUsesAcc, packRegsForAccUse): added parameter allowBitspace to enable accuse for bit operands * src/SDCCmain.c (printVersionInfo), * src/SDCCutil.c (getBuildEnvironment): factored out creation of build environment descriptor * src/SDCCutil.h: added getBuildEnvironment * src/SDCCglue.c (initialComments): use getBuildEnvironment * support/regression/tests/bug1464657.c: enabled test test_Peephole251 * support/regression/tests/bug-408972.c: enabled test leftShiftLong * support/regression/tests/bug1348008.c, * support/regression/tests/bug1496419.c, * support/regression/tests/bug1503067.c, * support/regression/tests/preproc.c: added empty tests git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4886 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 21 +++++++++++++++++++ configure.in | 2 +- device/include/mcs51/compiler.h | 6 +++--- doc/sdccman.lyx | 2 +- src/SDCCglue.c | 5 +++-- src/SDCCmain.c | 17 ++-------------- src/SDCCutil.c | 24 ++++++++++++++++++++-- src/SDCCutil.h | 3 +++ src/mcs51/gen.c | 22 ++++++++++++++++---- src/mcs51/ralloc.c | 17 +++++++++------- support/regression/tests/bug-408972.c | 29 +++++++++++++-------------- support/regression/tests/bug1348008.c | 4 ++++ support/regression/tests/bug1464657.c | 2 +- support/regression/tests/bug1496419.c | 6 +++++- support/regression/tests/bug1503067.c | 4 ++++ support/regression/tests/preproc.c | 4 ++++ 16 files changed, 116 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c939142..7064b126 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2007-07-18 Maarten Brock + + * configure.in, + * doc/sdccman.lyx: bumped version to 2.7.3 + * device/include/mcs51/compiler.h: fixed elif->else + * src/mcs51/gen.c (genAnd, genOr): handle accuse for pure bit operands + * src/mcs51/ralloc.c (createStackSpil): fixed SCLS bug with sloc for sbit, + (operandUsesAcc, packRegsForAccUse): added parameter allowBitspace to + enable accuse for bit operands + * src/SDCCmain.c (printVersionInfo), + * src/SDCCutil.c (getBuildEnvironment): factored out creation of build + environment descriptor + * src/SDCCutil.h: added getBuildEnvironment + * src/SDCCglue.c (initialComments): use getBuildEnvironment + * support/regression/tests/bug1464657.c: enabled test test_Peephole251 + * support/regression/tests/bug-408972.c: enabled test leftShiftLong + * support/regression/tests/bug1348008.c, + * support/regression/tests/bug1496419.c, + * support/regression/tests/bug1503067.c, + * support/regression/tests/preproc.c: added empty tests + 2007-07-15 Maarten Brock * support/regression/tests/bug1678803.c: new, added diff --git a/configure.in b/configure.in index 72744df7..22bb30e4 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ #!/bin/sh AC_PREREQ(2.60) -AC_INIT([sdcc], [2.7.2], [sdcc-devel@lists.sourceforge.net]) +AC_INIT([sdcc], [2.7.3], [sdcc-devel@lists.sourceforge.net]) AC_CONFIG_SRCDIR([Makefile.in]) AC_CONFIG_HEADER(sdccconf.h:sdccconf_in.h) diff --git a/device/include/mcs51/compiler.h b/device/include/mcs51/compiler.h index a21bc0fd..425f3114 100644 --- a/device/include/mcs51/compiler.h +++ b/device/include/mcs51/compiler.h @@ -160,10 +160,10 @@ # define SFR32E(name, fulladdr) /* not supported */ /** default - * unknown compiler + * unrecognized compiler */ -#elif -# warning unknown compiler +#else +# warning unrecognized compiler # define SBIT(name, addr, bit) volatile bool name # define SFR(name, addr) volatile unsigned char name # define SFRX(name, addr) volatile unsigned char name diff --git a/doc/sdccman.lyx b/doc/sdccman.lyx index 4b6e8028..5dd35501 100644 --- a/doc/sdccman.lyx +++ b/doc/sdccman.lyx @@ -104,7 +104,7 @@ SDCC Compiler User Guide \begin_layout Date \size normal -SDCC 2.7.2 +SDCC 2.7.3 \size footnotesize \newline diff --git a/src/SDCCglue.c b/src/SDCCglue.c index 96f4635b..7c544124 100644 --- a/src/SDCCglue.c +++ b/src/SDCCglue.c @@ -1411,8 +1411,9 @@ initialComments (FILE * afile) time_t t; time (&t); fprintf (afile, "%s", iComments1); - fprintf (afile, "; Version " SDCC_VERSION_STR " #%s (%s)\n", getBuildNumber(), __DATE__); - fprintf (afile, "; This file generated %s", asctime (localtime (&t))); + fprintf (afile, "; Version " SDCC_VERSION_STR " #%s (%s) (%s)\n", + getBuildNumber(), __DATE__, getBuildEnvironment()); + fprintf (afile, "; This file was generated %s", asctime (localtime (&t))); fprintf (afile, "%s", iComments2); } diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 2fec363d..2ef99035 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -424,21 +424,8 @@ printVersionInfo (FILE *stream) #ifdef SDCC_SUB_VERSION_STR "/" SDCC_SUB_VERSION_STR #endif - " #%s (" __DATE__ ")" -#ifdef __CYGWIN__ - " (CYGWIN)\n" -#elif defined __MINGW32__ - " (MINGW32)\n" -#elif defined __DJGPP__ - " (DJGPP)\n" -#elif defined(_MSC_VER) - " (MSVC)\n" -#elif defined(__BORLANDC__) - " (BORLANDC)\n" -#else - " (UNIX)\n" -#endif - , getBuildNumber() ); + " #%s (" __DATE__ ") (%s)", + getBuildNumber(), getBuildEnvironment() ); } static void diff --git a/src/SDCCutil.c b/src/SDCCutil.c index adfcff76..c092edb8 100644 --- a/src/SDCCutil.c +++ b/src/SDCCutil.c @@ -197,7 +197,7 @@ dbuf_splitFile(const char *path, struct dbuf_s *file, struct dbuf_s *ext) } } -/** Combile directory and the file name to a path string using the DIR_SEPARATOR_CHAR. +/** Combine directory and the file name to a path string using the DIR_SEPARATOR_CHAR. */ void dbuf_makePath(struct dbuf_s *path,const char *dir, const char *file) @@ -375,7 +375,7 @@ char *strncatz(char *dest, const char *src, size_t n) /* paranoia... */ if (strlen(src) + destLen >= n) { - fprintf(stderr, "strncatz prevented buffer overrun!\n"); + fprintf(stderr, "strncatz prevented buffer overrun!\n"); } strncat(dest, src, maxToCopy); @@ -391,6 +391,26 @@ const char *getBuildNumber(void) return (SDCC_BUILD_NUMBER); } +/*-----------------------------------------------------------------*/ +/* getBuildEnvironment - return environment used to build SDCC */ +/*-----------------------------------------------------------------*/ +const char *getBuildEnvironment(void) +{ +#ifdef __CYGWIN__ + return "CYGWIN"; +#elif defined __MINGW32__ + return "MINGW32"; +#elif defined __DJGPP__ + return "DJGPP"; +#elif defined(_MSC_VER) + return "MSVC"; +#elif defined(__BORLANDC__) + return "BORLANDC"; +#else + return "UNIX"; +#endif +} + #if defined(HAVE_VSNPRINTF) || defined(HAVE_VSPRINTF) size_t SDCCsnprintf(char *dst, size_t n, const char *fmt, ...) { diff --git a/src/SDCCutil.h b/src/SDCCutil.h index 6e3800b7..b2e732f7 100644 --- a/src/SDCCutil.h +++ b/src/SDCCutil.h @@ -102,6 +102,9 @@ char *strncatz (char *dest, const char *src, size_t n); /* return SDCC build number */ const char *getBuildNumber (void); +/* return environment used to build SDCC */ +const char *getBuildEnvironment(void); + /* snprintf, by hook or by crook. */ size_t SDCCsnprintf (char *, size_t, const char *, ...); diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index cb42cdeb..e9f0df3c 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -6634,8 +6634,15 @@ genAnd (iCode * ic, iCode * ifx) if (AOP_TYPE (right) == AOP_CRY) { // c = bit & bit; - emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir); - emitcode ("anl", "c,%s", AOP (left)->aopu.aop_dir); + if (IS_OP_ACCUSE (left)) + { + emitcode ("anl", "c,%s", AOP (right)->aopu.aop_dir); + } + else + { + emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir); + emitcode ("anl", "c,%s", AOP (left)->aopu.aop_dir); + } } else { @@ -7056,8 +7063,15 @@ genOr (iCode * ic, iCode * ifx) if (AOP_TYPE (right) == AOP_CRY) { // c = bit | bit; - emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir); - emitcode ("orl", "c,%s", AOP (left)->aopu.aop_dir); + if (IS_OP_ACCUSE (left)) + { + emitcode ("orl", "c,%s", AOP (right)->aopu.aop_dir); + } + else + { + emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir); + emitcode ("orl", "c,%s", AOP (left)->aopu.aop_dir); + } } else { diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 833c70e1..1334894e 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -527,12 +527,16 @@ createStackSpil (symbol * sym) { SPEC_SCLS (sloc->etype) = S_DATA; } + else if (SPEC_SCLS (sloc->etype) == S_SBIT) + { + SPEC_SCLS (sloc->etype) = S_BIT; + } SPEC_EXTR (sloc->etype) = 0; SPEC_STAT (sloc->etype) = 0; SPEC_VOLATILE(sloc->etype) = 0; SPEC_ABSA(sloc->etype) = 0; - /* we don't allow it to be allocated` + /* we don't allow it to be allocated onto the external stack since : so we temporarily turn it off ; we also turn off memory model to prevent @@ -2656,7 +2660,7 @@ bool isCommutativeOp(unsigned int op) /* operandUsesAcc - determines whether the code generated for this */ /* operand will have to use the accumulator */ /*-----------------------------------------------------------------*/ -bool operandUsesAcc(operand *op) +bool operandUsesAcc(operand *op, bool allowBitspace) { if (!op) return FALSE; @@ -2686,7 +2690,7 @@ bool operandUsesAcc(operand *op) if (sym->iaccess && symspace->paged) return TRUE; /* must fetch paged indirect sym via accumulator */ - if (IN_BITSPACE(symspace)) + if (!allowBitspace && IN_BITSPACE(symspace)) return TRUE; /* fetching bit vars uses the accumulator */ if (IN_FARSPACE(symspace) || IN_CODESPACE(symspace)) @@ -2740,7 +2744,6 @@ packRegsForAccUse (iCode * ic) getSize (operandType (IC_RESULT (ic))) > 1) return; - /* has only one definition */ if (bitVectnBitsOn (OP_DEFS (IC_RESULT (ic))) > 1) return; @@ -2810,10 +2813,10 @@ packRegsForAccUse (iCode * ic) goto accuse; /* if the other operand uses the accumulator then we cannot */ - if ( (IC_LEFT(uic)->key == IC_RESULT(ic)->key && - operandUsesAcc(IC_RIGHT(uic))) || + if ( (IC_LEFT (uic)->key == IC_RESULT (ic)->key && + operandUsesAcc (IC_RIGHT (uic), IS_BIT (operandType (IC_LEFT (uic))))) || (IC_RIGHT(uic)->key == IC_RESULT(ic)->key && - operandUsesAcc(IC_LEFT(uic))) ) + operandUsesAcc (IC_LEFT (uic), IS_BIT (operandType (IC_RIGHT (uic))))) ) return; /* make sure this is on the left side if not commutative */ diff --git a/support/regression/tests/bug-408972.c b/support/regression/tests/bug-408972.c index 23988240..29cc2543 100644 --- a/support/regression/tests/bug-408972.c +++ b/support/regression/tests/bug-408972.c @@ -2,23 +2,22 @@ */ #include -long leftShiftLong (long l) { - /* PENDING: Disabled. - return (l << 3); - */ - return l; -} - +long leftShiftLong (long l) { + return (l << 3); +} -int leftShiftIntMasked (int v) { - return ((v & 0xff00U) << 3); -} +int leftShiftIntMasked (int v) { + return ((v & 0xff00U) << 3); +} -int leftShiftIntMasked2 (int v) { - return ((v & 0xff) << 8); -} +int leftShiftIntMasked2 (int v) { + return ((v & 0xff) << 8); +} +int leftShiftIntMasked3 (int v) { + return ((v & 0xff) << 3); +} -int leftShiftIntMasked3 (int v) { - return ((v & 0xff) << 3); +void testBug(void) +{ } diff --git a/support/regression/tests/bug1348008.c b/support/regression/tests/bug1348008.c index 250e3417..b0b4302e 100644 --- a/support/regression/tests/bug1348008.c +++ b/support/regression/tests/bug1348008.c @@ -14,3 +14,7 @@ void IRQ_ISR(void) interrupt } #endif + +void testBug(void) +{ +} diff --git a/support/regression/tests/bug1464657.c b/support/regression/tests/bug1464657.c index b32bef44..88668f74 100644 --- a/support/regression/tests/bug1464657.c +++ b/support/regression/tests/bug1464657.c @@ -62,7 +62,7 @@ void f() } } -void test_Peephole251() +void test_Peephole251(void) { var = 12; f(); diff --git a/support/regression/tests/bug1496419.c b/support/regression/tests/bug1496419.c index 39c73834..b23b0928 100644 --- a/support/regression/tests/bug1496419.c +++ b/support/regression/tests/bug1496419.c @@ -1,5 +1,5 @@ /* - bug1057979.c + bug1496419.c */ #include @@ -19,3 +19,7 @@ const NODE node1 = {NULL, NULL}; //triggers a loop allocating space for symbols node1 //and zzz const NODE zzz = {&node1, &zzz}; + +void testBug(void) +{ +} diff --git a/support/regression/tests/bug1503067.c b/support/regression/tests/bug1503067.c index cf578437..f11a6505 100644 --- a/support/regression/tests/bug1503067.c +++ b/support/regression/tests/bug1503067.c @@ -4,3 +4,7 @@ const int SPRITE = 0; int sprite = 1; + +void testBug(void) +{ +} diff --git a/support/regression/tests/preproc.c b/support/regression/tests/preproc.c index f83d9921..dc5940c3 100644 --- a/support/regression/tests/preproc.c +++ b/support/regression/tests/preproc.c @@ -48,3 +48,7 @@ unsigned char b=0xfe-BAD(3); return (a + b); } #endif + +void testBug(void) +{ +} -- 2.30.2