Quellcode durchsuchen

LivePhysReg: Use reference instead of pointer in init(); NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289002 91177308-0d34-0410-b5e6-96231b3b80d8
Matthias Braun vor 8 Jahren
Ursprung
Commit
f3e629e3ec

+ 3 - 4
include/llvm/CodeGen/LivePhysRegs.h

@@ -60,11 +60,10 @@ public:
   }
   }
 
 
   /// \brief Clear and initialize the LivePhysRegs set.
   /// \brief Clear and initialize the LivePhysRegs set.
-  void init(const TargetRegisterInfo *TRI) {
-    assert(TRI && "Invalid TargetRegisterInfo pointer.");
-    this->TRI = TRI;
+  void init(const TargetRegisterInfo &TRI) {
+    this->TRI = &TRI;
     LiveRegs.clear();
     LiveRegs.clear();
-    LiveRegs.setUniverse(TRI->getNumRegs());
+    LiveRegs.setUniverse(TRI.getNumRegs());
   }
   }
 
 
   /// \brief Clears the LivePhysRegs set.
   /// \brief Clears the LivePhysRegs set.

+ 1 - 1
lib/CodeGen/BranchFolding.cpp

@@ -353,7 +353,7 @@ void BranchFolder::computeLiveIns(MachineBasicBlock &MBB) {
   if (!UpdateLiveIns)
   if (!UpdateLiveIns)
     return;
     return;
 
 
-  LiveRegs.init(TRI);
+  LiveRegs.init(*TRI);
   LiveRegs.addLiveOutsNoPristines(MBB);
   LiveRegs.addLiveOutsNoPristines(MBB);
   for (MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend()))
   for (MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend()))
     LiveRegs.stepBackward(MI);
     LiveRegs.stepBackward(MI);

+ 1 - 1
lib/CodeGen/ExecutionDepsFix.cpp

