LIBGC = $(PRJDIR)/support/gc/libgc.a
endif
+#CFLAGS += -Werror
+
ifdef SDCC_SUB_VERSION
CFLAGS += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\"
endif
# --------------------------------
uninstall:
rm -f $(bindir)/sdcc
-
+ rm -f $(bindir)/packihx
# Performing self-test
# --------------------
$(PACKIHX): packihx
$(INSTALL) packihx $(PACKIHX)
-
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
extern int yyerror (char *);
extern FILE *yyin;
-extern char srcLstFname[];
int NestLevel = 0 ; /* current NestLevel */
int stackPtr = 1 ; /* stack pointer */
int xstackPtr = 0 ; /* xstack pointer */
int eBBNum = 0;
set *graphEdges = NULL ; /* list of edges in this flow graph */
-extern int labelKey ;
/*-----------------------------------------------------------------*/
/* printEntryLabel - prints entry label of a ebblock */
int currLineno = 0;
set *astList = NULL ;
set *operKeyReset = NULL;
-extern char *currFname ;
ast *staticAutos = NULL;
int labelKey = 1 ;
int noLineno = 0;
int noAlloc = 0 ;
symbol *currFunc ;
-extern int fatalError ;
-extern int lineno;
-extern char *filename ;
-extern set *publics;
-extern ast *createIval (ast *, link *, initList *, ast *);
-extern ast *createIvalCharPtr (ast *, link *, ast *);
+ast *createIval (ast *, link *, initList *, ast *);
+ast *createIvalCharPtr (ast *, link *, ast *);
ast *optimizeRRCRLC ( ast * );
ast *optimizeGetHbit(ast *);
ast *backPatchLabels (ast *,symbol *,symbol *);
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+#ifndef SDCCEXPR_H
+#define SDCCEXPR_H
+
#include "SDCCglobl.h"
#include "SDCCsymt.h"
#include "SDCCval.h"
-
-#ifndef SDCCEXPR_H
-#define SDCCEXPR_H
+#include "SDCCset.h"
#define EX_OP 0
#define EX_VALUE 1
x == AND_ASSIGN || x == OR_ASSIGN || x == INC_OP || x == DEC_OP)
#define IS_DEREF_OP(x) (( x->opval.op == '*' && x->right == NULL) || x->opval.op == '.')
-/* forward declrations for global variables */
+/* forward declarations for global variables */
extern ast *staticAutos ;
+extern FILE *codeOutFile;
/* forward definitions for functions */
ast *newAst (int , void * );
bool hasSEFcalls ( ast *);
void addSymToBlock (symbol *, ast *) ;
+// exported variables
+extern set *operKeyReset;
+extern int noAlloc;
+
#endif
#define ERROR 0
#define WARNING 1
-extern FILE *lstFile;
-extern int fatalError ;
-extern int lineno ;
-extern char *filename;
+
struct {
int errType ;
char *errText ;
int c1mode : 1 ; /* Act like c1 - no pre-proc, asm or link */
char *peep_file ; /* additional rules for peep hole */
char *out_name ; /* Asm output name for c1 mode */
+ int nostdlib : 1 ; /* Don't use standard lib files */
+ int nostdinc : 1 ; /* Don't use standard include files */
+ int verbose : 1 ; /* Show what the compiler is doing */
char *calleeSaves[128]; /* list of functions using callee save */
char *excludeRegs[32] ; /* registers excluded from saving */
#include "asm.h"
#include <time.h>
+// This is a bit messy because we define link ourself
+#define link NoLiNk
+#include <unistd.h>
+#undef link
+
symbol *interrupts[256];
-/*extern char *aopLiteral (value *, int);*//* drdani Jan 30 2000 */
+
void printIval (symbol *, link *, initList *, FILE *);
-extern int noAlloc;
set *publics = NULL; /* public variables */
set *externs = NULL; /* Varibles that are declared as extern */
/* TODO: this should be configurable (DS803C90 uses more than 6) */
int maxInterrupts = 6;
int allocInfo = 1;
-extern int maxRegBank ;
symbol *mainf;
-extern char *VersionString;
-extern FILE *codeOutFile;
+char *VersionString;
set *tmpfileSet = NULL; /* set of tmp file created by the compiler */
set *tmpfileNameSet = NULL; /* All are unlinked at close. */
tfprintf(map->oFile, "\t!ds\n", (unsigned int)getSize (sym->type) & 0xffff);
}
- /* if it has a initial value then do it only if
+ /* if it has an initial value then do it only if
it is a global variable */
if (sym->ival && sym->level == 0) {
ast *ival = NULL;
char *aopLiteral (value *, int);
void flushStatics(void);
+extern symbol *interrupts[];
+extern set *publics;
+extern set *tmpfileSet;
#endif
int scopeLevel;
int lvaluereq;
-extern int labelKey ;
-
symbol *returnLabel ; /* function return label */
symbol *entryLabel ; /* function entry label */
/*-----------------------------------------------------------------*/
operand *opFromOpWithDU (operand *,bitVect *,bitVect *);
iCode *copyiCode (iCode *);
operand *newiTempFromOp( operand *);
+/*-----------------------------------------------------------------*/
+/* declaration of exported variables */
+/*-----------------------------------------------------------------*/
+extern char *filename;
+int lineno;
#endif
#include "spawn.h"
#endif
-/* This is a bit messy. We cant include unistd.h as it defines
- 'link' which we also use.
-*/
-int access(const char *path, int mode);
-#define X_OK 1
-int unlink(const char *path);
-
-extern void initSymt ();
-extern void initMem ();
-extern void initExpr ();
-extern void initiCode ();
-extern void initCSupport ();
-extern void initPeepHole ();
-extern void createObject ();
-extern int yyparse ();
-extern void glue ();
-extern struct value *constVal(char *s);
-extern double floatFromVal(struct value *);
-extern int fatalError ;
+// This is a bit messy because we define link ourself
+#define link NoLiNk
+#include <unistd.h>
+#undef link
+
+//REMOVE ME!!!
+extern int yyparse();
+
FILE *srcFile ;/* source file */
FILE *cdbFile = NULL ;/* debugger information output file */
char *fullSrcFileName ;/* full name for the source file */
char *relFiles[128];
int nrelFiles = 0;
bool verboseExec = FALSE;
-//extern int wait (int *);
char *preOutName;
/* Far functions, far data */
#define OPTION_HELP "-help"
#define OPTION_CALLEE_SAVES "-callee-saves"
#define OPTION_NOREGPARMS "-noregparms"
-
+#define OPTION_NOSTDLIB "-nostdlib"
+#define OPTION_NOSTDINC "-nostdinc"
+#define OPTION_VERBOSE "-verbose"
static const char *_preCmd[] = {
"sdcpp", "-Wall", "-lang-c++", "-DSDCC=1",
"$l", "-I" SDCC_INCLUDE_DIR, "$1", "$2", NULL
};
-#if !OPT_DISABLE_MCS51
-extern PORT mcs51_port;
-#endif
-#if !OPT_DISABLE_GBZ80
-extern PORT gbz80_port;
-#endif
-#if !OPT_DISABLE_Z80
-extern PORT z80_port;
-#endif
-#if !OPT_DISABLE_AVR
-extern PORT avr_port;
-#endif
-#if !OPT_DISABLE_DS390
-extern PORT ds390_port;
-#endif
-
-
PORT *port;
static PORT *_ports[] = {
options.genericPtr = 1; /* default on */
options.nopeep = 0;
options.model = port->general.default_model;
+ options.nostdlib=0;
+ options.nostdinc=0;
+ options.verbose=0;
/* now for the optimizations */
/* turn on the everything */
continue;
}
+ if (strcmp(&argv[i][1],OPTION_NOSTDLIB) == 0) {
+ options.nostdlib=1;
+ continue;
+ }
+
+ if (strcmp(&argv[i][1],OPTION_NOSTDINC) == 0) {
+ options.nostdinc=1;
+ continue;
+ }
+
+ if (strcmp(&argv[i][1],OPTION_VERBOSE) == 0) {
+ options.verbose=1;
+ continue;
+ }
+
if (!port->parseOption(&argc, argv, &i))
{
werror(W_UNKNOWN_OPTION,argv[i]);
noAssemble = 1;
break;
+ case 'V':
+ verboseExec = TRUE;
+ break;
+
case 'v':
-#if FEATURE_VERBOSE_EXEC
- verboseExec = TRUE;
-#else
printVersionInfo();
exit(0);
-#endif
break;
/* preprocessor options */
free(dir);
i++;
}
-#if FEATURE_VERBOSE_EXEC
+
if (verboseExec) {
char **pCmd = cmd_argv;
+ printf ("+ ");
while (*pCmd) {
printf("%s ", *pCmd);
pCmd++;
}
printf("\n");
}
-#endif
+
if (got)
i= spawnv(P_WAIT,got,cmd_argv) == -1;
else
fprintf (lnkfile,"-k %s\n",libPaths[i]);
/* standard library path */
- if (strcmp(port->target,"ds390")==0) {
- c="ds390";
- } else {
- switch(options.model)
- {
- case MODEL_SMALL:
- c = "small";
- break;
- case MODEL_LARGE:
- c = "large";
- break;
- case MODEL_FLAT24:
- c = "flat24";
- break;
- default:
- werror(W_UNKNOWN_MODEL, __FILE__, __LINE__);
- c = "unknown";
- break;
- }
- }
- fprintf (lnkfile,"-k %s/%s\n",SDCC_LIB_DIR/*STD_LIB_PATH*/,c);
-
- /* standard library files */
- if (strcmp(port->target, "ds390")==0) {
- fprintf (lnkfile,"-l %s\n",STD_DS390_LIB);
+ if (!options.nostdlib) {
+ if (IS_DS390_PORT) {
+ c="ds390";
+ } else {
+ switch(options.model)
+ {
+ case MODEL_SMALL:
+ c = "small";
+ break;
+ case MODEL_LARGE:
+ c = "large";
+ break;
+ case MODEL_FLAT24:
+ c = "flat24";
+ break;
+ default:
+ werror(W_UNKNOWN_MODEL, __FILE__, __LINE__);
+ c = "unknown";
+ break;
+ }
+ }
+ fprintf (lnkfile,"-k %s/%s\n",SDCC_LIB_DIR/*STD_LIB_PATH*/,c);
+
+ /* standard library files */
+ if (strcmp(port->target, "ds390")==0) {
+ fprintf (lnkfile,"-l %s\n",STD_DS390_LIB);
+ }
+ fprintf (lnkfile,"-l %s\n",STD_LIB);
+ fprintf (lnkfile,"-l %s\n",STD_INT_LIB);
+ fprintf (lnkfile,"-l %s\n",STD_LONG_LIB);
+ fprintf (lnkfile,"-l %s\n",STD_FP_LIB);
}
- fprintf (lnkfile,"-l %s\n",STD_LIB);
- fprintf (lnkfile,"-l %s\n",STD_INT_LIB);
- fprintf (lnkfile,"-l %s\n",STD_LONG_LIB);
- fprintf (lnkfile,"-l %s\n",STD_FP_LIB);
/* additional libraries if any */
for (i = 0 ; i < nlibFiles; i++)
buildCmdLine(buffer, argv, port->linker.cmd, srcFileName, NULL, NULL, NULL);
- /* call the linker */
+ if (options.verbose)
+ printf ("sdcc: Calling linker...\n");
if (my_system(argv[0], argv)) {
perror("Cannot exec linker");
exit(1);
buildCmdLine(buffer, argv, _preCmd, fullSrcFileName,
preOutName, srcFileName, preArgv);
+ if (options.verbose)
+ printf ("sdcc: Calling preprocessor...\n");
+
if (my_system(argv[0], argv)) {
unlink (preOutName);
perror("Cannot exec Preprocessor");
exit(0);
}
- if (srcFileName)
+ if (srcFileName) {
preProcess(envp) ;
- if (srcFileName)
- {
initSymt();
initiCode();
initCSupport ();
initPeepHole();
+
+ if (options.verbose)
+ printf ("sdcc: Generating code...\n");
+
yyparse();
if (!fatalError)
}
if (!options.c1mode)
{
+ if (options.verbose)
+ printf ("sdcc: Calling assembler...\n");
+
assemble(envp);
}
}
if (port->linker.do_link)
port->linker.do_link();
else
- linkEdit (envp);
+ linkEdit (envp);
}
if (yyin && yyin != stdin)
symbols in a single overlay */
set *ovrSetSets = NULL;
-extern set *operKeyReset ;
-extern set *tmpfileSet ;
-extern symbol *interrupts[];
int maxRegBank = 0;
int fatalError = 0 ;/* fatal error flag */
extern memmap *eeprom; /* eepromp space */
extern memmap *home; /* Non-banked home space */
+extern int fatalError;
+
extern struct set *ovrSetSets;
+extern int maxRegBank;
+
/* easy access macros */
#define IN_BITSPACE(map) (map && map->bitsp)
#define IN_STACK(x) (IS_SPEC(x) && (SPEC_OCLS(x) == xstack || SPEC_OCLS(x) == istack ))
+++ /dev/null
-BEGIN {
- print "/* Generated file DO NOT Edit */"
- print "/* To Make changes to rules */"
- print "/* edit file SDCCpeeph.def */"
-}
-
-/^\/\// { next}
-
-{ printf "\"" ;
- printf "%s",$0;
- print "\\n\"";
-}
-
-
void printLine (lineNode *,FILE *);
lineNode *newLineNode (char *);
lineNode *connectLine (lineNode *,lineNode *);
+void initPeepHole(void);
void peepHole (lineNode **);
#endif
bucket *LabelTab [256] ; /* the Label table */
bucket *enumTab [256] ; /* enumerated table */
-extern struct set *publics;
-
/*------------------------------------------------------------------*/
/* initSymt () - initialises symbol table related stuff */
/*------------------------------------------------------------------*/
*p = '\0';
vsprintf(pInto, format, ap);
/* PENDING: Assume that the arg length was an int */
- va_arg(ap, int);
+ (void)va_arg(ap, int);
}
}
pInto = pStart + strlen(pStart);
*p = '\0';
vsprintf(pInto, token, ap);
pInto = buffer + strlen(buffer);
- va_arg(ap, int);
+ (void)va_arg(ap, int);
}
else {
*pInto++ = *sz++;
# --------------------------------------------------
clean:
rm -f *core *[%~] *.[oa] *.output
- rm -f .[a-z]*~
+ rm -f .[a-z]*~ \#*
rm -f $(PRJDIR)/bin/sdcc sdcc
for port in $(PORTS) ; do\
$(MAKE) -C $$port -f clean.mk clean ;\
# Like clean but some files may still exist
# -----------------------------------------
mostlyclean: clean
+ rm -f SDCCy.c
+ rm -f SDCCy.h
+ rm -f SDCClex.c
# Deleting everything that can reconstructed by this Makefile. It deletes
#include "SDCClrange.h"
#include "SDCCptropt.h"
#include "SDCCopt.h"
+#include "SDCCglue.h"
+#include "SDCCpeeph.h"
#include "asm.h"
#include "port.h"
-#include "config.h"
-
-/*
-#include "SDCCralloc.h"
-*/
extern PORT *port;
-/* Ugly test to see if we are current compiling in DS390 mode. */
+#if !OPT_DISABLE_MCS51
+extern PORT mcs51_port;
+#endif
+#if !OPT_DISABLE_GBZ80
+extern PORT gbz80_port;
+#endif
+#if !OPT_DISABLE_Z80
+extern PORT z80_port;
+#endif
+#if !OPT_DISABLE_AVR
+extern PORT avr_port;
+#endif
+#if !OPT_DISABLE_DS390
extern PORT ds390_port;
+#endif
+
+/* Test to see if we are current compiling in DS390 mode. */
+#define IS_MCS51_PORT (port == &mcs51_port)
+#define IS_GBZ80_PORT (port == &gbz80_port)
+#define IS_Z80_PORT (port == &z80_port)
+#define IS_AVR_PORT (port == &avr_port)
#define IS_DS390_PORT (port == &ds390_port)
#endif