[llvm] r345161 - [llvm-mca] Remove dependency from InstrBuilder in class InstructionTables.

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 09:56:43 PDT 2018


Author: adibiagio
Date: Wed Oct 24 09:56:43 2018
New Revision: 345161

URL: http://llvm.org/viewvc/llvm-project?rev=345161&view=rev
Log:
[llvm-mca] Remove dependency from InstrBuilder in class InstructionTables.

Also, removed the initialization of vectors used for processor resource masks.
Support function 'computeProcResourceMasks()' already calls method resize on
those vectors.
No functional change intended.

Modified:
    llvm/trunk/tools/llvm-mca/Views/SummaryView.cpp
    llvm/trunk/tools/llvm-mca/include/InstrBuilder.h
    llvm/trunk/tools/llvm-mca/include/Stages/InstructionTables.h
    llvm/trunk/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
    llvm/trunk/tools/llvm-mca/lib/Stages/InstructionTables.cpp
    llvm/trunk/tools/llvm-mca/llvm-mca.cpp

Modified: llvm/trunk/tools/llvm-mca/Views/SummaryView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Views/SummaryView.cpp?rev=345161&r1=345160&r2=345161&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Views/SummaryView.cpp (original)
+++ llvm/trunk/tools/llvm-mca/Views/SummaryView.cpp Wed Oct 24 09:56:43 2018
@@ -27,8 +27,7 @@ using namespace llvm;
 SummaryView::SummaryView(const MCSchedModel &Model, const SourceMgr &S,
                          unsigned Width)
     : SM(Model), Source(S), DispatchWidth(Width), TotalCycles(0),
-      NumMicroOps(0), ProcResourceUsage(Model.getNumProcResourceKinds(), 0),
-      ProcResourceMasks(Model.getNumProcResourceKinds(), 0) {
+      NumMicroOps(0), ProcResourceUsage(Model.getNumProcResourceKinds(), 0) {
   computeProcResourceMasks(SM, ProcResourceMasks);
 }
 

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=345161&r1=345160&r2=345161&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/include/InstrBuilder.h (original)
+++ llvm/trunk/tools/llvm-mca/include/InstrBuilder.h Wed Oct 24 09:56:43 2018
@@ -65,8 +65,7 @@ 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),
-        ProcResourceMasks(STI.getSchedModel().getNumProcResourceKinds()) {
+      : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia) {
     computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);
   }
 

Modified: llvm/trunk/tools/llvm-mca/include/Stages/InstructionTables.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/include/Stages/InstructionTables.h?rev=345161&r1=345160&r2=345161&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/include/Stages/InstructionTables.h (original)
+++ llvm/trunk/tools/llvm-mca/include/Stages/InstructionTables.h Wed Oct 24 09:56:43 2018
@@ -18,8 +18,8 @@
 #define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
 
 #include "HardwareUnits/Scheduler.h"
-#include "InstrBuilder.h"
 #include "Stages/Stage.h"
+#include "Support.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/MC/MCSchedule.h"
 
@@ -27,12 +27,13 @@ namespace mca {
 
 class InstructionTables final : public Stage {
   const llvm::MCSchedModel &SM;
-  InstrBuilder &IB;
   llvm::SmallVector<std::pair<ResourceRef, ResourceCycles>, 4> UsedResources;
+  llvm::SmallVector<uint64_t, 8> Masks;
 
 public:
-  InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder)
-      : Stage(), SM(Model), IB(Builder) {}
+  InstructionTables(const llvm::MCSchedModel &Model) : Stage(), SM(Model) {
+    computeProcResourceMasks(Model, Masks);
+  }
 
   bool hasWorkToComplete() const override { return false; }
   llvm::Error execute(InstRef &IR) override;

Modified: llvm/trunk/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp?rev=345161&r1=345160&r2=345161&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp (original)
+++ llvm/trunk/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp Wed Oct 24 09:56:43 2018
@@ -97,8 +97,7 @@ getStrategyFor(const ResourceState &RS)
   return std::unique_ptr<ResourceStrategy>(nullptr);
 }
 
-ResourceManager::ResourceManager(const MCSchedModel &SM)
-    : ProcResID2Mask(SM.getNumProcResourceKinds()) {
+ResourceManager::ResourceManager(const MCSchedModel &SM) {
   computeProcResourceMasks(SM, ProcResID2Mask);
   Resources.resize(SM.getNumProcResourceKinds());
   Strategies.resize(SM.getNumProcResourceKinds());

Modified: llvm/trunk/tools/llvm-mca/lib/Stages/InstructionTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/lib/Stages/InstructionTables.cpp?rev=345161&r1=345160&r2=345161&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/lib/Stages/InstructionTables.cpp (original)
+++ llvm/trunk/tools/llvm-mca/lib/Stages/InstructionTables.cpp Wed Oct 24 09:56:43 2018
@@ -22,7 +22,6 @@ namespace mca {
 using namespace llvm;
 
 Error InstructionTables::execute(InstRef &IR) {
-  ArrayRef<uint64_t> Masks = IB.getProcResourceMasks();
   const InstrDesc &Desc = IR.getInstruction()->getDesc();
   UsedResources.clear();
 

Modified: llvm/trunk/tools/llvm-mca/llvm-mca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/llvm-mca.cpp?rev=345161&r1=345160&r2=345161&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/llvm-mca.cpp (original)
+++ llvm/trunk/tools/llvm-mca/llvm-mca.cpp Wed Oct 24 09:56:43 2018
@@ -519,7 +519,7 @@ int main(int argc, char **argv) {
       //  Create a pipeline, stages, and a printer.
       auto P = llvm::make_unique<mca::Pipeline>();
       P->appendStage(llvm::make_unique<mca::FetchStage>(IB, S));
-      P->appendStage(llvm::make_unique<mca::InstructionTables>(SM, IB));
+      P->appendStage(llvm::make_unique<mca::InstructionTables>(SM));
       mca::PipelinePrinter Printer(*P);
 
       // Create the views for this pipeline, execute, and emit a report.




More information about the llvm-commits mailing list