[llvm-commits] [patch] Remove the TargetRegisterClass from CalleeSavedInfo

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jun 2 10:22:18 PDT 2010

On Jun 2, 2010, at 9:33 AM, Rafael Espindola wrote:

> One more cleanup. If a register is callee saved, it always saves the
> full register, so we don't need the class to be present in
> CalleeSavedInfo.

@@ -251,7 +251,9 @@ void MipsRegisterInfo::adjustMipsStackFrame(MachineFunction &MF) const
   StackOffset = ((StackOffset+StackAlign-1)/StackAlign*StackAlign);
   for (unsigned i = 0, e = CSI.size(); i != e ; ++i) {
-    if (CSI[i].getRegClass() != Mips::CPURegsRegisterClass)
+    unsigned Reg = CSI[i].getReg();
+    const TargetRegisterClass *RC = getMinimalPhysRegClass(Reg);
+    if (RC != Mips::CPURegsRegisterClass)
     MFI->setObjectOffset(CSI[i].getFrameIdx(), StackOffset);
     TopCPUSavedRegOff = StackOffset;

This kind of thing is usually not what you want. Please do as you did for ARM: Mips::CPURegsRegisterClass->contains(Reg)

Same issue with the PPC and SystemZ changes. As a general rule it is a mistake to test register class identity. You almost always want "is register in", or "is a subclass of" comparisons.


More information about the llvm-commits mailing list