[llvm] r345259 - [llvm-mca] Removed a couple of redundant method declarations, and simplified code in ResourcePressureView. NFC
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 25 04:51:34 PDT 2018
Author: adibiagio
Date: Thu Oct 25 04:51:34 2018
New Revision: 345259
URL: http://llvm.org/viewvc/llvm-project?rev=345259&view=rev
Log:
[llvm-mca] Removed a couple of redundant method declarations, and simplified code in ResourcePressureView. NFC
Modified:
llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.cpp
llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.h
llvm/trunk/tools/llvm-mca/Views/RetireControlUnitStatistics.h
llvm/trunk/tools/llvm-mca/Views/SchedulerStatistics.h
llvm/trunk/tools/llvm-mca/Views/SummaryView.h
llvm/trunk/tools/llvm-mca/include/InstrBuilder.h
llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp
Modified: llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.cpp?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.cpp (original)
+++ llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.cpp Thu Oct 25 04:51:34 2018
@@ -20,7 +20,10 @@ namespace mca {
using namespace llvm;
-void ResourcePressureView::initialize() {
+ResourcePressureView::ResourcePressureView(const llvm::MCSubtargetInfo &sti,
+ llvm::MCInstPrinter &Printer,
+ const SourceMgr &Sequence)
+ : STI(sti), MCIP(Printer), Source(Sequence) {
// Populate the map of resource descriptors.
unsigned R2VIndex = 0;
const MCSchedModel &SM = STI.getSchedModel();
@@ -92,8 +95,7 @@ static void printResourcePressure(format
OS.PadToColumn(Col);
}
-void ResourcePressureView::printResourcePressurePerIteration(
- raw_ostream &OS, unsigned Executions) const {
+void ResourcePressureView::printResourcePressurePerIter(raw_ostream &OS) const {
std::string Buffer;
raw_string_ostream TempStream(Buffer);
formatted_raw_ostream FOS(TempStream);
@@ -126,6 +128,7 @@ void ResourcePressureView::printResource
FOS << '\n';
FOS.flush();
+ const unsigned Executions = Source.getNumIterations();
for (unsigned I = 0, E = NumResourceUnits; I < E; ++I) {
double Usage = ResourceUsage[I + Source.size() * E];
printResourcePressure(FOS, Usage / Executions, (I + 1) * 7);
@@ -135,8 +138,7 @@ void ResourcePressureView::printResource
OS << Buffer;
}
-void ResourcePressureView::printResourcePressurePerInstruction(
- raw_ostream &OS, unsigned Executions) const {
+void ResourcePressureView::printResourcePressurePerInst(raw_ostream &OS) const {
std::string Buffer;
raw_string_ostream TempStream(Buffer);
formatted_raw_ostream FOS(TempStream);
@@ -149,6 +151,7 @@ void ResourcePressureView::printResource
raw_string_ostream InstrStream(Instruction);
unsigned InstrIndex = 0;
+ const unsigned Executions = Source.getNumIterations();
for (const MCInst &MCI : Source) {
unsigned BaseEltIdx = InstrIndex * NumResourceUnits;
for (unsigned J = 0; J < NumResourceUnits; ++J) {
Modified: llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.h?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.h (original)
+++ llvm/trunk/tools/llvm-mca/Views/ResourcePressureView.h Thu Oct 25 04:51:34 2018
@@ -82,26 +82,17 @@ class ResourcePressureView : public View
std::vector<ResourceCycles> ResourceUsage;
unsigned NumResourceUnits;
- const llvm::MCInst &GetMCInstFromIndex(unsigned Index) const;
- void printResourcePressurePerIteration(llvm::raw_ostream &OS,
- unsigned Executions) const;
- void printResourcePressurePerInstruction(llvm::raw_ostream &OS,
- unsigned Executions) const;
- void initialize();
+ void printResourcePressurePerIter(llvm::raw_ostream &OS) const;
+ void printResourcePressurePerInst(llvm::raw_ostream &OS) const;
public:
ResourcePressureView(const llvm::MCSubtargetInfo &sti,
- llvm::MCInstPrinter &Printer, const SourceMgr &SM)
- : STI(sti), MCIP(Printer), Source(SM) {
- initialize();
- }
+ llvm::MCInstPrinter &Printer, const SourceMgr &SM);
void onEvent(const HWInstructionEvent &Event) override;
-
void printView(llvm::raw_ostream &OS) const override {
- unsigned Executions = Source.getNumIterations();
- printResourcePressurePerIteration(OS, Executions);
- printResourcePressurePerInstruction(OS, Executions);
+ printResourcePressurePerIter(OS);
+ printResourcePressurePerInst(OS);
}
};
} // namespace mca
Modified: llvm/trunk/tools/llvm-mca/Views/RetireControlUnitStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Views/RetireControlUnitStatistics.h?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Views/RetireControlUnitStatistics.h (original)
+++ llvm/trunk/tools/llvm-mca/Views/RetireControlUnitStatistics.h Thu Oct 25 04:51:34 2018
@@ -48,9 +48,7 @@ public:
RetireControlUnitStatistics() : NumRetired(0), NumCycles(0) {}
void onEvent(const HWInstructionEvent &Event) override;
-
void onCycleBegin() override { NumCycles++; }
-
void onCycleEnd() override { updateHistograms(); }
void printView(llvm::raw_ostream &OS) const override;
Modified: llvm/trunk/tools/llvm-mca/Views/SchedulerStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Views/SchedulerStatistics.h?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Views/SchedulerStatistics.h (original)
+++ llvm/trunk/tools/llvm-mca/Views/SchedulerStatistics.h Thu Oct 25 04:51:34 2018
@@ -70,9 +70,7 @@ public:
Usage(STI.getSchedModel().NumProcResourceKinds, {0, 0, 0}) {}
void onEvent(const HWInstructionEvent &Event) override;
-
void onCycleBegin() override { NumCycles++; }
-
void onCycleEnd() override { updateHistograms(); }
// Increases the number of used scheduler queue slots of every buffered
Modified: llvm/trunk/tools/llvm-mca/Views/SummaryView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Views/SummaryView.h?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Views/SummaryView.h (original)
+++ llvm/trunk/tools/llvm-mca/Views/SummaryView.h Thu Oct 25 04:51:34 2018
@@ -66,7 +66,6 @@ public:
unsigned Width);
void onCycleEnd() override { ++TotalCycles; }
-
void onEvent(const HWInstructionEvent &Event) override;
void printView(llvm::raw_ostream &OS) const override;
Modified: llvm/trunk/tools/llvm-mca/include/InstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/include/InstrBuilder.h?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/include/InstrBuilder.h (original)
+++ llvm/trunk/tools/llvm-mca/include/InstrBuilder.h Thu Oct 25 04:51:34 2018
@@ -62,20 +62,8 @@ class InstrBuilder {
const llvm::MCInst &MCI) const;
public:
- InstrBuilder(const llvm::MCSubtargetInfo &sti, const llvm::MCInstrInfo &mcii,
- const llvm::MCRegisterInfo &mri,
- const llvm::MCInstrAnalysis &mcia)
- : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
- computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
- }
-
- // Returns an array of processor resource masks.
- // Masks are computed by function mca::computeProcResourceMasks. see
- // Support.h for a description of how masks are computed and how masks can be
- // used to solve set membership problems.
- llvm::ArrayRef<uint64_t> getProcResourceMasks() const {
- return ProcResourceMasks;
- }
+ InstrBuilder(const llvm::MCSubtargetInfo &STI, const llvm::MCInstrInfo &MCII,
+ const llvm::MCRegisterInfo &RI, const llvm::MCInstrAnalysis &IA);
void clear() { VariantDescriptors.shrink_and_clear(); }
Modified: llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp?rev=345259&r1=345258&r2=345259&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp (original)
+++ llvm/trunk/tools/llvm-mca/lib/InstrBuilder.cpp Thu Oct 25 04:51:34 2018
@@ -26,6 +26,14 @@ namespace mca {
using namespace llvm;
+InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,
+ const llvm::MCInstrInfo &mcii,
+ const llvm::MCRegisterInfo &mri,
+ const llvm::MCInstrAnalysis &mcia)
+ : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
+ computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
+}
+
static void initializeUsedResources(InstrDesc &ID,
const MCSchedClassDesc &SCDesc,
const MCSubtargetInfo &STI,
More information about the llvm-commits
mailing list