]> granicus.if.org Git - llvm/commitdiff
[llvm-exegesis][NFC] Rename ExegesisTarget::decrementLoopCounterAndLoop()
authorClement Courbet <courbet@google.com>
Thu, 3 Oct 2019 07:56:56 +0000 (07:56 +0000)
committerClement Courbet <courbet@google.com>
Thu, 3 Oct 2019 07:56:56 +0000 (07:56 +0000)
Summary: To decrementLoopCounterAndJump, and explicitely take the jump target.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68375

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373571 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-exegesis/lib/SnippetRepetitor.cpp
tools/llvm-exegesis/lib/Target.h
tools/llvm-exegesis/lib/X86/Target.cpp

index 954471659e5931f1e891b5986d8e0f4e4a4a0e90..860db92a81dac152c8e8b79d73e7dbedadf2ac22 100644 (file)
@@ -79,7 +79,8 @@ public:
       for (const auto &LiveIn : Entry.MBB->liveins())
         Loop.MBB->addLiveIn(LiveIn);
       Loop.addInstructions(Instructions);
-      ET.decrementLoopCounterAndLoop(*Loop.MBB, State.getInstrInfo());
+      ET.decrementLoopCounterAndJump(*Loop.MBB, *Loop.MBB,
+                                     State.getInstrInfo());
 
       // Set up the exit basic block.
       Loop.MBB->addSuccessor(Exit.MBB, llvm::BranchProbability::getZero());
index 4b0c9d17dd7fed9cc14bfc04ae00f06c5250cb41..70313a7a2f7ac463f109680ab554221623d60d10 100644 (file)
@@ -95,7 +95,8 @@ public:
   }
 
   // Adds the code to decrement the loop counter and
-  virtual void decrementLoopCounterAndLoop(MachineBasicBlock &MBB,
+  virtual void decrementLoopCounterAndJump(MachineBasicBlock &MBB,
+                                           MachineBasicBlock &TargetMBB,
                                            const llvm::MCInstrInfo &MII) const {
     llvm_unreachable("decrementLoopCounterAndBranch() requires "
                      "getLoopCounterRegister() > 0");
index bf008e8bbc7a515614279520c735aa4ffecd40c4..ce66610891d0af4ec1d58f1daa2f60e88b6ac51c 100644 (file)
@@ -448,7 +448,8 @@ private:
   void fillMemoryOperands(InstructionTemplate &IT, unsigned Reg,
                           unsigned Offset) const override;
 
-  void decrementLoopCounterAndLoop(MachineBasicBlock &MBB,
+  void decrementLoopCounterAndJump(MachineBasicBlock &MBB,
+                                   MachineBasicBlock &TargetMBB,
                                    const llvm::MCInstrInfo &MII) const override;
 
   std::vector<llvm::MCInst> setRegTo(const llvm::MCSubtargetInfo &STI,
@@ -558,14 +559,15 @@ void ExegesisX86Target::fillMemoryOperands(InstructionTemplate &IT,
   SetOp(MemOpIdx + 4, MCOperand::createReg(0));      // Segment
 }
 
-void ExegesisX86Target::decrementLoopCounterAndLoop(
-    MachineBasicBlock &MBB, const llvm::MCInstrInfo &MII) const {
+void ExegesisX86Target::decrementLoopCounterAndJump(
+    MachineBasicBlock &MBB, MachineBasicBlock &TargetMBB,
+    const llvm::MCInstrInfo &MII) const {
   BuildMI(&MBB, DebugLoc(), MII.get(X86::ADD64ri8))
       .addDef(kLoopCounterReg)
       .addUse(kLoopCounterReg)
       .addImm(-1);
   BuildMI(&MBB, DebugLoc(), MII.get(X86::JCC_1))
-      .addMBB(&MBB)
+      .addMBB(&TargetMBB)
       .addImm(X86::COND_NE);
 }