Skip to content

Commit d66f4e4

Browse files
committed
[llvm-mca] PR39261: Rename FetchStage to EntryStage.
This fixes PR39261. FetchStage is a misnomer. It causes confusion with the frontend fetch stage, which we don't currently simulate. I decided to rename it into EntryStage mainly because this is meant to be a "source" stage for all pipelines. Differential Revision: https://reviews.llvm.org/D54268 llvm-svn: 346419
1 parent 3c1f490 commit d66f4e4

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

llvm/tools/llvm-mca/include/Stages/FetchStage.h renamed to llvm/tools/llvm-mca/include/Stages/EntryStage.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===---------------------- FetchStage.h ------------------------*- C++ -*-===//
1+
//===---------------------- EntryStage.h ------------------------*- C++ -*-===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -8,13 +8,14 @@
88
//===----------------------------------------------------------------------===//
99
/// \file
1010
///
11-
/// This file defines the Fetch stage of an instruction pipeline. Its sole
12-
/// purpose in life is to produce instructions for the rest of the pipeline.
11+
/// This file defines the Entry stage of an instruction pipeline. Its sole
12+
/// purpose in life is to pick instructions in sequence and move them to the
13+
/// next pipeline stage.
1314
///
1415
//===----------------------------------------------------------------------===//
1516

16-
#ifndef LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H
17-
#define LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H
17+
#ifndef LLVM_TOOLS_LLVM_MCA_ENTRY_STAGE_H
18+
#define LLVM_TOOLS_LLVM_MCA_ENTRY_STAGE_H
1819

