/* since the pack the registers depending strictly on the MCU */
/*-----------------------------------------------------------------*/
+#define D(x)
+
/* Global data */
static struct
{
{REG_GPR, R7_IDX, REG_GPR, "r7", "ar7", "0", 7, 1, 1},
{REG_PTR, R0_IDX, REG_PTR, "r0", "ar0", "0", 0, 1, 1},
{REG_PTR, R1_IDX, REG_PTR, "r1", "ar1", "0", 1, 1, 1},
+ {REG_GPR, DPL_IDX, REG_GPR, "dpl", "dpl", "dpl", 0, 0, 0},
+ {REG_GPR, DPH_IDX, REG_GPR, "dph", "dph", "dph", 0, 0, 0},
+ {REG_GPR, DPX_IDX, REG_GPR, "dpx", "dpx", "dpx", 0, 0, 0},
+ {REG_GPR, B_IDX, REG_GPR, "b", "b", "b", 0, 0, 0},
{REG_GPR, X8_IDX, REG_GPR, "x8", "x8", "xreg", 0, 0, 0},
{REG_GPR, X9_IDX, REG_GPR, "x9", "x9", "xreg", 1, 0, 0},
{REG_GPR, X10_IDX, REG_GPR, "x10", "x10", "xreg", 2, 0, 0},
{REG_GPR, X11_IDX, REG_GPR, "x11", "x11", "xreg", 3, 0, 0},
{REG_GPR, X12_IDX, REG_GPR, "x12", "x12", "xreg", 4, 0, 0},
{REG_CND, CND_IDX, REG_GPR, "C", "C", "xreg", 0, 0, 0},
- {REG_GPR, DPL_IDX, REG_GPR, "dpl", "dpl", "dpl", 0, 0, 0},
- {REG_GPR, DPH_IDX, REG_GPR, "dph", "dph", "dph", 0, 0, 0},
- {REG_GPR, DPX_IDX, REG_GPR, "dpx", "dpx", "dpx", 0, 0, 0},
- {REG_GPR, B_IDX, REG_GPR, "b", "b", "b", 0, 0, 0},
};
int ds390_nRegs = 13;
static void spillThis (symbol *);
/* First try to do DPTRuse once more since now we know what got into
registers */
-#if 1
+
for (sym = hTabFirstItem(liveRanges,&key) ; sym ;
sym = hTabNextItem(liveRanges,&key)) {
if (sym->uptr && !sym->ruonly && getSize(sym->type) < 4) {
if (packRegsDPTRuse(operandFromSymbol(sym))) {
- printf("FILL GAPS: found more DPTR use for %s in func %s\n",sym->name, currFunc ? currFunc->name : "UNKNOWN");
+ D (fprintf (stderr, "FILL GAPS: found more DPTR use for "
+ "%s in func %s\n",
+ sym->name, currFunc ? currFunc->name : "UNKNOWN"));
/* if this was ssigned to registers then */
if (bitVectBitValue(_G.totRegAssigned,sym->key)) {
}
}
}
-#endif
+
/* look for livernages that was spilt by the allocator */
for (sym = hTabFirstItem(liveRanges,&key) ; sym ;
sym = hTabNextItem(liveRanges,&key)) {
sym->regs[i] = NULL;
}
freeAllRegs();
- printf("Fill Gap gave up due to positioning for %s in function %s\n",sym->name, currFunc ? currFunc->name : "UNKNOWN");
+ D (fprintf (stderr, "Fill Gap gave up due to positioning for "
+ "%s in function %s\n",
+ sym->name, currFunc ? currFunc->name : "UNKNOWN"));
continue ;
}
- printf("FILLED GAP for %s in function %s\n",sym->name, currFunc ? currFunc->name : "UNKNOWN");
+ D (fprintf (stderr, "FILLED GAP for %s in function %s\n",
+ sym->name, currFunc ? currFunc->name : "UNKNOWN"));
_G.totRegAssigned = bitVectSetBit(_G.totRegAssigned,sym->key);
sym->isspilt = sym->spillA = 0 ;
sym->usl.spillLoc->allocreq--;
/*-----------------------------------------------------------------*/
/* rUmaskForOp :- returns register mask for an operand */
/*-----------------------------------------------------------------*/
-static bitVect *
-rUmaskForOp (operand * op)
+bitVect *
+ds390_rUmaskForOp (operand * op)
{
bitVect *rumask;
symbol *sym;
if (ic->op == IFX)
{
rmask = bitVectUnion (rmask,
- rUmaskForOp (IC_COND (ic)));
+ ds390_rUmaskForOp (IC_COND (ic)));
goto ret;
}
if (ic->op == JUMPTABLE)
{
rmask = bitVectUnion (rmask,
- rUmaskForOp (IC_JTCOND (ic)));
+ ds390_rUmaskForOp (IC_JTCOND (ic)));
goto ret;
}
/* of all other cases */
if (IC_LEFT (ic))
rmask = bitVectUnion (rmask,
- rUmaskForOp (IC_LEFT (ic)));
+ ds390_rUmaskForOp (IC_LEFT (ic)));
if (IC_RIGHT (ic))
rmask = bitVectUnion (rmask,
- rUmaskForOp (IC_RIGHT (ic)));
+ ds390_rUmaskForOp (IC_RIGHT (ic)));
if (IC_RESULT (ic))
rmask = bitVectUnion (rmask,
- rUmaskForOp (IC_RESULT (ic)));
+ ds390_rUmaskForOp (IC_RESULT (ic)));
ret:
return rmask;
/* if PCALL cannot be sure give up */
if (ic->op == PCALL) return NULL;
- /* if CALL then make sure it is VOID || return value not used */
+ /* if CALL then make sure it is VOID || return value not used
+ or the return value is assigned to this one */
if (ic->op == CALL) {
if (OP_SYMBOL(IC_RESULT(ic))->liveTo ==
OP_SYMBOL(IC_RESULT(ic))->liveFrom) continue ;
etype = getSpec(type = operandType(IC_RESULT(ic)));
- if (getSize(type) == 0) continue ;
+ //if (getSize(type) == 0 || isOperandEqual(op,IC_RESULT(ic)))
+ if (getSize(type) == 0)
+ continue ;
return NULL ;
}
/* special case of add with a [remat] */
if (ic->op == '+' &&
OP_SYMBOL(IC_LEFT(ic))->remat &&
- (!isOperandInFarSpace(IC_RIGHT(ic)) ||
- isOperandInReg(IC_RIGHT(ic)))) continue ;
+ (isOperandInFarSpace(IC_RIGHT(ic)) &&
+ !isOperandInReg(IC_RIGHT(ic)))) return NULL ;
/* special cases */
/* pointerGet */
if (POINTER_GET (ic))
OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
+ if (ic->op == RETURN && IS_SYMOP (IC_LEFT(ic)))
+ OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
+
if (!SKIP_IC2 (ic))
{
/* if we are using a symbol on the stack
setToNull ((void *) &_G.totRegAssigned);
setToNull ((void *) &_G.funcrUsed);
ds390_ptrRegReq = _G.stackExtend = _G.dataExtend = 0;
- ds390_nRegs = 18;
+ ds390_nRegs = 12;
if (options.model != MODEL_FLAT24) options.stack10bit = 0;
/* change assignments this will remove some
live ranges reducing some register pressure */
ds390_nRegs = 8;
freeAllRegs ();
fillGaps();
- ds390_nRegs = 18;
+ ds390_nRegs = 12;
/* if stack was extended then tell the user */
if (_G.stackExtend)