/* Mark a temp register as dead. Does not affect allocation state. */
void Clobber(RegStorage reg);
void ClobberSReg(int s_reg);
- void ClobberAliases(RegisterInfo* info);
+ void ClobberAliases(RegisterInfo* info, uint32_t clobber_mask);
int SRegToPMap(int s_reg);
void RecordCorePromotion(RegStorage reg, int s_reg);
RegStorage AllocPreservedCoreReg(int s_reg);
}
ClobberBody(info);
if (info->IsAliased()) {
- ClobberAliases(info);
+ ClobberAliases(info, info->StorageMask());
} else {
RegisterInfo* master = info->Master();
if (info != master) {
ClobberBody(info->Master());
+ ClobberAliases(info->Master(), info->StorageMask());
}
}
}
}
}
-void Mir2Lir::ClobberAliases(RegisterInfo* info) {
+void Mir2Lir::ClobberAliases(RegisterInfo* info, uint32_t clobber_mask) {
for (RegisterInfo* alias = info->GetAliasChain(); alias != nullptr;
alias = alias->GetAliasChain()) {
DCHECK(!alias->IsAliased()); // Only the master should be marked as alised.
- ClobberBody(alias);
+ // Only clobber if we have overlap.
+ if ((alias->StorageMask() & clobber_mask) != 0) {
+ ClobberBody(alias);
+ }
}
}
}
ClobberBody(info);
if (info->IsAliased()) {
- ClobberAliases(info);
+ ClobberAliases(info, info->StorageMask());
}
}
}
// If I'm live, master should not be live, but should show liveness in alias set.
DCHECK_EQ(info->Master()->SReg(), INVALID_SREG);
DCHECK(!info->Master()->IsDead());
- } else if (!info->IsDead()) {
- // If I'm not live, but there is liveness in the set master must be live.
- DCHECK_EQ(info->SReg(), INVALID_SREG);
- DCHECK(info->Master()->IsLive());
}
+// TODO: Add checks in !info->IsDead() case to ensure every live bit is owned by exactly 1 reg.
}
if (info->IsAliased()) {
// Has child aliases.