#define STRCASECMP strcasecmp
#endif
+/* this should go in SDCCicode.h, but it doesn't. */
+#define IS_REF(op) (IS_SYMOP(op) && op->operand.symOperand->isref == 1)
+
/*-----------------------------------------------------------------*/
/* At this point we start getting processor specific although */
/* some routines are non-processor specific & can be reused when */
//char *bufferP=buffer;
va_list ap;
- if (!debug || !srcFileName)
+ if (!debug || !dstFileName)
return;
if (!debugF)
{
/* create the file name */
- strcpy (buffer, srcFileName);
+ strcpy (buffer, dstFileName);
strcat (buffer, ".d");
if (!(debugF = fopen (buffer, (append ? "a+" : "w"))))
extern void assignFixedRegisters(set *regset);
extern void assignRelocatableRegisters(set *regset,int used);
extern void dump_map(void);
-extern void dump_cblock(FILE *of);
-
+extern void dump_sfr(FILE *of);
void packBits(set *bregs)
{
bitfield->isBitField = 1;
bitfield->isFixed = 1;
bitfield->address = breg->address;
- addSet(&dynDirectRegs,bitfield);
+ //addSet(&dynDirectRegs,bitfield);
+ addSet(&dynInternalRegs,bitfield);
//hTabAddItem(&dynDirectRegNames, regname2key(buffer), bitfield);
} else {
//fprintf(stderr," which is occupied by %s (addr = %d)\n",bitfield->name,bitfield->address);
//fprintf(stderr,"new relocatable bit field\n");
relocbitfield = newReg(REG_GPR, PO_GPR_BIT,rDirectIdx++,buffer,1,0);
relocbitfield->isBitField = 1;
- addSet(&dynDirectRegs,relocbitfield);
+ //addSet(&dynDirectRegs,relocbitfield);
+ addSet(&dynInternalRegs,relocbitfield);
//hTabAddItem(&dynDirectRegNames, regname2key(buffer), relocbitfield);
}
breg->rIdx & 0x0007);
else {
- fprintf(stderr, "bit field is not assigned to a register\n");
+ //fprintf(stderr, "bit field is not assigned to a register\n");
fprintf (of, "%s\tEQU\t( (bitfield%d<<3)+%d)\n",
breg->name,
bit_no>>3,
for (reg = setFirstItem(fregs) ; reg ;
reg = setNextItem(fregs)) {
- if(!reg->isEmitted && reg->wasUsed) {
+ //if(!reg->isEmitted && reg->wasUsed) {
+ if(reg->wasUsed) {
if(use_rIdx)
fprintf (of, "%s\tEQU\t0x%03x\n",
reg->name,
{
packBits(dynDirectBitRegs);
-
assignFixedRegisters(dynAllocRegs);
assignFixedRegisters(dynStackRegs);
assignFixedRegisters(dynDirectRegs);
assignRelocatableRegisters(dynInternalRegs,0);
assignRelocatableRegisters(dynAllocRegs,0);
assignRelocatableRegisters(dynStackRegs,0);
- assignRelocatableRegisters(dynDirectRegs,0);
+/*
+ assignRelocatableRegisters(dynDirectRegs,0);
+ printf("assignRelocatableRegisters(dynDirectRegs,0);\n");
+*/
//dump_map();
- dump_cblock(of);
+ dump_sfr(of);
bitEQUs(of,dynDirectBitRegs);
+/*
aliasEQUs(of,dynAllocRegs,0);
aliasEQUs(of,dynDirectRegs,0);
aliasEQUs(of,dynStackRegs,0);
aliasEQUs(of,dynProcessorRegs,1);
-
+*/
}
#if 0
/* if used in return only then we don't
need registers */
- if (sym->ruonly || sym->accuse) {
+ if (sym->accuse) {
if (IS_AGGREGATE (sym->type) || sym->isptr)
sym->type = aggrToPtr (sym->type, FALSE);
- debugLog (" %d - no reg needed - used as a return\n", __LINE__);
+ debugLog (" %d - no reg needed - accumulator used\n", __LINE__);
continue;
}
+ if (sym->ruonly) {
+ //if (IS_AGGREGATE (sym->type) || sym->isptr)
+ // sym->type = aggrToPtr (sym->type, FALSE);
+ debugLog (" %d - used as a return\n", __LINE__);
+
+ //continue;
+ }
+
/* if the symbol has only one definition &
that definition is a get_pointer and the
pointer we are getting is rematerializable and
if (!IS_ITEMP (IC_RIGHT (ic))) {
debugLog (" %d - not packing - right is not temp\n", __LINE__);
- allocDirReg(IC_RIGHT (ic));
+
+ /* only pack if this is not a function pointer */
+ if (!IS_REF (IC_RIGHT (ic)))
+ allocDirReg(IC_RIGHT (ic));
return 0;
}
remiCodeFromeBBlock (ebp, ic);
bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
- OP_DEFS (IC_RESULT (dic)) = bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
+ OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
return 1;
remiCodeFromeBBlock (ebp, ic);
bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
- OP_DEFS (IC_RESULT (dic)) = bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
+ OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
ic = ic->prev;
} else
bitVectUnSetBit(OP_SYMBOL(IC_RESULT(ic))->defs,ic->key);
remiCodeFromeBBlock (ebp, ic);
hTabDeleteItem (&iCodehTab, ic->key, ic, DELETE_ITEM, NULL);
- OP_DEFS (IC_RESULT (dic)) = bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
+ OP_DEFS(IC_RESULT (dic))=bitVectSetBit (OP_DEFS (IC_RESULT (dic)), dic->key);
ic = ic->prev;
}
}