[PATCH] D130932: [MIPS] Expose the ZERO register as a constant physical register

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 1 13:15:06 PDT 2022


Carrot created this revision.
Carrot added a reviewer: arsenm.
Herald added subscribers: atanasyan, jrtc27, hiraditya, arichardson, sdardis.
Herald added a project: All.
Carrot requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130932

Files:
  llvm/lib/Target/Mips/MipsRegisterInfo.cpp
  llvm/lib/Target/Mips/MipsRegisterInfo.h


Index: llvm/lib/Target/Mips/MipsRegisterInfo.h
===================================================================
--- llvm/lib/Target/Mips/MipsRegisterInfo.h
+++ llvm/lib/Target/Mips/MipsRegisterInfo.h
@@ -69,6 +69,8 @@
   /// 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;
 
Index: llvm/lib/Target/Mips/MipsRegisterInfo.cpp
===================================================================
--- llvm/lib/Target/Mips/MipsRegisterInfo.cpp
+++ llvm/lib/Target/Mips/MipsRegisterInfo.cpp
@@ -318,3 +318,7 @@
   // sized objects.
   return MF.getRegInfo().canReserveReg(BP);
 }
+
+bool MipsRegisterInfo::isConstantPhysReg(MCRegister PhysReg) const {
+  return PhysReg == Mips::ZERO_64 || PhysReg == Mips::ZERO;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130932.449107.patch
Type: text/x-patch
Size: 939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220801/781d9af5/attachment.bin>


More information about the llvm-commits mailing list