#include "SDCCglobl.h"
#include "newalloc.h"
-#ifdef HAVE_SYS_ISA_DEFS_H
-#include <sys/isa_defs.h>
-#else
-#ifdef HAVE_MACHINE_ENDIAN_H
-#include <machine/endian.h>
-#else
-#ifdef HAVE_ENDIAN_H
-#include <endian.h>
-#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-#warning "Cannot determine ENDIANESS of this machine assuming LITTLE_ENDIAN"
-#warning "If you running sdcc on an INTEL 80x86 Platform you are okay"
-#endif
-#endif
-#endif
-#endif
-
#include "common.h"
#include "SDCCpeeph.h"
#include "ralloc.h"
sprintf (aop->name[1], "#0");
break;
case 4:
- sprintf (aop->name[0], "#0x%04lx",
+ sprintf (aop->name[0], "#0x%04x",
SPEC_CVAL(operandType(op)).v_ulong & 0xffff);
- sprintf (aop->name[1], "#0x%04lx",
+ sprintf (aop->name[1], "#0x%04x",
SPEC_CVAL(operandType(op)).v_ulong >> 16);
break;
default:
break;
case V_INT:
if (SPEC_LONG(OP_VALUE(op)->type)) {
- sprintf (opName, "#%s0x%02lx", decorate?"(long)":"",
+ sprintf (opName, "#%s0x%02x", decorate?"(long)":"",
SPEC_CVAL(OP_VALUE(op)->type).v_long);
} else {
sprintf (opName, "#%s0x%02x", decorate?"(int)":"",
printIc (0, "genReceive", ic, 1,0,0);
}
+/*-----------------------------------------------------------------*/
+/* genDummyRead - generate code for dummy read of volatiles */
+/*-----------------------------------------------------------------*/
+static void
+genDummyRead (iCode * ic)
+{
+ emitcode ("; genDummyRead","");
+
+ ic = ic;
+}
+
/*-----------------------------------------------------------------*/
/* gen51Code - generate code for 8051 based controllers */
/*-----------------------------------------------------------------*/
void genXA51Code (iCode * lic) {
iCode *ic;
int cln = 0;
-
+
lineHead = lineCurr = NULL;
-
+
/* if debug information required */
if (options.debug && currFunc)
{
- cdbSymbol (currFunc, cdbFile, FALSE, TRUE);
+ debugFile->writeFunction(currFunc);
_G.debugLine = 1;
if (IS_STATIC (currFunc->etype))
emitcode ("", "F%s$%s$0$0 ==.", moduleName, currFunc->name);
emitcode ("", "G$%s$0$0 ==.", currFunc->name);
_G.debugLine = 0;
}
-
+
for (ic = lic; ic; ic = ic->next) {
if (ic->lineno && cln != ic->lineno) {
if (options.debug) {
_G.debugLine = 0;
}
if (!options.noCcodeInAsm) {
- emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
+ 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
do nothing */
if (resultRemat (ic) || ic->generated)
continue;
-
+
/* depending on the operation */
switch (ic->op)
{
case '!':
genNot (ic);
break;
-
+
case '~':
genCpl (ic);
break;
-
+
case UNARYMINUS:
genUminus (ic);
break;
case RLC:
genRLC (ic);
break;
-
+
case GETHBIT:
genGetHbit (ic);
break;
case RECEIVE:
genReceive (ic);
break;
-
+
case SEND:
addSet (&_G.sendSet, ic);
break;
-
+
+ case DUMMY_READ_VOLATILE:
+ genDummyRead (ic);
+ break;
+
default:
ic = ic;
}
}
-
-
+
+
/* now we are ready to call the
peep hole optimizer */
if (!options.nopeep)
peepHole (&lineHead);
-
+
/* now do the actual printing */
printLine (lineHead, codeOutFile);
return;