#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"
/* if the registers have been saved already or don't need to be then
do nothing */
- if (ic->regsSaved || IFFUNC_CALLEESAVES(OP_SYMBOL(IC_LEFT(ic))->type) ||
- IFFUNC_ISNAKED(OP_SYM_TYPE(IC_LEFT (ic))))
+ if (ic->regsSaved)
return;
-
+ if (IS_SYMOP(IC_LEFT(ic)) &&
+ (IFFUNC_CALLEESAVES(OP_SYMBOL(IC_LEFT(ic))->type) ||
+ IFFUNC_ISNAKED(OP_SYM_TYPE(IC_LEFT (ic)))))
+ return;
+
/* safe the registers in use at this time but skip the
ones for the result */
rsave = bitVectCplAnd (bitVectCopy (ic->rMask),
}
}
}
- // 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));
AOP_TYPE (right) == AOP_CRY)
{
emitcode ("mov", "c,%s", AOP (right)->aopu.aop_dir);
- emitcode ("anl", "c,/%s", AOP (left)->aopu.aop_dir);
+ emitcode ("anl", "c,%s", AOP (left)->aopu.aop_dir);
}
else
{
while (size--)
{
- emitcode ("clr", "a");
- emitcode ("movc", "a,@a+dptr");
- aopPut (AOP (result), "a", offset++);
- if (size || pi)
- emitcode ("inc", "dptr");
+ if (pi)
+ {
+ emitcode ("clr", "a");
+ emitcode ("movc", "a,@a+dptr");
+ aopPut (AOP (result), "a", offset++);
+ emitcode ("inc", "dptr");
+ }
+ else
+ {
+ emitcode ("mov", "a,#0x%02x", offset);
+ emitcode ("movc", "a,@a+dptr");
+ aopPut (AOP (result), "a", offset++);
+ }
}
}
/* 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);