/*-------------------------------------------------------------------------
- avrgen.c - source file for code generation for ATMEL AVR
+ gen.c - source file for code generation for ATMEL AVR
Written By - Sandeep Dutta . sandeep.dutta@usa.net (2000)
#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"
va_end (ap);
}
+/*-----------------------------------------------------------------*/
+/* avr_emitDebuggerSymbol - associate the current code location */
+/* with a debugger symbol */
+/*-----------------------------------------------------------------*/
+void
+avr_emitDebuggerSymbol (char * debugSym)
+{
+ _G.debugLine = 1;
+ emitcode ("", "%s ==.", debugSym);
+ _G.debugLine = 0;
+}
+
/*-----------------------------------------------------------------*/
/* hasInc - operand is incremented before any other use */
/*-----------------------------------------------------------------*/
return lic;
}
/* 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;
}
lic = lic->next;
genCall (iCode * ic)
{
- /* if send set is not empty the assign */
+ /* if send set is not empty then assign */
if (_G.sendSet) {
iCode *sic;
int rnum = 16;
if (IFFUNC_ISCRITICAL (sym->type))
emitcode ("sti", "");
+ if (options.debug && currFunc) {
+ debugFile->writeEndFunction (currFunc, ic, 1);
+ }
+
if (IFFUNC_ISISR (sym->type)) {
emitcode ("rti", "");
}
exit(1);
}
- sprintf(gpValStr, "#0x%d", gpVal);
+ sprintf(gpValStr, "#0x%x", gpVal);
aopPut (AOP (result), gpValStr, GPTRSIZE - 1);
}
goto release;
freeAsmop (IC_RESULT (ic), NULL, ic, TRUE);
}
+/*-----------------------------------------------------------------*/
+/* genDummyRead - generate code for dummy read of volatiles */
+/*-----------------------------------------------------------------*/
+static void
+genDummyRead (iCode * ic)
+{
+ emitcode ("; genDummyRead","");
+ emitcode ("; not implemented","");
+
+ ic = ic;
+}
+
/*-----------------------------------------------------------------*/
/* gen51Code - generate code for 8051 based controllers */
/*-----------------------------------------------------------------*/
if (allocInfo)
printAllocInfo (currFunc, codeOutFile);
/* if debug information required */
- /* if (options.debug && currFunc) { */
- if (currFunc) {
- cdbSymbol (currFunc, cdbFile, FALSE, TRUE);
- _G.debugLine = 1;
-/* emitcode ("", ".type %s,@function", currFunc->name); */
- _G.debugLine = 0;
+ if (options.debug && currFunc) {
+ debugFile->writeFunction (currFunc, lic);
}
/* stack pointer name */
spname = "sp";
if (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);
}
emitcode (";", "%s %d", ic->filename, ic->lineno);
cln = ic->lineno;
addSet (&_G.sendSet, ic);
break;
+ case DUMMY_READ_VOLATILE:
+ genDummyRead (ic);
+ break;
+
default:
ic = ic;
}