[llvm] r313405 - Name the sentinel value used for the location number of the undefined register NFC

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 15 15:08:50 PDT 2017


Author: rnk
Date: Fri Sep 15 15:08:50 2017
New Revision: 313405

URL: http://llvm.org/viewvc/llvm-project?rev=313405&view=rev
Log:
Name the sentinel value used for the location number of the undefined register NFC

Modified:
    llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp

Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=313405&r1=313404&r2=313405&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Fri Sep 15 15:08:50 2017
@@ -166,6 +166,8 @@ public:
            indirect == IsIndirect;
   }
 
+  enum : unsigned { UndefLocNo = ~0U };
+
   /// merge - Merge equivalence classes.
   static UserValue *merge(UserValue *L1, UserValue *L2) {
     L2 = L2->getLeader();
@@ -190,7 +192,7 @@ public:
   unsigned getLocationNo(const MachineOperand &LocMO) {
     if (LocMO.isReg()) {
       if (LocMO.getReg() == 0)
-        return ~0u;
+        return UndefLocNo;
       // For register locations we dont care about use/def and other flags.
       for (unsigned i = 0, e = locations.size(); i != e; ++i)
         if (locations[i].isReg() &&
@@ -403,7 +405,7 @@ void UserValue::print(raw_ostream &OS, c
   OS << "\"\t";
   for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I) {
     OS << " [" << I.start() << ';' << I.stop() << "):";
-    if (I.value() == ~0u)
+    if (I.value() == UndefLocNo)
       OS << "undef";
     else
       OS << I.value();
@@ -664,7 +666,7 @@ void UserValue::computeIntervals(Machine
 
   // Collect all defs to be extended (Skipping undefs).
   for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I)
-    if (I.value() != ~0u)
+    if (I.value() != UndefLocNo)
       Defs.push_back(std::make_pair(I.start(), I.value()));
 
   // Extend all defs, and possibly add new ones along the way.
@@ -703,7 +705,7 @@ void UserValue::computeIntervals(Machine
 
   // Erase all the undefs.
   for (LocMap::iterator I = locInts.begin(); I.valid();)
-    if (I.value() == ~0u)
+    if (I.value() == UndefLocNo)
       I.erase();
     else
       ++I;
@@ -856,7 +858,7 @@ UserValue::splitLocation(unsigned OldLoc
       continue;
 
     // Don't allocate the new LocNo until it is needed.
-    unsigned NewLocNo = ~0u;
+    unsigned NewLocNo = UndefLocNo;
 
     // Iterate over the overlaps between locInts and LI.
     LocMapI.find(LI->beginIndex());
@@ -873,7 +875,7 @@ UserValue::splitLocation(unsigned OldLoc
       // Now LII->end > LocMapI.start(). Do we have an overlap?
       if (LocMapI.value() == OldLocNo && LII->start < LocMapI.stop()) {
         // Overlapping correct location. Allocate NewLocNo now.
-        if (NewLocNo == ~0u) {
+        if (NewLocNo == UndefLocNo) {
           MachineOperand MO = MachineOperand::CreateReg(LI->reg, false);
           MO.setSubReg(locations[OldLocNo].getSubReg());
           NewLocNo = getLocationNo(MO);
@@ -1069,7 +1071,7 @@ void UserValue::emitDebugValues(VirtRegM
     SlotIndex Start = I.start();
     SlotIndex Stop = I.stop();
     unsigned LocNo = I.value();
-    bool Spilled = LocNo != ~0U ? SpilledLocations.test(LocNo) : false;
+    bool Spilled = LocNo != UndefLocNo ? SpilledLocations.test(LocNo) : false;
 
     // If the interval start was trimmed to the lexical scope insert the
     // DBG_VALUE at the previous index (otherwise it appears after the




More information about the llvm-commits mailing list