From 905db8a3d640f940c7c08bd49317199f498096aa Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Thu, 15 Mar 2018 16:13:12 +0000 Subject: [PATCH] [llvm-mca] Simplify code. NFC. Now both method DispatchUnit::checkRAT() and DispatchUnit::canDispatch take as input an Instruction refrence instead of an instruction descriptor. This was requested by Simon in D44488 to simplify the diff. llvm-svn: 327640 --- tools/llvm-mca/Backend.cpp | 2 +- tools/llvm-mca/Dispatch.cpp | 3 ++- tools/llvm-mca/Dispatch.h | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/llvm-mca/Backend.cpp b/tools/llvm-mca/Backend.cpp index 96668294498..46c7a735e9e 100644 --- a/tools/llvm-mca/Backend.cpp +++ b/tools/llvm-mca/Backend.cpp @@ -36,7 +36,7 @@ void Backend::runCycle(unsigned Cycle) { std::unique_ptr NewIS( IB->createInstruction(STI, IR.first, *IR.second)); const InstrDesc &Desc = NewIS->getDesc(); - if (!DU->isAvailable(Desc.NumMicroOps) || !DU->canDispatch(Desc)) + if (!DU->isAvailable(Desc.NumMicroOps) || !DU->canDispatch(*NewIS)) break; Instruction *IS = NewIS.get(); diff --git a/tools/llvm-mca/Dispatch.cpp b/tools/llvm-mca/Dispatch.cpp index 33b5f4926c9..50b118b310c 100644 --- a/tools/llvm-mca/Dispatch.cpp +++ b/tools/llvm-mca/Dispatch.cpp @@ -199,7 +199,8 @@ void RetireControlUnit::dump() const { } #endif -bool DispatchUnit::checkRAT(const InstrDesc &Desc) { +bool DispatchUnit::checkRAT(const Instruction &Instr) { + const InstrDesc &Desc = Instr.getDesc(); unsigned NumWrites = Desc.Writes.size(); if (RAT->isAvailable(NumWrites)) return true; diff --git a/tools/llvm-mca/Dispatch.h b/tools/llvm-mca/Dispatch.h index 66ac2f7e64a..b342976db27 100644 --- a/tools/llvm-mca/Dispatch.h +++ b/tools/llvm-mca/Dispatch.h @@ -233,7 +233,7 @@ class DispatchUnit { // stored into a vector `DispatchStall` which is always of size DS_LAST. std::vector DispatchStalls; - bool checkRAT(const InstrDesc &Desc); + bool checkRAT(const Instruction &Desc); bool checkRCU(const InstrDesc &Desc); bool checkScheduler(const InstrDesc &Desc); @@ -260,9 +260,10 @@ public: bool isRCUEmpty() const { return RCU->isEmpty(); } - bool canDispatch(const InstrDesc &Desc) { + bool canDispatch(const Instruction &Inst) { + const InstrDesc &Desc = Inst.getDesc(); assert(isAvailable(Desc.NumMicroOps)); - return checkRCU(Desc) && checkRAT(Desc) && checkScheduler(Desc); + return checkRCU(Desc) && checkRAT(Inst) && checkScheduler(Desc); } unsigned dispatch(unsigned IID, Instruction *NewInst,