[PATCH] D85602: MachineSSAUpdater: Allow initialization with just a register class

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 07:17:46 PDT 2020


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, dsanders.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
nhaehnle requested review of this revision.
Herald added a subscriber: wdng.

The register class is required for inserting PHIs, but the "current
virtual register" isn't actually used for anything, so let's remove it
while we're at it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85602

Files:
  llvm/include/llvm/CodeGen/MachineSSAUpdater.h
  llvm/lib/CodeGen/MachineSSAUpdater.cpp


Index: llvm/lib/CodeGen/MachineSSAUpdater.cpp
===================================================================
--- llvm/lib/CodeGen/MachineSSAUpdater.cpp
+++ llvm/lib/CodeGen/MachineSSAUpdater.cpp
@@ -50,15 +50,18 @@
 }
 
 /// Initialize - Reset this object to get ready for a new set of SSA
-/// updates.  ProtoValue is the value used to name PHI nodes.
-void MachineSSAUpdater::Initialize(Register V) {
+/// updates.
+void MachineSSAUpdater::Initialize(const TargetRegisterClass *RC) {
   if (!AV)
     AV = new AvailableValsTy();
   else
     getAvailableVals(AV).clear();
 
-  VR = V;
-  VRC = MRI->getRegClass(VR);
+  VRC = RC;
+}
+
+void MachineSSAUpdater::Initialize(Register V) {
+  Initialize(MRI->getRegClass(V));
 }
 
 /// HasValueForBlock - Return true if the MachineSSAUpdater already has a value for
Index: llvm/include/llvm/CodeGen/MachineSSAUpdater.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineSSAUpdater.h
+++ llvm/include/llvm/CodeGen/MachineSSAUpdater.h
@@ -40,9 +40,6 @@
   //typedef DenseMap<MachineBasicBlock*, Register> AvailableValsTy;
   void *AV = nullptr;
 
-  /// VR - Current virtual register whose uses are being updated.
-  Register VR;
-
   /// VRC - Register class of the current virtual register.
   const TargetRegisterClass *VRC;
 
@@ -65,6 +62,7 @@
   /// Initialize - Reset this object to get ready for a new set of SSA
   /// updates.
   void Initialize(Register V);
+  void Initialize(const TargetRegisterClass *RC);
 
   /// AddAvailableValue - Indicate that a rewritten value is available at the
   /// end of the specified block with the specified value.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85602.284197.patch
Type: text/x-patch
Size: 1663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200809/fc193b3d/attachment.bin>


More information about the llvm-commits mailing list