Made everything static
-------------------------------------------------------------------------*/
-#define D
+#define D(x)
//#define D(x) x
#include <stdio.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#else
-#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(__MINGW32__)
+#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
/* first check if r0 & r1 are used by this
instruction, in which case we are in trouble */
- if ((r0iu = bitVectBitValue (ic->rUsed, R0_IDX)) &&
- (r1iu = bitVectBitValue (ic->rUsed, R1_IDX)))
- {
+ r0iu = bitVectBitValue (ic->rUsed, R0_IDX);
+ r1iu = bitVectBitValue (ic->rUsed, R1_IDX);
+ if (r0iu && r1iu) {
goto endOfWorld;
}
/* other wise this is true end of the world */
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"getFreePtr should never reach here");
- exit (0);
+ exit (1);
}
/*-----------------------------------------------------------------*/
aopForSym (iCode * ic, symbol * sym, bool result)
{
asmop *aop;
- memmap *space = SPEC_OCLS (sym->etype);
+ memmap *space;
+
+ wassertl (ic != NULL, "Got a null iCode");
+ wassertl (sym != NULL, "Got a null symbol");
+
+ space = SPEC_OCLS (sym->etype);
/* if already has one */
if (sym->aop)
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"aopget got unsupported aop->type");
- exit (0);
+ exit (1);
}
/*-----------------------------------------------------------------*/
/* aopPut - puts a string for a aop */
{
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"aopPut got offset > aop->size");
- exit (0);
+ exit (1);
}
/* will assign value to value */
{
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"aopPut writting to code space");
- exit (0);
+ exit (1);
}
while (offset > aop->coff)
default:
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"aopPut got unsupported aop->type");
- exit (0);
+ exit (1);
}
}
else
{
/* first add without previous c */
- if (!offset)
- emitcode ("add", "a,#0x%02x",
- (unsigned int) (lit & 0x0FFL));
- else
+ if (!offset) {
+ if (!size && lit==-1) {
+ emitcode ("dec", "a");
+ } else {
+ emitcode ("add", "a,#0x%02x",
+ (unsigned int) (lit & 0x0FFL));
+ }
+ } else {
emitcode ("addc", "a,#0x%02x",
(unsigned int) ((lit >> (offset * 8)) & 0x0FFL));
+ }
}
aopPut (AOP (IC_RESULT (ic)), "a", offset++);
}
}
else
rname = aopGet (AOP (left), 0, FALSE, FALSE);
-
- aopOp (result, ic, FALSE);
+
+ //aopOp (result, ic, FALSE);
+ aopOp (result, ic, result?TRUE:FALSE);
/* if bitfield then unpack the bits */
if (IS_BITVAR (retype))
genDataPointerSet (right, result, ic);
return;
}
-
+
/* if the value is already in a pointer register
then don't need anything more */
if (!AOP_INPREG (AOP (result)))
int size, offset;
unsigned long lit = 0L;
+ D(emitcode(";","genAssign"));
+
result = IC_RESULT (ic);
right = IC_RIGHT (ic);