From fa63bf3e2024d850e4501d8b9a362b9b201e816a Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 3 Oct 2019 07:56:56 +0000 Subject: [PATCH] [llvm-exegesis][NFC] Rename ExegesisTarget::decrementLoopCounterAndLoop() 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 | 3 ++- tools/llvm-exegesis/lib/Target.h | 3 ++- tools/llvm-exegesis/lib/X86/Target.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/llvm-exegesis/lib/SnippetRepetitor.cpp b/tools/llvm-exegesis/lib/SnippetRepetitor.cpp index 954471659e5..860db92a81d 100644 --- a/tools/llvm-exegesis/lib/SnippetRepetitor.cpp +++ b/tools/llvm-exegesis/lib/SnippetRepetitor.cpp @@ -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()); diff --git a/tools/llvm-exegesis/lib/Target.h b/tools/llvm-exegesis/lib/Target.h index 4b0c9d17dd7..70313a7a2f7 100644 --- a/tools/llvm-exegesis/lib/Target.h +++ b/tools/llvm-exegesis/lib/Target.h @@ -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"); diff --git a/tools/llvm-exegesis/lib/X86/Target.cpp b/tools/llvm-exegesis/lib/X86/Target.cpp index bf008e8bbc7..ce66610891d 100644 --- a/tools/llvm-exegesis/lib/X86/Target.cpp +++ b/tools/llvm-exegesis/lib/X86/Target.cpp @@ -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 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); } -- 2.40.0