#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"
PCOI(aop->aopu.pcop)->_const = IN_CODESPACE(space);
PCOI(aop->aopu.pcop)->index = 0;
- DEBUGpic14_emitcode(";"," rname %s, val %d, const = %d",
- sym->rname, 0, PCOI(aop->aopu.pcop)->_const);
+ DEBUGpic14_emitcode(";","%d: rname %s, val %d, const = %d",
+ __LINE__,sym->rname, 0, PCOI(aop->aopu.pcop)->_const);
allocDirReg (IC_LEFT(ic));
PCOI(aop->aopu.pcop)->_const = IS_PTR_CONST(operandType(op));
PCOI(aop->aopu.pcop)->index = val;
- DEBUGpic14_emitcode(";"," rname %s, val %d, const = %d",
- OP_SYMBOL(IC_LEFT(ic))->rname,
+ DEBUGpic14_emitcode(";","%d: rname %s, val %d, const = %d",
+ __LINE__,OP_SYMBOL(IC_LEFT(ic))->rname,
val, IS_PTR_CONST(operandType(op)));
// DEBUGpic14_emitcode(";","aop type %s",AopType(AOP_TYPE(IC_LEFT(ic))));
if(!aop)
return;
+ DEBUGpic14_emitcode ("; ***","%s %d offset=%d",__FUNCTION__,__LINE__,offset);
+
if ( aop->type == AOP_PCODE ||
aop->type == AOP_LIT )
emitpcode(POC_MOVLW,popGet(aop,offset));
/* don't crash result[offr] */
MOVA(aopGet(AOP(left),offl,FALSE,FALSE));
pic14_emitcode("xch","a,%s", aopGet(AOP(left),offl+MSB16,FALSE,FALSE));
- } else {
+ }
+/* else {
movLeft2Result(left,offl, result, offr);
MOVA(aopGet(AOP(left),offl+MSB16,FALSE,FALSE));
}
+*/
/* a:x >> shCount (x = lsb(result))*/
/*
if(sign)
emitpcode(POC_MOVWF,popGet(AOP(result),offr+MSB16));
emitpcode(POC_RLFW, popGet(AOP(left),offl+MSB16));
emitpcode(POC_MOVWF,popGet(AOP(result),offr));
- emitpcode(POC_RLFW, popGet(AOP(result),offr+MSB16));
+ emitpcode(POC_RLF, popGet(AOP(result),offr+MSB16));
+ emitpcode(POC_RLF, popGet(AOP(result),offr));
+ emitpcode(POC_RLFW, popGet(AOP(result),offr+MSB16));
emitpcode(POC_ANDLW,popGetLit(0x03));
if(sign) {
emitpcode(POC_BTFSC,
newpCodeOpBit(aopGet(AOP(result),offr+MSB16,FALSE,FALSE),0,0));
emitpcode(POC_IORLW,popGetLit(0xfc));
}
- emitpcode(POC_MOVWF,popGet(AOP(result),offr));
- emitpcode(POC_RLF, popGet(AOP(result),offr));
+ emitpcode(POC_MOVWF,popGet(AOP(result),offr+MSB16));
+ //emitpcode(POC_RLF, popGet(AOP(result),offr));
}
/* hack hack! see if this the FSR. If so don't load W */
if(AOP_TYPE(right) != AOP_ACC) {
+
emitpcode(POC_MOVFW,popGet(AOP(result),0));
emitpcode(POC_MOVWF,popCopyReg(&pc_fsr));
+ if(AOP_SIZE(result) > 1) {
+ emitpcode(POC_BCF, popCopyGPR2Bit(PCOP(&pc_status),PIC_IRP_BIT));
+ emitpcode(POC_BTFSC,newpCodeOpBit(aopGet(AOP(result),1,FALSE,FALSE),0,0));
+ emitpcode(POC_BSF, popCopyGPR2Bit(PCOP(&pc_status),PIC_IRP_BIT));
+
+ }
+
//if(size==2)
//emitpcode(POC_DECF,popCopyReg(&pc_fsr));
//if(size==4) {
pic14_emitcode ("", ";\t%s:%d: %s", ic->filename, ic->lineno,
printCLine(ic->filename, ic->lineno));
*/
- addpCode2pBlock(pb,
- newpCodeCSource(ic->lineno,
- ic->filename,
- printCLine(ic->filename, ic->lineno)));
+ if (!options.noCcodeInAsm) {
+ addpCode2pBlock(pb,
+ newpCodeCSource(ic->lineno,
+ ic->filename,
+ printCLine(ic->filename, ic->lineno)));
+ }
cln = ic->lineno ;
}
+
+ // if you want printILine too, look at ../mcs51/gen.c, i don't understand this :)
+
/* if the result is marked as
spilt and rematerializable or code for
this has already been generated then