diff --git a/tools/llvm-mca/include/Stages/FetchStage.h b/tools/llvm-mca/include/Stages/EntryStage.h similarity index 66% rename from tools/llvm-mca/include/Stages/FetchStage.h rename to tools/llvm-mca/include/Stages/EntryStage.h index 55bf2011b32..ed9f32f5d53 100644 --- a/tools/llvm-mca/include/Stages/FetchStage.h +++ b/tools/llvm-mca/include/Stages/EntryStage.h @@ -1,4 +1,4 @@ -//===---------------------- FetchStage.h ------------------------*- C++ -*-===// +//===---------------------- EntryStage.h ------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -8,13 +8,14 @@ //===----------------------------------------------------------------------===// /// \file /// -/// This file defines the Fetch stage of an instruction pipeline. Its sole -/// purpose in life is to produce instructions for the rest of the pipeline. +/// This file defines the Entry stage of an instruction pipeline. Its sole +/// purpose in life is to pick instructions in sequence and move them to the +/// next pipeline stage. /// //===----------------------------------------------------------------------===// -#ifndef LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H -#define LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H +#ifndef LLVM_TOOLS_LLVM_MCA_ENTRY_STAGE_H +#define LLVM_TOOLS_LLVM_MCA_ENTRY_STAGE_H #include "SourceMgr.h" #include "Stages/Stage.h" @@ -23,7 +24,7 @@ namespace llvm { namespace mca { -class FetchStage final : public Stage { +class EntryStage final : public Stage { InstRef CurrentInstruction; using InstMap = std::map>; InstMap Instructions; @@ -32,11 +33,11 @@ class FetchStage final : public Stage { // Updates the program counter, and sets 'CurrentInstruction'. void getNextInstruction(); - FetchStage(const FetchStage &Other) = delete; - FetchStage &operator=(const FetchStage &Other) = delete; + EntryStage(const EntryStage &Other) = delete; + EntryStage &operator=(const EntryStage &Other) = delete; public: - FetchStage(SourceMgr &SM) : CurrentInstruction(), SM(SM) {} + EntryStage(SourceMgr &SM) : CurrentInstruction(), SM(SM) {} bool isAvailable(const InstRef &IR) const override; bool hasWorkToComplete() const override; diff --git a/tools/llvm-mca/lib/CMakeLists.txt b/tools/llvm-mca/lib/CMakeLists.txt index 359a7d49d49..21b6e34cc7e 100644 --- a/tools/llvm-mca/lib/CMakeLists.txt +++ b/tools/llvm-mca/lib/CMakeLists.txt @@ -14,8 +14,8 @@ add_library(LLVMMCA Instruction.cpp Pipeline.cpp Stages/DispatchStage.cpp + Stages/EntryStage.cpp Stages/ExecuteStage.cpp - Stages/FetchStage.cpp Stages/InstructionTables.cpp Stages/RetireStage.cpp Stages/Stage.cpp diff --git a/tools/llvm-mca/lib/Context.cpp b/tools/llvm-mca/lib/Context.cpp index 5b6f52478dd..6774a57d29b 100644 --- a/tools/llvm-mca/lib/Context.cpp +++ b/tools/llvm-mca/lib/Context.cpp @@ -20,8 +20,8 @@ #include "HardwareUnits/RetireControlUnit.h" #include "HardwareUnits/Scheduler.h" #include "Stages/DispatchStage.h" +#include "Stages/EntryStage.h" #include "Stages/ExecuteStage.h" -#include "Stages/FetchStage.h" #include "Stages/RetireStage.h" namespace llvm { @@ -40,7 +40,7 @@ Context::createDefaultPipeline(const PipelineOptions &Opts, InstrBuilder &IB, auto HWS = llvm::make_unique(SM, LSU.get()); // Create the pipeline stages. - auto Fetch = llvm::make_unique(SrcMgr); + auto Fetch = llvm::make_unique(SrcMgr); auto Dispatch = llvm::make_unique(STI, MRI, Opts.DispatchWidth, *RCU, *PRF); auto Execute = llvm::make_unique(*HWS); diff --git a/tools/llvm-mca/lib/Stages/FetchStage.cpp b/tools/llvm-mca/lib/Stages/EntryStage.cpp similarity index 82% rename from tools/llvm-mca/lib/Stages/FetchStage.cpp rename to tools/llvm-mca/lib/Stages/EntryStage.cpp index 6e91dd6121d..929d51e824c 100644 --- a/tools/llvm-mca/lib/Stages/FetchStage.cpp +++ b/tools/llvm-mca/lib/Stages/EntryStage.cpp @@ -1,4 +1,4 @@ -//===---------------------- FetchStage.cpp ----------------------*- C++ -*-===// +//===---------------------- EntryStage.cpp ----------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -13,21 +13,21 @@ /// //===----------------------------------------------------------------------===// -#include "Stages/FetchStage.h" +#include "Stages/EntryStage.h" #include "Instruction.h" namespace llvm { namespace mca { -bool FetchStage::hasWorkToComplete() const { return CurrentInstruction; } +bool EntryStage::hasWorkToComplete() const { return CurrentInstruction; } -bool FetchStage::isAvailable(const InstRef & /* unused */) const { +bool EntryStage::isAvailable(const InstRef & /* unused */) const { if (CurrentInstruction) return checkNextStage(CurrentInstruction); return false; } -void FetchStage::getNextInstruction() { +void EntryStage::getNextInstruction() { assert(!CurrentInstruction && "There is already an instruction to process!"); if (!SM.hasNext()) return; @@ -38,7 +38,7 @@ void FetchStage::getNextInstruction() { SM.updateNext(); } -llvm::Error FetchStage::execute(InstRef & /*unused */) { +llvm::Error EntryStage::execute(InstRef & /*unused */) { assert(CurrentInstruction && "There is no instruction to process!"); if (llvm::Error Val = moveToTheNextStage(CurrentInstruction)) return Val; @@ -49,13 +49,13 @@ llvm::Error FetchStage::execute(InstRef & /*unused */) { return llvm::ErrorSuccess(); } -llvm::Error FetchStage::cycleStart() { +llvm::Error EntryStage::cycleStart() { if (!CurrentInstruction) getNextInstruction(); return llvm::ErrorSuccess(); } -llvm::Error FetchStage::cycleEnd() { +llvm::Error EntryStage::cycleEnd() { // Find the first instruction which hasn't been retired. const InstMap::iterator It = llvm::find_if(Instructions, [](const InstMap::value_type &KeyValuePair) { diff --git a/tools/llvm-mca/llvm-mca.cpp b/tools/llvm-mca/llvm-mca.cpp index d8bbcb9e660..a105e7c99a2 100644 --- a/tools/llvm-mca/llvm-mca.cpp +++ b/tools/llvm-mca/llvm-mca.cpp @@ -24,7 +24,7 @@ #include "CodeRegion.h" #include "CodeRegionGenerator.h" #include "PipelinePrinter.h" -#include "Stages/FetchStage.h" +#include "Stages/EntryStage.h" #include "Stages/InstructionTables.h" #include "Views/DispatchStatistics.h" #include "Views/InstructionInfoView.h" @@ -434,7 +434,7 @@ int main(int argc, char **argv) { if (PrintInstructionTables) { // Create a pipeline, stages, and a printer. auto P = make_unique(); - P->appendStage(make_unique(S)); + P->appendStage(make_unique(S)); P->appendStage(make_unique(SM)); mca::PipelinePrinter Printer(*P);