[PATCH] D31123: RegisterPressure: Add operators to RegisterMaskPair

Axel Davy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 19 04:07:00 PDT 2017


axeldavy created this revision.

Add operators and a new constructor to RegisterMaskPair.
This makes it handier and enables to use set and maps with
the structure.


Repository:
  rL LLVM

https://reviews.llvm.org/D31123

Files:
  include/llvm/CodeGen/RegisterPressure.h


Index: include/llvm/CodeGen/RegisterPressure.h
===================================================================
--- include/llvm/CodeGen/RegisterPressure.h
+++ include/llvm/CodeGen/RegisterPressure.h
@@ -41,6 +41,17 @@
 
   RegisterMaskPair(unsigned RegUnit, LaneBitmask LaneMask)
       : RegUnit(RegUnit), LaneMask(LaneMask) {}
+
+  RegisterMaskPair() {}
+
+  bool operator==(const RegisterMaskPair &RP) const {
+    return RegUnit == RP.RegUnit && LaneMask == RP.LaneMask;
+  }
+
+  bool operator<(const RegisterMaskPair &RP) const {
+    return RegUnit < RP.RegUnit ||
+      (RegUnit == RP.RegUnit && LaneMask < RP.LaneMask);
+  }
 };
 
 /// Base class for register pressure results.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31123.92270.patch
Type: text/x-patch
Size: 692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170319/1d10891a/attachment.bin>


More information about the llvm-commits mailing list