@@ -33,7 +33,6 @@ class TargetInstrInfo;
3333 class VirtRegMap : public MachineFunctionPass {
3434 public:
3535 enum {
36- NO_PHYS_REG = 0 ,
3736 NO_STACK_SLOT = (1L << 30 )-1 ,
3837 MAX_STACK_SLOT = (1L << 18 )-1
3938 };
@@ -49,7 +48,7 @@ class TargetInstrInfo;
4948 // / it; even spilled virtual registers (the register mapped to a
5049 // / spilled register is the temporary used to load it from the
5150 // / stack).
52- IndexedMap<Register , VirtReg2IndexFunctor> Virt2PhysMap;
51+ IndexedMap<MCRegister , VirtReg2IndexFunctor> Virt2PhysMap;
5352
5453 // / Virt2StackSlotMap - This is virtual register to stack slot
5554 // / mapping. Each spilled virtual register has an entry in it
@@ -71,9 +70,7 @@ class TargetInstrInfo;
7170 public:
7271 static char ID;
7372
74- VirtRegMap ()
75- : MachineFunctionPass(ID), Virt2PhysMap(NO_PHYS_REG),
76- Virt2StackSlotMap (NO_STACK_SLOT) {}
73+ VirtRegMap () : MachineFunctionPass(ID), Virt2StackSlotMap(NO_STACK_SLOT) {}
7774 VirtRegMap (const VirtRegMap &) = delete ;
7875 VirtRegMap &operator =(const VirtRegMap &) = delete ;
7976
@@ -96,15 +93,13 @@ class TargetInstrInfo;
9693
9794 // / returns true if the specified virtual register is
9895 // / mapped to a physical register
99- bool hasPhys (Register virtReg) const {
100- return getPhys (virtReg) != NO_PHYS_REG;
101- }
96+ bool hasPhys (Register virtReg) const { return getPhys (virtReg).isValid (); }
10297
10398 // / returns the physical register mapped to the specified
10499 // / virtual register
105100 MCRegister getPhys (Register virtReg) const {
106101 assert (virtReg.isVirtual ());
107- return MCRegister::from ( Virt2PhysMap[virtReg]) ;
102+ return Virt2PhysMap[virtReg];
108103 }
109104
110105 // / creates a mapping for the specified virtual register to
@@ -130,9 +125,9 @@ class TargetInstrInfo;
130125 // / register mapping
131126 void clearVirt (Register virtReg) {
132127 assert (virtReg.isVirtual ());
133- assert (Virt2PhysMap[virtReg] != NO_PHYS_REG &&
128+ assert (Virt2PhysMap[virtReg] &&
134129 " attempt to clear a not assigned virtual register" );
135- Virt2PhysMap[virtReg] = NO_PHYS_REG ;
130+ Virt2PhysMap[virtReg] = MCRegister () ;
136131 }
137132
138133 // / clears all virtual to physical register mappings
@@ -178,8 +173,7 @@ class TargetInstrInfo;
178173 return true ;
179174 // Split register can be assigned a physical register as well as a
180175 // stack slot or remat id.
181- return (Virt2SplitMap[virtReg] &&
182- Virt2PhysMap[virtReg] != NO_PHYS_REG);
176+ return (Virt2SplitMap[virtReg] && Virt2PhysMap[virtReg]);
183177 }
184178
185179 // / returns the stack slot mapped to the specified virtual
0 commit comments