@@ -612,7 +612,7 @@ void ExeDepsFix::processUndefReads(MachineBasicBlock *MBB) {
     return;
     return;
 
 
   // Collect this block's live out register units.
   // Collect this block's live out register units.
-  LiveRegSet.init(TRI);
+  LiveRegSet.init(*TRI);
   // We do not need to care about pristine registers as they are just preserved
   // We do not need to care about pristine registers as they are just preserved
   // but not actually used in the function.
   // but not actually used in the function.
   LiveRegSet.addLiveOutsNoPristines(*MBB);
   LiveRegSet.addLiveOutsNoPristines(*MBB);

+ 5 - 5
lib/CodeGen/IfConversion.cpp

@@ -1517,13 +1517,13 @@ bool IfConverter::IfConvertSimple(BBInfo &BBI, IfcvtKind Kind) {
 
 
   // Initialize liveins to the first BB. These are potentiall redefined by
   // Initialize liveins to the first BB. These are potentiall redefined by
   // predicated instructions.
   // predicated instructions.
-  Redefs.init(TRI);
+  Redefs.init(*TRI);
   Redefs.addLiveIns(CvtMBB);
   Redefs.addLiveIns(CvtMBB);
   Redefs.addLiveIns(NextMBB);
   Redefs.addLiveIns(NextMBB);
 
 
   // Compute a set of registers which must not be killed by instructions in
   // Compute a set of registers which must not be killed by instructions in
   // BB1: This is everything live-in to BB2.
   // BB1: This is everything live-in to BB2.
-  DontKill.init(TRI);
+  DontKill.init(*TRI);
   DontKill.addLiveIns(NextMBB);
   DontKill.addLiveIns(NextMBB);
 
 
   if (CvtMBB.pred_size() > 1) {
   if (CvtMBB.pred_size() > 1) {
@@ -1621,7 +1621,7 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) {
 
 
   // Initialize liveins to the first BB. These are potentially redefined by
   // Initialize liveins to the first BB. These are potentially redefined by
   // predicated instructions.
   // predicated instructions.
-  Redefs.init(TRI);
+  Redefs.init(*TRI);
   Redefs.addLiveIns(CvtMBB);
   Redefs.addLiveIns(CvtMBB);
   Redefs.addLiveIns(NextMBB);
   Redefs.addLiveIns(NextMBB);
 
 
@@ -1785,7 +1785,7 @@ bool IfConverter::IfConvertDiamondCommon(
   // - BB1 live-out regs need implicit uses before being redefined by BB2
   // - BB1 live-out regs need implicit uses before being redefined by BB2
   //   instructions. We start with BB1 live-ins so we have the live-out regs
   //   instructions. We start with BB1 live-ins so we have the live-out regs
   //   after tracking the BB1 instructions.
   //   after tracking the BB1 instructions.
-  Redefs.init(TRI);
+  Redefs.init(*TRI);
   Redefs.addLiveIns(MBB1);
   Redefs.addLiveIns(MBB1);
   Redefs.addLiveIns(MBB2);
   Redefs.addLiveIns(MBB2);
 
 
@@ -1811,7 +1811,7 @@ bool IfConverter::IfConvertDiamondCommon(
   // Compute a set of registers which must not be killed by instructions in BB1:
   // Compute a set of registers which must not be killed by instructions in BB1:
   // This is everything used+live in BB2 after the duplicated instructions. We
   // This is everything used+live in BB2 after the duplicated instructions. We
   // can compute this set by simulating liveness backwards from the end of BB2.
   // can compute this set by simulating liveness backwards from the end of BB2.
-  DontKill.init(TRI);
+  DontKill.init(*TRI);
   for (const MachineInstr &MI : make_range(MBB2.rbegin(), ++DI2.getReverse()))
   for (const MachineInstr &MI : make_range(MBB2.rbegin(), ++DI2.getReverse()))
     DontKill.stepBackward(MI);
     DontKill.stepBackward(MI);
 
 

+ 1 - 1
lib/CodeGen/StackMapLivenessAnalysis.cpp

@@ -125,7 +125,7 @@ bool StackMapLiveness::calculateLiveness(MachineFunction &MF) {
   // For all basic blocks in the function.
   // For all basic blocks in the function.
   for (auto &MBB : MF) {
   for (auto &MBB : MF) {
     DEBUG(dbgs() << "****** BB " << MBB.getName() << " ******\n");
     DEBUG(dbgs() << "****** BB " << MBB.getName() << " ******\n");
-    LiveRegs.init(TRI);
+    LiveRegs.init(*TRI);
     // FIXME: This should probably be addLiveOuts().
     // FIXME: This should probably be addLiveOuts().
     LiveRegs.addLiveOutsNoPristines(MBB);
     LiveRegs.addLiveOutsNoPristines(MBB);
     bool HasStackMap = false;
     bool HasStackMap = false;

+ 1 - 1
lib/Target/ARM/ARMLoadStoreOptimizer.cpp

@@ -560,7 +560,7 @@ void ARMLoadStoreOpt::moveLiveRegsBefore(const MachineBasicBlock &MBB,
     MachineBasicBlock::const_iterator Before) {
     MachineBasicBlock::const_iterator Before) {
   // Initialize if we never queried in this block.
   // Initialize if we never queried in this block.
   if (!LiveRegsValid) {
   if (!LiveRegsValid) {
-    LiveRegs.init(TRI);
+    LiveRegs.init(*TRI);
     LiveRegs.addLiveOuts(MBB);
     LiveRegs.addLiveOuts(MBB);
     LiveRegPos = MBB.end();
     LiveRegPos = MBB.end();
     LiveRegsValid = true;
     LiveRegsValid = true;

+ 1 - 1
lib/Target/SystemZ/SystemZShortenInst.cpp

@@ -275,7 +275,7 @@ bool SystemZShortenInst::runOnMachineFunction(MachineFunction &F) {
   const SystemZSubtarget &ST = F.getSubtarget<SystemZSubtarget>();
   const SystemZSubtarget &ST = F.getSubtarget<SystemZSubtarget>();
   TII = ST.getInstrInfo();
   TII = ST.getInstrInfo();
   TRI = ST.getRegisterInfo();
   TRI = ST.getRegisterInfo();
-  LiveRegs.init(TRI);
+  LiveRegs.init(*TRI);
 
 
   bool Changed = false;
   bool Changed = false;
   for (auto &MBB : F)
   for (auto &MBB : F)

+ 1 - 1
lib/Target/X86/X86FixupBWInsts.cpp

@@ -154,7 +154,7 @@ bool FixupBWInstPass::runOnMachineFunction(MachineFunction &MF) {
   TII = MF.getSubtarget<X86Subtarget>().getInstrInfo();
   TII = MF.getSubtarget<X86Subtarget>().getInstrInfo();
   OptForSize = MF.getFunction()->optForSize();
   OptForSize = MF.getFunction()->optForSize();
   MLI = &getAnalysis<MachineLoopInfo>();
   MLI = &getAnalysis<MachineLoopInfo>();
-  LiveRegs.init(&TII->getRegisterInfo());
+  LiveRegs.init(TII->getRegisterInfo());
 
 
   DEBUG(dbgs() << "Start X86FixupBWInsts\n";);
   DEBUG(dbgs() << "Start X86FixupBWInsts\n";);