-V
\series default
Shows the actual commands the compiler is executing.
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+---no-c-code-in-asm
+\series default
+ Hides your ugly and inefficient c-code from the asm file, so you can always
+ blame the compiler :).
+\layout List
+\labelwidthstring 00.00.0000
+
+
+\series bold
+---i-code-in-asm
+\series default
+ Include i-codes in the asm file.
+ Looks like noise but is most helpfull for debugging the compiler itself.
\layout Subsubsection
Intermediate Dump Options
int xram_size; /* external ram size (used only for error checking) */
bool xram_size_set; /* since xram_size=0 is a possibility */
int code_size; /* code size (used only for error checking) */
+ int verboseExec; /* show what we are doing */
+ int noXinitOpt; /* don't optimize initialized xdata */
+ int noCcodeInAsm; /* hide c-code from asm */
+ int iCodeInAsm; /* show i-code in asm */
};
/* forward definition for variables accessed globally */
extern char *libPaths[128];
extern int nlibPaths;
-extern bool verboseExec;
-extern bool noXinitOpt;
-
void parseWithComma (char **, char *);
/** Creates a temporary file a'la tmpfile which avoids the bugs
int nrelFiles = 0;
bool verboseExec = FALSE;
char *preOutName;
-bool noXinitOpt = FALSE;
/* uncomment JAMIN_DS390 to always override and use ds390 port
for mcs51 work. This is temporary, for compatibility testing. */
#define OPTION_NO_XINIT_OPT "--no-xinit-opt"
#define OPTION_XRAM_SIZE "--xram-size"
#define OPTION_CODE_SIZE "--code-size"
+#define OPTION_NO_CCODE_IN_ASM "--no-c-code-in-asm"
+#define OPTION_ICODE_IN_ASM "--i-code-in-asm"
static const OPTION
optionsTable[] = {
{ 0, "--tini-libid", NULL,"<nnnn> LibraryID used in -mTININative"},
{ 0, "--protect-sp-update", &options.protect_sp_update,"DS390 - will disable interrupts during ESP:SP updates"},
{ 0, "--parms-in-bank1", &options.parms_in_bank1,"MCS51/DS390 - use Bank1 for parameter passing"},
- { 0, OPTION_NO_XINIT_OPT, &noXinitOpt, "don't memcpy initialized xram from code"},
+ { 0, OPTION_NO_XINIT_OPT, &options.noXinitOpt, "don't memcpy initialized xram from code"},
+ { 0, OPTION_NO_CCODE_IN_ASM, &options.noCcodeInAsm, "don't include c-code as comments in the asm file"},
+ { 0, OPTION_ICODE_IN_ASM, &options.iCodeInAsm, "include i-code as comments in the asm file"},
/* End of options */
{ 0, NULL }
};
#include "common.h"
#include "asm.h"
+#if !defined(__BORLANDC__) && !defined(_MSC_VER)
+// for pipe and close
+#include <unistd.h>
+#endif
+
/* A 'token' is like !blah or %24f and is under the programmers
control. */
#define MAX_TOKEN_LEN 64
}
/*-----------------------------------------------------------------*/
-/* printCLine - try to find the c-code for this lineno */
+/* printILine - return the readable i-code for this ic */
+/* */
+/* iCodePrint wants a file stream so we need a pipe to fool it */
+/*-----------------------------------------------------------------*/
+static char verbalICode[1024];
+
+char *printILine (iCode *ic) {
+ int filedes[2];
+ FILE *pipeStream;
+ iCodeTable *icTab=getTableEntry(ic->op);
+
+ assert(pipe(filedes)!=-1); // forget it
+
+ // stuff the pipe with the readable icode
+ pipeStream=fdopen(filedes[1],"w");
+ icTab->iCodePrint(pipeStream, ic, icTab->printName);
+ // it really needs an extra push
+ fflush(pipeStream);
+ // now swallow it
+ pipeStream=fdopen(filedes[0],"r");
+ fgets(verbalICode, sizeof(verbalICode), pipeStream);
+ // clean up the mess, we'll return here for all icodes!!
+ assert(!close (filedes[0]));
+ assert(!close (filedes[1]));
+ // kill the trailing NL
+ verbalICode[strlen(verbalICode)-1]='\0';
+ // and throw it up
+ return verbalICode;
+}
+
+/*-----------------------------------------------------------------*/
+/* printCLine - return the c-code for this lineno */
/*-----------------------------------------------------------------*/
static FILE *inFile=NULL;
static char inLineString[1024];
char *FileBaseName (char *fileFullName);
+char *printILine (iCode *ic);
char *printCLine (char *srcFile, int lineno);
#endif
ic->level, ic->block);
_G.debugLine = 0;
}
- emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
- printCLine(ic->filename, ic->lineno));
+ if (!options.noCcodeInAsm) {
+ emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
+ printCLine(ic->filename, ic->lineno));
+ }
cln = ic->lineno;
}
+ if (options.iCodeInAsm) {
+ emitcode("", ";ic:%d: %s", ic->key, printILine(ic));
+ }
/* if the result is marked as
spilt and rematerializable or code for
this has already been generated then
static void
_ds390_finaliseOptions (void)
{
+ if (options.noXinitOpt) {
+ port->genXINIT=0;
+ }
+
/* Hack-o-matic: if we are using the flat24 model,
* adjust pointer sizes.
*/
ic->level, ic->block);
_G.debugLine = 0;
}
- emitcode ("", "; %s:%d: %s", ic->filename, ic->lineno,
- printCLine(ic->filename, ic->lineno));
+ if (!options.noCcodeInAsm) {
+ emitcode ("", ";%s:%d: %s", ic->filename, ic->lineno,
+ printCLine(ic->filename, ic->lineno));
+ }
cln = ic->lineno;
}
+ if (options.iCodeInAsm) {
+ emitcode("", ";ic:%d: %s", ic->key, printILine(ic));
+ }
/* if the result is marked as
spilt and rematerializable or code for
this has already been generated then
static void
_mcs51_finaliseOptions (void)
{
- if (noXinitOpt /* || options.model==MODEL_SMALL */) {
+ if (options.noXinitOpt) {
port->genXINIT=0;
}
pic14_emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
printCLine(ic->filename, ic->lineno));
*/
- addpCode2pBlock(pb,
- newpCodeCSource(ic->lineno,
- ic->filename,
- printCLine(ic->filename, ic->lineno)));
+ if (!options.noCcodeInAsm) {
+ addpCode2pBlock(pb,
+ newpCodeCSource(ic->lineno,
+ ic->filename,
+ printCLine(ic->filename, ic->lineno)));
+ }
cln = ic->lineno ;
}
+
+ // if you want printILine too, look at ../mcs51/gen.c, i don't understand this :)
+
/* if the result is marked as
spilt and rematerializable or code for
this has already been generated then
ic->level, ic->block);
_G.debugLine = 0;
}
- emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
- printCLine(ic->filename, ic->lineno));
+ if (!options.noCcodeInAsm) {
+ emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
+ printCLine(ic->filename, ic->lineno));
+ }
cln = ic->lineno;
}
+ if (options.iCodeInAsm) {
+ emitcode("", ";ic:%d: %s", ic->key, printILine(ic));
+ }
+
/* if the result is marked as
spilt and rematerializable or code for
this has already been generated then
if (cln != ic->lineno)
{
- emit2 ("; %s:%d: %s", ic->filename, ic->lineno,
- printCLine(ic->filename, ic->lineno));
+ if (!options.noCcodeInAsm) {
+ emit2 (";%s:%d: %s", ic->filename, ic->lineno,
+ printCLine(ic->filename, ic->lineno));
+ }
cln = ic->lineno;
}
+ if (options.iCodeInAsm) {
+ emit2 (";ic:%d: %s", ic->key, printILine(ic));
+ }
/* if the result is marked as
spilt and rematerializable or code for
this has already been generated then
i++;
}
- if (verboseExec)
+ if (options.verboseExec)
{
printf ("+ %s\n", cmdLine ? cmdLine : cmd);
}