]> git.gag.com Git - fw/sdcc/blobdiff - src/mcs51/gen.c
cleaned up the mess I left behind
[fw/sdcc] / src / mcs51 / gen.c
index d58f60d6bb7348ea26c5c86c03644f18ff2afce7..638ad61b894cb75cc840cdc961b8f3e3cbd4b0e4 100644 (file)
 #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"
@@ -2434,7 +2417,7 @@ genFunction (iCode * ic)
                     }
                }
            }
-           // jwk: this needs a closer look
+           // TODO: this needs a closer look
            SPEC_ISR_SAVED_BANKS(currFunc->etype) = banksToSave;
        }
     }
@@ -2659,7 +2642,6 @@ genEndFunction (iCode * ic)
             * 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;
          
@@ -2889,8 +2871,8 @@ genPlusIncr (iCode * ic)
 
   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))
@@ -3249,8 +3231,8 @@ genMinusDec (iCode * ic)
 
   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))
@@ -3468,9 +3450,7 @@ genMinus (iCode * ic)
          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));