#include "ralloc.h"
#include "gen.h"
-#if defined(__BORLANDC__) || defined(_MSC_VER)
-#define STRCASECMP stricmp
-#else
-#define STRCASECMP strcasecmp
-#endif
-
extern int allocInfo;
/* this is the down and dirty file with all kinds of
extern int xa51_ptrRegReq;
extern int xa51_nRegs;
-extern FILE *codeOutFile;
+extern struct dbuf_s *codeOutBuf;
static lineNode *lineHead = NULL;
static lineNode *lineCurr = NULL;
else
vsprintf (lb, fmt, ap);
- while (isspace ((int)*lbp))
+ while (isspace (*lbp))
lbp++;
if (lbp && *lbp)
va_end (ap);
}
+/*-----------------------------------------------------------------*/
+/* xa51_emitDebuggerSymbol - associate the current code location */
+/* with a debugger symbol */
+/*-----------------------------------------------------------------*/
+void
+xa51_emitDebuggerSymbol (char * debugSym)
+{
+ _G.debugLine = 1;
+ emitcode ("", "%s ==.", debugSym);
+ _G.debugLine = 0;
+}
+
+
char *getStackOffset(int stack) {
static char gsoBuf[1024];
sprintf (gsoBuf, "r7+(%d%+d%+d)", stack,
emitcode (";", "genFunction %s", sym->rname);
/* print the allocation information */
- printAllocInfo (currFunc, codeOutFile);
+ printAllocInfo (currFunc, codeOutBuf);
emitcode ("", "%s:", sym->rname);
if (IFFUNC_ISNAKED(sym->type)) {
emitcode(";", "naked function: no epilogue.");
+ if (options.debug && currFunc)
+ debugFile->writeEndFunction (currFunc, ic, 0);
return;
}
emitcode ("add", "r7,#%d\t; release stack space for locals", sym->stack);
}
+ if (options.debug && currFunc) {
+ debugFile->writeEndFunction (currFunc, ic, 1);
+ }
+
if (IFFUNC_ISISR(sym->type)) {
emitcode ("reti", "");
} else {
}
}
/* if the operand used or deffed */
- if (bitVectBitValue(OP_USES(op),lic->key) || (unsigned) lic->defKey == op->key) {
+ if (bitVectBitValue(OP_USES(op),lic->key) || lic->defKey == op->key) {
return NULL;
}
/* if GOTO or IFX */
genDummyRead (iCode * ic)
{
emitcode ("; genDummyRead","");
+
+ ic = ic;
}
/*-----------------------------------------------------------------*/
/* if debug information required */
if (options.debug && currFunc)
{
- debugFile->writeFunction(currFunc);
- _G.debugLine = 1;
- if (IS_STATIC (currFunc->etype))
- emitcode ("", "F%s$%s$0$0 ==.", moduleName, currFunc->name);
- else
- emitcode ("", "G$%s$0$0 ==.", currFunc->name);
- _G.debugLine = 0;
+ debugFile->writeFunction (currFunc, lic);
}
for (ic = lic; ic; ic = ic->next) {
if (ic->lineno && cln != ic->lineno) {
if (options.debug) {
- _G.debugLine = 1;
- emitcode ("", "C$%s$%d$%d$%d ==.",
- FileBaseName (ic->filename), ic->lineno,
- ic->level, ic->block);
- _G.debugLine = 0;
+ debugFile->writeCLine (ic);
}
if (!options.noCcodeInAsm) {
emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
cln = ic->lineno;
}
if (options.iCodeInAsm) {
- emitcode("", ";ic:%d: %s", ic->key, printILine(ic));
+ char *iLine = printILine(ic);
+ emitcode("", ";ic:%d: %s", ic->key, iLine);
+ dbuf_free(iLine);
}
/* if the result is marked as
peepHole (&lineHead);
/* now do the actual printing */
- printLine (lineHead, codeOutFile);
+ printLine (lineHead, codeOutBuf);
return;
}