[PATCH] D87768: [NFC][regalloc] type LiveInterval::reg() as Register

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 08:39:19 PDT 2020


mtrofin created this revision.
mtrofin added a reviewer: wmi.
Herald added subscribers: llvm-commits, MatzeB.
Herald added a project: LLVM.
mtrofin requested review of this revision.

We have the Register type which precisely captures the role of this
member. Storage-wise, it's an unsigned.

This helps readability & maintainability.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87768

Files:
  llvm/include/llvm/CodeGen/LiveInterval.h


Index: llvm/include/llvm/CodeGen/LiveInterval.h
===================================================================
--- llvm/include/llvm/CodeGen/LiveInterval.h
+++ llvm/include/llvm/CodeGen/LiveInterval.h
@@ -25,6 +25,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator_range.h"
+#include "llvm/CodeGen/Register.h"
 #include "llvm/CodeGen/SlotIndexes.h"
 #include "llvm/MC/LaneBitmask.h"
 #include "llvm/Support/Allocator.h"
@@ -704,11 +705,11 @@
   private:
     SubRange *SubRanges = nullptr; ///< Single linked list of subregister live
                                    /// ranges.
-    const unsigned Reg; // the register or stack slot of this interval.
+    const Register Reg; // the register or stack slot of this interval.
     float Weight = 0.0; // weight of this interval
 
   public:
-    unsigned reg() const { return Reg; }
+    Register reg() const { return Reg; }
     float weight() const { return Weight; }
     void incrementWeight(float Inc) { Weight += Inc; }
     void setWeight(float Value) { Weight = Value; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87768.292232.patch
Type: text/x-patch
Size: 1087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200916/320be74b/attachment.bin>


More information about the llvm-commits mailing list