From: Guozhi Wei Date: Tue, 2 Aug 2022 17:04:52 +0000 (+0000) Subject: [MIPS] Expose the ZERO register as a constant physical register X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85a6dd50adb22207a67619ff4fedcc4f48d021cb;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/llvm/lib/Target/Mips/MipsRegisterInfo.cpp b/llvm/lib/Target/Mips/MipsRegisterInfo.cpp index 390ab9d..6aa5610f 100644 --- a/llvm/lib/Target/Mips/MipsRegisterInfo.cpp +++ b/llvm/lib/Target/Mips/MipsRegisterInfo.cpp @@ -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; +} diff --git a/llvm/lib/Target/Mips/MipsRegisterInfo.h b/llvm/lib/Target/Mips/MipsRegisterInfo.h index 06f214c..1f45f6a 100644 --- a/llvm/lib/Target/Mips/MipsRegisterInfo.h +++ b/llvm/lib/Target/Mips/MipsRegisterInfo.h @@ -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;