-
- if (!bitVectBitValue(regAssigned,sym->key))
- continue;
-
- /* special case check if this is an IFX &
- the privious one was a pop and the
- previous one was not spilt then keep track
- of the symbol */
- if (ic->op == IFX && ic->prev &&
- ic->prev->op == IPOP &&
- !ic->prev->parmPush &&
- !OP_SYMBOL(IC_LEFT(ic->prev))->isspilt)
- psym = OP_SYMBOL(IC_LEFT(ic->prev));
-
- if (sym->nRegs) {
- int i = 0;
-
- bitVectUnSetBit(regAssigned,sym->key);
-
- /* if the result of this one needs registers
- and does not have it then assign it right
- away */
- if (IC_RESULT(ic) &&
- ! (SKIP_IC2(ic) || /* not a special icode */
- ic->op == JUMPTABLE ||
- ic->op == IFX ||
- ic->op == IPUSH ||
- ic->op == IPOP ||
- ic->op == RETURN) &&
- (result = OP_SYMBOL(IC_RESULT(ic))) && /* has a result */
- result->liveTo > ic->seq && /* and will live beyond this */
- result->liveTo <= ebp->lSeq && /* does not go beyond this block */
- result->regType == sym->regType && /* same register types */
- result->nRegs && /* which needs registers */
- ! result->isspilt && /* and does not already have them */
- ! result->remat &&
- ! bitVectBitValue(regAssigned,result->key) &&
- /* the number of free regs + number of regs in this LR
- can accomodate the what result Needs */
- ((nfreeRegsType(result->regType) +
- sym->nRegs) >= result->nRegs)
- ) {
-
- for (i = 0 ; i < max(sym->nRegs,result->nRegs) ; i++)
- if (i < sym->nRegs )
- result->regs[i] = sym->regs[i] ;
- else
- result->regs[i] = getRegGpr (ic,ebp,result);
-
- regAssigned = bitVectSetBit(regAssigned,result->key);
- }
-
- /* free the remaining */
- for (; i < sym->nRegs ; i++) {
- if (psym) {
- if (!symHasReg(psym,sym->regs[i]))
- freeReg(sym->regs[i]);
- } else
- freeReg(sym->regs[i]);
+
+ if (!bitVectBitValue (regAssigned, sym->key))
+ continue;
+
+ /* special case check if this is an IFX &
+ the privious one was a pop and the
+ previous one was not spilt then keep track
+ of the symbol */
+ if (ic->op == IFX && ic->prev &&
+ ic->prev->op == IPOP &&
+ !ic->prev->parmPush &&
+ !OP_SYMBOL (IC_LEFT (ic->prev))->isspilt)
+ psym = OP_SYMBOL (IC_LEFT (ic->prev));
+
+ D (D_ALLOC, ("deassignLRs: in loop on sym %p nregs %u\n", sym, sym->nRegs));
+
+ if (sym->nRegs)
+ {
+ int i = 0;
+
+ bitVectUnSetBit (regAssigned, sym->key);
+
+ /* if the result of this one needs registers
+ and does not have it then assign it right
+ away */
+ if (IC_RESULT (ic) &&
+ !(SKIP_IC2 (ic) || /* not a special icode */
+ ic->op == JUMPTABLE ||
+ ic->op == IFX ||
+ ic->op == IPUSH ||
+ ic->op == IPOP ||
+ ic->op == RETURN) &&
+ (result = OP_SYMBOL (IC_RESULT (ic))) && /* has a result */
+ result->liveTo > ic->seq && /* and will live beyond this */
+ result->liveTo <= ebp->lSeq && /* does not go beyond this block */
+ result->regType == sym->regType && /* same register types */
+ result->nRegs && /* which needs registers */
+ !result->isspilt && /* and does not already have them */
+ !result->remat &&
+ !bitVectBitValue (regAssigned, result->key) &&
+ /* the number of free regs + number of regs in this LR
+ can accomodate the what result Needs */
+ ((nfreeRegsType (result->regType) +
+ sym->nRegs) >= result->nRegs)
+ )
+ {
+ for (i = 0; i < result->nRegs; i++)
+ {
+ if (i < sym->nRegs)
+ result->regs[i] = sym->regs[i];
+ else
+ result->regs[i] = getRegGpr (ic, ebp, result);
+
+ /* if the allocation falied which means
+ this was spilt then break */
+ if (!result->regs[i])
+ {
+ wassert (0);
+ assert (0);
+ break;
+ }
+ }
+
+ regAssigned = bitVectSetBit (regAssigned, result->key);
+ }
+
+ /* free the remaining */
+ for (; i < sym->nRegs; i++)
+ {
+ if (psym)
+ {
+ if (!symHasReg (psym, sym->regs[i]))
+ freeReg (sym->regs[i]);
+ }
+ else
+ freeReg (sym->regs[i]);
+ // sym->regs[i] = NULL;