#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"
return rs;
case AOP_DPTR:
+ if (aop->code && aop->coff==0 && offset>=1) {
+ emitcode ("mov", "a,#0x%02x", offset);
+ emitcode ("movc", "a,@a+dptr");
+ return (dname ? "acc" : "a");
+ }
+
while (offset > aop->coff)
{
emitcode ("inc", "dptr");
D(emitcode ("; genUminusFloat",""));
- /* for this we just need to flip the
- first it then copy the rest in place */
- size = AOP_SIZE (op) - 1;
- l = aopGet (AOP (op), 3, FALSE, FALSE);
+ /* for this we just copy and then flip the bit */
- MOVA (l);
-
- emitcode ("cpl", "acc.7");
- aopPut (AOP (result), "a", 3);
+ size = AOP_SIZE (op) - 1;
while (size--)
{
offset);
offset++;
}
+
+ l = aopGet (AOP (op), offset, FALSE, FALSE);
+
+ MOVA (l);
+
+ emitcode ("cpl", "acc.7");
+ aopPut (AOP (result), "a", offset);
}
/*-----------------------------------------------------------------*/
}
}
}
- // jwk: this needs a closer look
+ // TODO: this needs a closer look
SPEC_ISR_SAVED_BANKS(currFunc->etype) = banksToSave;
}
}
* Restore any register banks saved by genFunction
* in reverse order.
*/
- // jwk: this needs a closer look
unsigned savedBanks = SPEC_ISR_SAVED_BANKS(currFunc->etype);
int ix;
D(emitcode ("; genPlusIncr",""));
- /* if increment 16 bits in register */
- if (AOP_TYPE(IC_LEFT(ic)) == AOP_REG &&
+ /* if increment >=16 bits in register or direct space */
+ if ((AOP_TYPE(IC_LEFT(ic)) == AOP_REG || AOP_TYPE(IC_LEFT(ic)) == AOP_DIR ) &&
sameRegs (AOP (IC_LEFT (ic)), AOP (IC_RESULT (ic))) &&
(size > 1) &&
(icount == 1))
D(emitcode ("; genMinusDec",""));
- /* if decrement 16 bits in register */
- if (AOP_TYPE(IC_LEFT(ic)) == AOP_REG &&
+ /* if decrement >=16 bits in register or direct space */
+ if ((AOP_TYPE(IC_LEFT(ic)) == AOP_REG || AOP_TYPE(IC_LEFT(ic)) == AOP_DIR) &&
sameRegs (AOP (IC_LEFT (ic)), AOP (IC_RESULT (ic))) &&
(size > 1) &&
(icount == 1))
if (aopGetUsesAcc(rightOp, offset)) {
wassertl(!aopGetUsesAcc(leftOp, offset), "accumulator clash");
MOVA (aopGet(rightOp, offset, FALSE, TRUE));
- if (offset > 0) {
- emitcode( "cpl", "c");
- } else {
+ if (offset == 0) {
emitcode( "setb", "c");
}
emitcode("subb", "a,%s", aopGet(leftOp, offset, FALSE, TRUE));
char *l;
symbol *tlbl, *tlbl1;
- D(emitcode ("; genLeftShift",""));
+ D(emitcode ("; genLeftShift",""));
right = IC_RIGHT (ic);
left = IC_LEFT (ic);
else if (shCount >= (size * 8))
{
- if (sign)
+ if (sign) {
/* get sign in acc.7 */
MOVA (aopGet (AOP (left), size - 1, FALSE, FALSE));
+ }
addSign (result, LSB, sign);
}
else
default:
break;
}
-
- freeAsmop (left, NULL, ic, TRUE);
- freeAsmop (result, NULL, ic, TRUE);
}
+ freeAsmop (left, NULL, ic, TRUE);
+ freeAsmop (result, NULL, ic, TRUE);
}
/*-----------------------------------------------------------------*/
right = IC_RIGHT (ic);
/* if they are the same */
- if (operandsEqu (IC_RESULT (ic), IC_RIGHT (ic)))
+ if (operandsEqu (result, right)) {
return;
+ }
aopOp (right, ic, FALSE);
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