[MIPS] Expose the ZERO register as a constant physical register

The ZERO register should be exposed as a constant physical register through the interface TargetRegisterInfo::isConstantPhysReg.

Differential Revision: https://reviews.llvm.org/D130932
This commit is contained in:
Guozhi Wei 2022-08-02 17:04:52 +00:00
parent da38bcfd52
commit 85a6dd50ad
2 changed files with 6 additions and 0 deletions

View File

@ -318,3 +318,7 @@ bool MipsRegisterInfo::canRealignStack(const MachineFunction &MF) const {
// sized objects.
return MF.getRegInfo().canReserveReg(BP);
}
bool MipsRegisterInfo::isConstantPhysReg(MCRegister PhysReg) const {
return PhysReg == Mips::ZERO_64 || PhysReg == Mips::ZERO;
}

View File

@ -69,6 +69,8 @@ public:
/// Debug information queries.
Register getFrameRegister(const MachineFunction &MF) const override;
bool isConstantPhysReg(MCRegister PhysReg) const override;
/// Return GPR register class.
virtual const TargetRegisterClass *intRegClass(unsigned Size) const = 0;