1920
#include "SourceMgr.h"
2021
#include "Stages/Stage.h"
@@ -23,7 +24,7 @@
2324
namespace llvm {
2425
namespace mca {
2526

26-
class FetchStage final : public Stage {
27+
class EntryStage final : public Stage {
2728
InstRef CurrentInstruction;
2829
using InstMap = std::map<unsigned, std::unique_ptr<Instruction>>;
2930
InstMap Instructions;
@@ -32,11 +33,11 @@ class FetchStage final : public Stage {
3233
// Updates the program counter, and sets 'CurrentInstruction'.
3334
void getNextInstruction();
3435

35-
FetchStage(const FetchStage &Other) = delete;
36-
FetchStage &operator=(const FetchStage &Other) = delete;
36+
EntryStage(const EntryStage &Other) = delete;
37+
EntryStage &operator=(const EntryStage &Other) = delete;
3738

3839
public:
39-
FetchStage(SourceMgr &SM) : CurrentInstruction(), SM(SM) {}
40+
EntryStage(SourceMgr &SM) : CurrentInstruction(), SM(SM) {}
4041

4142
bool isAvailable(const InstRef &IR) const override;
4243
bool hasWorkToComplete() const override;

llvm/tools/llvm-mca/lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ add_library(LLVMMCA
1414
Instruction.cpp
1515
Pipeline.cpp
1616
Stages/DispatchStage.cpp
17+
Stages/EntryStage.cpp
1718
Stages/ExecuteStage.cpp
18-
Stages/FetchStage.cpp
1919
Stages/InstructionTables.cpp
2020
Stages/RetireStage.cpp
2121
Stages/Stage.cpp

llvm/tools/llvm-mca/lib/Context.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "HardwareUnits/RetireControlUnit.h"
2121
#include "HardwareUnits/Scheduler.h"
2222
#include "Stages/DispatchStage.h"
23+
#include "Stages/EntryStage.h"
2324
#include "Stages/ExecuteStage.h"
24-
#include "Stages/FetchStage.h"
2525
#include "Stages/RetireStage.h"
2626

2727
namespace llvm {
@@ -40,7 +40,7 @@ Context::createDefaultPipeline(const PipelineOptions &Opts, InstrBuilder &IB,
4040
auto HWS = llvm::make_unique<Scheduler>(SM, LSU.get());
4141

4242
// Create the pipeline stages.
43-
auto Fetch = llvm::make_unique<FetchStage>(SrcMgr);
43+
auto Fetch = llvm::make_unique<EntryStage>(SrcMgr);
4444
auto Dispatch = llvm::make_unique<DispatchStage>(STI, MRI, Opts.DispatchWidth,
4545
*RCU, *PRF);
4646
auto Execute = llvm::make_unique<ExecuteStage>(*HWS);

llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp renamed to llvm/tools/llvm-mca/lib/Stages/EntryStage.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===---------------------- FetchStage.cpp ----------------------*- C++ -*-===//
1+
//===---------------------- EntryStage.cpp ----------------------*- C++ -*-===//
22
//
33
// The LLVM Compiler Infrastructure
44
//
@@ -13,21 +13,21 @@
1313
///
1414
//===----------------------------------------------------------------------===//
1515

16-
#include "Stages/FetchStage.h"
16+
#include "Stages/EntryStage.h"
1717
#include "Instruction.h"
1818

1919
namespace llvm {
2020
namespace mca {
2121

22-
bool FetchStage::hasWorkToComplete() const { return CurrentInstruction; }
22+
bool EntryStage::hasWorkToComplete() const { return CurrentInstruction; }
2323

24-
bool FetchStage::isAvailable(const InstRef & /* unused */) const {
24+
bool EntryStage::isAvailable(const InstRef & /* unused */) const {
2525
if (CurrentInstruction)
2626
return checkNextStage(CurrentInstruction);
2727
return false;
2828
}
2929

30-
void FetchStage::getNextInstruction() {
30+
void EntryStage::getNextInstruction() {
3131
assert(!CurrentInstruction && "There is already an instruction to process!");
3232
if (!SM.hasNext())
3333
return;
@@ -38,7 +38,7 @@ void FetchStage::getNextInstruction() {
3838
SM.updateNext();
3939
}
4040

41-
llvm::Error FetchStage::execute(InstRef & /*unused */) {
41+
llvm::Error EntryStage::execute(InstRef & /*unused */) {
4242
assert(CurrentInstruction && "There is no instruction to process!");
4343
if (llvm::Error Val = moveToTheNextStage(CurrentInstruction))
4444
return Val;
@@ -49,13 +49,13 @@ llvm::Error FetchStage::execute(InstRef & /*unused */) {
4949
return llvm::ErrorSuccess();
5050
}
5151

52-
llvm::Error FetchStage::cycleStart() {
52+
llvm::Error EntryStage::cycleStart() {
5353
if (!CurrentInstruction)
5454
getNextInstruction();
5555
return llvm::ErrorSuccess();
5656
}
5757

58-
llvm::Error FetchStage::cycleEnd() {
58+
llvm::Error EntryStage::cycleEnd() {
5959
// Find the first instruction which hasn't been retired.
6060
const InstMap::iterator It =
6161
llvm::find_if(Instructions, [](const InstMap::value_type &KeyValuePair) {

llvm/tools/llvm-mca/llvm-mca.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "CodeRegion.h"
2525
#include "CodeRegionGenerator.h"
2626
#include "PipelinePrinter.h"
27-
#include "Stages/FetchStage.h"
27+
#include "Stages/EntryStage.h"
2828
#include "Stages/InstructionTables.h"
2929
#include "Views/DispatchStatistics.h"
3030
#include "Views/InstructionInfoView.h"
@@ -434,7 +434,7 @@ int main(int argc, char **argv) {
434434
if (PrintInstructionTables) {
435435
// Create a pipeline, stages, and a printer.
436436
auto P = make_unique<mca::Pipeline>();
437-
P->appendStage(make_unique<mca::FetchStage>(S));
437+
P->appendStage(make_unique<mca::EntryStage>(S));
438438
P->appendStage(make_unique<mca::InstructionTables>(SM));
439439
mca::PipelinePrinter Printer(*P);
440440

0 commit comments

Comments
 (0)