[PATCH] D131445: [PPC] Expose the ZERO register as a constant physical register

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 14:45:13 PDT 2022


Carrot created this revision.
Carrot added reviewers: kbarton, nemanjai, arsenm.
Herald added subscribers: shchenz, hiraditya.
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/D131445

Files:
  llvm/lib/Target/PowerPC/PPCRegisterInfo.h


Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.h
===================================================================
--- llvm/lib/Target/PowerPC/PPCRegisterInfo.h
+++ llvm/lib/Target/PowerPC/PPCRegisterInfo.h
@@ -193,6 +193,10 @@
   bool isNonallocatableRegisterCalleeSave(MCRegister Reg) const override {
     return Reg == PPC::LR || Reg == PPC::LR8;
   }
+
+  bool isConstantPhysReg(MCRegister PhysReg) const override {
+    return PhysReg == PPC::ZERO || PhysReg == PPC::ZERO8;
+  }
 };
 
 } // end namespace llvm


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131445.450959.patch
Type: text/x-patch
Size: 518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220808/a441e17d/attachment.bin>


More information about the llvm-commits mailing list