#include "gen.h"
char *aopLiteral (value *val, int offset);
+extern int allocInfo;
/* this is the down and dirty file with all kinds of
kludgy & hacky stuff. This is what it is all about
IC_RESULT(x)->aop->type == AOP_STK )
#define MOVA(x) if (strcmp(x,"a") && strcmp(x,"acc")) emitcode("mov","a,%s",x);
-#define CLRC emitcode("clr","c");
+#define CLRC emitcode("clr","c")
+#define SETC emitcode("setb","c")
static lineNode *lineHead = NULL;
static lineNode *lineCurr = NULL;
/* otherwise subtract from zero */
size = AOP_SIZE(IC_LEFT(ic));
offset = 0 ;
- CLRC ;
+ //CLRC ;
while(size--) {
char *l = aopGet(AOP(IC_LEFT(ic)),offset,FALSE,FALSE);
if (!strcmp(l,"a")) {
- emitcode("cpl","a");
- emitcode("inc","a");
+ if (offset==0)
+ SETC;
+ emitcode("cpl","a");
+ emitcode("addc","a,#0");
} else {
- emitcode("clr","a");
- emitcode("subb","a,%s",l);
+ if (offset==0)
+ CLRC;
+ emitcode("clr","a");
+ emitcode("subb","a,%s",l);
}
aopPut(AOP(IC_RESULT(ic)),"a",offset++);
}
if (IS_RENT(sym->etype) || options.stackAuto) {
if (options.useXstack) {
+ /* set up the PAGE for the xternal stack */
+ if (sym->args) {
+ emitcode("push","dph");
+ emitcode("push","acc");
+ }
+ emitcode("mov","dph,__page_no__");
+ emitcode("movx","a,@dptr");
+ if (sym->args) {
+ emitcode("pop","acc");
+ emitcode("pop","dph");
+ }
emitcode("mov","r0,%s",spname);
emitcode("mov","a,_bp");
emitcode("movx","@r0,a");
}
release:
- freeAsmop (right,NULL,ic,FALSE);
+ freeAsmop (right,NULL,ic,TRUE);
freeAsmop (result,NULL,ic,TRUE);
}
{
operand *result = IC_RESULT(ic);
link *ctype = operandType(IC_LEFT(ic));
+ link *rtype = operandType(IC_RIGHT(ic));
operand *right = IC_RIGHT(ic);
int size, offset ;
else {
/* we have to go by the storage class */
p_type = PTR_TYPE(SPEC_OCLS(etype));
-
-/* if (SPEC_OCLS(etype)->codesp ) */
-/* p_type = CPOINTER ; */
-/* else */
-/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */
-/* p_type = FPOINTER ; */
-/* else */
-/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */
-/* p_type = PPOINTER; */
-/* else */
-/* if (SPEC_OCLS(etype) == idata ) */
-/* p_type = IPOINTER ; */
-/* else */
-/* p_type = POINTER ; */
}
/* the first two bytes are known */
offset++;
}
- /* now depending on the sign of the destination */
+ /* now depending on the sign of the source && destination */
size = AOP_SIZE(result) - AOP_SIZE(right);
/* if unsigned or not an integral type */
- if (SPEC_USIGN(ctype) || !IS_SPEC(ctype)) {
+ if (SPEC_USIGN(rtype) || !IS_SPEC(rtype)) {
while (size--)
aopPut(AOP(result),zero,offset++);
} else {
lineHead = lineCurr = NULL;
+ /* print the allocation information */
+ if (allocInfo)
+ printAllocInfo( currFunc, codeOutFile);
/* if debug information required */
/* if (options.debug && currFunc) { */
if (currFunc) {
peepHole (&lineHead);
/* now do the actual printing */
- printLine (lineHead,codeOutFile);
+ printLine (lineHead,codeOutFile);
return;
}