+2004-10-05 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * src/port.h: made reset_regparms prototype void parameter explicit.
+ * src/SDCCsymt.c (processFuncArgs): removed argument "func".
+ * src/mcs51/ralloc.c (packRegisters): new fix for bugs 898889 & 979599.
+ * doc/sdccman.lyx: documented warning disabling and how to use
+ printf_large to make it print floats.
+ * device/include/stdbool.h: NEW
+ * device/lib/_atof.c,
+ * device/lib/_divuint.c,
+ * device/lib/_divulong.c,
+ * device/lib/expf.c,
+ * device/lib/printf_large.c,
+ * device/lib/sincosf.c,
+ * device/lib/sincoshf.c: used stdbool.h, all compile with stack-auto now
+ * device/lib/Makefile.in: added target for model-mcs51-reentrant to build
+ a completely reentrant lib.
+
2004-10-05 Vangelis Rokas <vrokas AT otenet.gr>
* device/lib/pic16/libsdcc/gptr/gptr*.c: added return statements
* support/Util/SDCCerr.h: added warning W_POSSBUG2.
* support/Util/SDCCerr.c (messages structure): added entry for
W_POSSBUG2
-
+
Large cumulative patch for pic16 port and libraries.
* device/include/pic16/sdcc-lib.h,
* device/include/pic16/stdarg.h,
* debugger/mcs51/cmd.c: set PC if a symbol at pc reg is set
* debugger/mcs51/simi.c: addapt new syntax of s51
-
+
2004-09-23 Vangelis Rokas <vrokas AT otenet.gr>
* src/pic16/genutils.c (pic16_genNot): fixed bug #1032265,
--- /dev/null
+/*-------------------------------------------------------------------------
+ stdbool.h - ANSI functions forward declarations
+
+ Written By - Maarten Brock, sourceforge.brock@dse.nl (2004)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-------------------------------------------------------------------------*/
+
+#ifndef __SDC51_STDBOOL_H
+#define __SDC51_STDBOOL_H 1
+
+#define _Bool bit
+
+#define bool _Bool
+#define true 1
+#define false 0
+#define __bool_true_false_are_defined 1
+
+#if defined (SDCC_STACK_AUTO) || defined (SDCC_hc08) || defined (SDCC_z80)
+ //as long as bit/bool cannot be used reentrant
+ #define BOOL char
+#else
+ #define BOOL bit
+#endif
+
+#endif
done \
fi
+model-mcs51-reentrant:
+ if [ "`grep mcs51 ../../ports.build`" = mcs51 ]; then \
+ for model in $(MODELS); do \
+ $(MAKE) MODELFLAGS="--model-$$model --stack-auto --int-long-reent --float-reent" PORT=reent-$$model objects; \
+ done \
+ fi
+
model-ds390:
if [ "`grep ds390 ../../ports.build`" = ds390 ]; then \
$(MAKE) MODELFLAGS="-mds390" PORT=ds390 objects; \
/* atof.c: converts an ASCII string to float
- Copyright (C) 2003 Jesus Calvino-Fraga, jesusc@ieee.org
+ Copyright (C) 2003 Jesus Calvino-Fraga, jesusc@ieee.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#include <ctype.h>
#include <stdlib.h>
+#include <stdbool.h>
float atof(char * s)
{
float value, fraction;
char iexp;
-#ifdef SDCC_mcs51
- bit sign;
-#else
- char sign;
-#endif
+ BOOL sign;
//Skip leading blanks
while (isspace(*s)) s++;
mcs51 small stack-auto
*/
+#include <stdbool.h>
+
#if !defined(SDCC_USE_XSTACK) && !defined(_SDCC_NO_ASM_LIB_FUNCS)
# if defined(SDCC_mcs51)
# if defined(SDCC_MODEL_SMALL)
{
unsigned int reste = 0;
unsigned char count = 16;
- #if defined(SDCC_STACK_AUTO) || defined(SDCC_z80)
- char c;
- #else
- bit c;
- #endif
+ BOOL c;
do
{
mcs51 small stack-auto
*/
+#include <stdbool.h>
+
#if !defined(SDCC_USE_XSTACK) && !defined(_SDCC_NO_ASM_LIB_FUNCS)
# if defined(SDCC_mcs51)
# if defined(SDCC_MODEL_SMALL)
{
unsigned long reste = 0L;
unsigned char count = 32;
- #if defined(SDCC_STACK_AUTO) || defined(SDCC_z80)
- char c;
- #else
- bit c;
- #endif
+ BOOL c;
do
{
/* expf.c: Computes e**x of a 32-bit float as outlined in [1]
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
+ Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#include <math.h>
#include <errno.h>
+#include <stdbool.h>
#define P0 0.2499999995E+0
#define P1 0.4160288626E-2
{
int n;
float xn, g, r, z, y;
-#ifdef SDCC_mcs51
- bit sign;
-#else
- char sign;
-#endif
+ BOOL sign;
if(x>=0.0)
{ y=x; sign=0; }
#include <string.h>
#include <ctype.h>
#include <stdio.h>
+#include <stdbool.h>
#define PTR value.ptr
//#define toupper(c) ((c)&=~0x20)
#define toupper(c) ((c)&=0xDF)
-#if defined (SDCC_STACK_AUTO) || defined (SDCC_hc08)
- //as long as bit/bool cannot be used reentrant
- #define BOOL char
-#else
- #define BOOL bit
-#endif
-
typedef union
{
unsigned char byte[5];
static void* p;
#ifdef ASM_ALLOWED
- static bit lsd;
+ static bool lsd;
/* this one NEEDS to be in data */
static data value_t value;
/* sincosf.c: Computes sin or cos of a 32-bit float as outlined in [1]
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
+ Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#include <math.h>
#include <errno.h>
+#include <stdbool.h>
#define r1 -0.1666665668E+0
#define r2 0.8333025139E-2
{
float y, f, r, g, XN;
int N;
-#ifdef SDCC_mcs51
- bit sign;
-#else
- char sign;
-#endif
+ BOOL sign;
if(iscos)
{
/* sincoshf.c: Computes sinh or cosh of a 32-bit float as outlined in [1]
- Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
+ Copyright (C) 2001, 2002 Jesus Calvino-Fraga, jesusc@ieee.org
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
#include <math.h>
#include <errno.h>
+#include <stdbool.h>
#define P0 -0.713793159E+1
#define P1 -0.190333999E+0
float sincoshf(const float x, const int iscosh)
{
float y, w, z;
-#ifdef SDCC_mcs51
- bit sign;
-#else
- char sign;
-#endif
-
+ BOOL sign;
+
if (x<0.0) { y=-x; sign=1; }
else { y=x; sign=0; }
\textclass book
\begin_preamble
+
\usepackage[
pdftitle={SDCC Compiler User Guide},
pdfauthor={SDCC development team},
\labelwidthstring 00.00.0000
+\series bold
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-disable-warning\SpecialChar ~
+<nnnn>
+\begin_inset LatexCommand \index{-\/-disable-warning}
+
+\end_inset
+
+
+\series default
+ Disable specific warning with number <nnnn>.
+\layout List
+\labelwidthstring 00.00.0000
+
+
\series bold
-
\begin_inset ERT
in sdcc/device/lib.
\layout Standard
+The default
+\family typewriter
+ printf()
+\begin_inset LatexCommand \index{printf()}
+
+\end_inset
+
+
+\family default
+implementation in
+\family typewriter
+ printf_large.c
+\family default
+ does not support float (except on ds390).
+ To enable this recompile it with the option
+\emph on
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+DUSE_FLOATS=1
+\begin_inset LatexCommand \index{USE\_FLOATS}
+
+\end_inset
+
+
+\emph default
+ on the command line.
+ Use
+\emph on
+-
+\begin_inset ERT
+status Collapsed
+
+\layout Standard
+
+\backslash
+/
+\end_inset
+
+-model-large
+\begin_inset LatexCommand \index{-\/-model-large}
+
+\end_inset
+
+
+\emph default
+ for the mcs51 port, since this uses a lot of memory.
+\layout Standard
+
If you're short on memory you might want to use
\family typewriter
printf_small()
\emph default
of
\family typewriter
- printf()
-\begin_inset LatexCommand \index{printf()}
-
-\end_inset
-
-.
+ printf().
\family default
For the mcs51 there is an assembly version
your own now ;-(
\layout Itemize
+disable_warning <nnnn>
+\begin_inset LatexCommand \index{\#pragma disable\_warning}
+
+\end_inset
+
+ - the compiler will not warn you anymore about warning number <nnnn>.
+\layout Itemize
+
nogcse
\begin_inset LatexCommand \index{\#pragma nogcse}
else
{
/* hack-o-matic! I see no reason why the useXstack option should ever
- * control this allcoation, but the code was originally that way, and
+ * control this allocation, but the code was originally that way, and
* changing it for non-390 ports breaks the compiler badly.
*/
bool useXdata = (TARGET_IS_DS390 || TARGET_IS_DS400) ?
return head;
}
-
/*------------------------------------------------------------------*/
/* cleanUpBlock - cleansup the symbol table specified for all the */
/* symbols in the given block */
}
/* reset regparm for the port */
- (*port->reset_regparms) ( func );
+ (*port->reset_regparms) ();
+
/* if any of the arguments is an aggregate */
/* change it to pointer to the same type */
while (val)
return;
}
-
-
/*-----------------------------------------------------------------*/
/* selectSpil - select a iTemp to spil : rather a simple procedure */
/*-----------------------------------------------------------------*/
for (ic = ebp->sch; ic; ic = ic->next)
{
+ /* Fix for bug #979599: */
+ /* P0 &= ~1; */
+
+ /* Look for two subsequent iCodes with */
+ /* iTemp := _c; */
+ /* _c = iTemp & op; */
+ /* and replace them by */
+ /* iTemp := _c; */
+ /* _c = _c & op; */
+ if ((ic->op == BITWISEAND || ic->op == '|' || ic->op == '^') &&
+ ic->prev &&
+ ic->prev->op == '=' &&
+ IS_ITEMP (IC_LEFT (ic)) &&
+ IC_LEFT (ic) == IC_RESULT (ic->prev) &&
+ isOperandEqual (IC_RESULT(ic), IC_RIGHT(ic->prev)))
+ {
+ iCode* ic_prev = ic->prev;
+ symbol* prev_result_sym = OP_SYMBOL (IC_RESULT (ic_prev));
+
+ ReplaceOpWithCheaperOp (&IC_LEFT (ic), IC_RESULT (ic));
+ if (IC_RESULT (ic_prev) != IC_RIGHT (ic))
+ {
+ bitVectUnSetBit (OP_USES (IC_RESULT (ic_prev)), ic->key);
+ if (/*IS_ITEMP (IC_RESULT (ic_prev)) && */
+ prev_result_sym->liveTo == ic->seq)
+ {
+ prev_result_sym->liveTo = ic_prev->seq;
+ }
+ }
+ bitVectSetBit (OP_USES (IC_RESULT (ic)), ic->key);
+
+ bitVectSetBit (ic->rlive, IC_RESULT (ic)->key);
+
+ if (bitVectIsZero (OP_USES (IC_RESULT (ic_prev))))
+ {
+ bitVectUnSetBit (ic->rlive, IC_RESULT (ic)->key);
+ bitVectUnSetBit (OP_DEFS (IC_RESULT (ic_prev)), ic_prev->key);
+ remiCodeFromeBBlock (ebp, ic_prev);
+ hTabDeleteItem (&iCodehTab, ic_prev->key, ic_prev, DELETE_ITEM, NULL);
+ }
+ }
/* if this is an itemp & result of an address of a true sym
then mark this as rematerialisable */
packRegsForOneuse (ic, IC_LEFT (ic), ebp);
- /* if this is cast for intergral promotion then
- check if only use of the definition of the
+ /* if this is a cast for intergral promotion then
+ check if it's the only use of the definition of the
operand being casted/ if yes then replace
the result of that arithmetic operation with
this result and get rid of the cast */
void (*genInitStartup) (FILE * of);
/* parameter passing in register related functions */
- void (*reset_regparms) (); /* reset the register count */
+ void (*reset_regparms) (void); /* reset the register count */
int (*reg_parm) (struct sym_link *); /* will return 1 if can be passed in register */
/** Process the pragma string 'sz'. Returns 0 if recognised and