Skip to content

Commit eed0973

Browse files
committed
Name the sentinel value used for the location number of the undefined register NFC
llvm-svn: 313405
1 parent 425ec9f commit eed0973

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

llvm/lib/CodeGen/LiveDebugVariables.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ class UserValue {
166166
indirect == IsIndirect;
167167
}
168168

169+
enum : unsigned { UndefLocNo = ~0U };
170+
169171
/// merge - Merge equivalence classes.
170172
static UserValue *merge(UserValue *L1, UserValue *L2) {
171173
L2 = L2->getLeader();
@@ -190,7 +192,7 @@ class UserValue {
190192
unsigned getLocationNo(const MachineOperand &LocMO) {
191193
if (LocMO.isReg()) {
192194
if (LocMO.getReg() == 0)
193-
return ~0u;
195+
return UndefLocNo;
194196
// For register locations we dont care about use/def and other flags.
195197
for (unsigned i = 0, e = locations.size(); i != e; ++i)
196198
if (locations[i].isReg() &&
@@ -403,7 +405,7 @@ void UserValue::print(raw_ostream &OS, const TargetRegisterInfo *TRI) {
403405
OS << "\"\t";
404406
for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I) {
405407
OS << " [" << I.start() << ';' << I.stop() << "):";
406-
if (I.value() == ~0u)
408+
if (I.value() == UndefLocNo)
407409
OS << "undef";
408410
else
409411
OS << I.value();
@@ -664,7 +666,7 @@ void UserValue::computeIntervals(MachineRegisterInfo &MRI,
664666

665667
// Collect all defs to be extended (Skipping undefs).
666668
for (LocMap::const_iterator I = locInts.begin(); I.valid(); ++I)
667-
if (I.value() != ~0u)
669+
if (I.value() != UndefLocNo)
668670
Defs.push_back(std::make_pair(I.start(), I.value()));
669671

670672
// Extend all defs, and possibly add new ones along the way.
@@ -703,7 +705,7 @@ void UserValue::computeIntervals(MachineRegisterInfo &MRI,
703705

704706
// Erase all the undefs.
705707
for (LocMap::iterator I = locInts.begin(); I.valid();)
706-
if (I.value() == ~0u)
708+
if (I.value() == UndefLocNo)
707709
I.erase();
708710
else
709711
++I;
@@ -856,7 +858,7 @@ UserValue::splitLocation(unsigned OldLocNo, ArrayRef<unsigned> NewRegs,
856858
continue;
857859

858860
// Don't allocate the new LocNo until it is needed.
859-
unsigned NewLocNo = ~0u;
861+
unsigned NewLocNo = UndefLocNo;
860862

861863
// Iterate over the overlaps between locInts and LI.
862864
LocMapI.find(LI->beginIndex());
@@ -873,7 +875,7 @@ UserValue::splitLocation(unsigned OldLocNo, ArrayRef<unsigned> NewRegs,
873875
// Now LII->end > LocMapI.start(). Do we have an overlap?
874876
if (LocMapI.value() == OldLocNo && LII->start < LocMapI.stop()) {
875877
// Overlapping correct location. Allocate NewLocNo now.
876-
if (NewLocNo == ~0u) {
878+
if (NewLocNo == UndefLocNo) {
877879
MachineOperand MO = MachineOperand::CreateReg(LI->reg, false);
878880
MO.setSubReg(locations[OldLocNo].getSubReg());
879881
NewLocNo = getLocationNo(MO);
@@ -1069,7 +1071,7 @@ void UserValue::emitDebugValues(VirtRegMap *VRM, LiveIntervals &LIS,
10691071
SlotIndex Start = I.start();
10701072
SlotIndex Stop = I.stop();
10711073
unsigned LocNo = I.value();
1072-
bool Spilled = LocNo != ~0U ? SpilledLocations.test(LocNo) : false;
1074+
bool Spilled = LocNo != UndefLocNo ? SpilledLocations.test(LocNo) : false;
10731075

10741076
// If the interval start was trimmed to the lexical scope insert the
10751077
// DBG_VALUE at the previous index (otherwise it appears after the

0 commit comments

Comments
 (0)