Changeset View
Changeset View
Standalone View
Standalone View
lib/CodeGen/CalcSpillWeights.cpp
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | if (unsigned hint = hintPhys ? hintPhys : hintVirt) { | ||||
// Weakly boost the spill weight of hinted registers. | // Weakly boost the spill weight of hinted registers. | ||||
totalWeight *= 1.01F; | totalWeight *= 1.01F; | ||||
} | } | ||||
// If the live interval was already unspillable, leave it that way. | // If the live interval was already unspillable, leave it that way. | ||||
if (!Spillable) | if (!Spillable) | ||||
return; | return; | ||||
// Mark li as unspillable if all live ranges are tiny. | // Mark li as unspillable if all live ranges are tiny and the interval | ||||
if (li.isZeroLength(LIS.getSlotIndexes())) { | // does not contain any reg masks (which may require spilling). | ||||
if (li.isZeroLength(LIS.getSlotIndexes()) && | |||||
!li.containsRegMask(LIS.getRegMaskSlots())) { | |||||
li.markNotSpillable(); | li.markNotSpillable(); | ||||
return; | return; | ||||
} | } | ||||
// If all of the definitions of the interval are re-materializable, | // If all of the definitions of the interval are re-materializable, | ||||
// it is a preferred candidate for spilling. | // it is a preferred candidate for spilling. | ||||
// FIXME: this gets much more complicated once we support non-trivial | // FIXME: this gets much more complicated once we support non-trivial | ||||
// re-materialization. | // re-materialization. | ||||
if (isRematerializable(li, LIS, VRM, *MF.getSubtarget().getInstrInfo())) | if (isRematerializable(li, LIS, VRM, *MF.getSubtarget().getInstrInfo())) | ||||
totalWeight *= 0.5F; | totalWeight *= 0.5F; | ||||
li.weight = normalize(totalWeight, li.getSize(), numInstr); | li.weight = normalize(totalWeight, li.getSize(), numInstr); | ||||
} | } |