[llvm-mca] Introduce the llvm-mca library and organize the directory accordingly. NFC.
Summary:
This patch introduces llvm-mca as a library. The driver (llvm-mca.cpp), views, and stats, are not part of the library.
Those are separate components that are not required for the functioning of llvm-mca.
The directory has been organized as follows:
All library source files now reside in:
- `lib/HardwareUnits/` - All subclasses of HardwareUnit (these represent the simulated hardware components of a backend).
(LSUnit does not inherit from HardwareUnit, but Scheduler does which uses LSUnit).
- `lib/Stages/` - All subclasses of the pipeline stages.
- `lib/` - This is the root of the library and contains library code that does not fit into the Stages or HardwareUnit subdirs.
All library header files now reside in the `include` directory and mimic the same layout as the `lib` directory mentioned above.
In the (near) future we would like to move the library (include and lib) contents from tools and into the core of llvm somewhere.
That change would allow various analysis and optimization passes to make use of MCA functionality for things like cost modeling.
I left all of the non-library code just where it has always been, in the root of the llvm-mca directory.
The include directives for the non-library source file have been updated to refer to the llvm-mca library headers.
I updated the llvm-mca/CMakeLists.txt file to include the library headers, but I made the non-library code
explicitly reference the library's 'include' directory. Once we eventually (hopefully) migrate the MCA library
components into llvm the include directives used by the non-library source files will be updated to point to the
proper location in llvm.
Reviewers: andreadb, courbet, RKSimon
Reviewed By: andreadb
Subscribers: mgorny, javed.absar, tschuett, gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D50929
llvm-svn: 340755
diff --git a/llvm/tools/llvm-mca/CMakeLists.txt b/llvm/tools/llvm-mca/CMakeLists.txt
index 63cbda5..fead673 100644
--- a/llvm/tools/llvm-mca/CMakeLists.txt
+++ b/llvm/tools/llvm-mca/CMakeLists.txt
@@ -1,3 +1,5 @@
+include_directories(include)
+
set(LLVM_LINK_COMPONENTS
AllTargetsAsmPrinters
AllTargetsAsmParsers
@@ -12,25 +14,7 @@
add_llvm_tool(llvm-mca
llvm-mca.cpp
CodeRegion.cpp
- Context.cpp
- DispatchStage.cpp
- ExecuteStage.cpp
- FetchStage.cpp
- HWEventListener.cpp
- HardwareUnit.cpp
- InstrBuilder.cpp
- Instruction.cpp
- InstructionTables.cpp
- LSUnit.cpp
- Pipeline.cpp
PipelinePrinter.cpp
- RegisterFile.cpp
- ResourceManager.cpp
- RetireControlUnit.cpp
- RetireStage.cpp
- Scheduler.cpp
- Stage.cpp
- Support.cpp
Views/DispatchStatistics.cpp
Views/InstructionInfoView.cpp
Views/RegisterFileStatistics.cpp
@@ -41,3 +25,7 @@
Views/TimelineView.cpp
Views/View.cpp
)
+
+set(LLVM_MCA_SOURCE_DIR ${CURRENT_SOURCE_DIR})
+add_subdirectory(lib)
+target_link_libraries(llvm-mca PRIVATE LLVMMCA)
diff --git a/llvm/tools/llvm-mca/Context.h b/llvm/tools/llvm-mca/include/Context.h
similarity index 98%
rename from llvm/tools/llvm-mca/Context.h
rename to llvm/tools/llvm-mca/include/Context.h
index ae8a376..6d0245f 100644
--- a/llvm/tools/llvm-mca/Context.h
+++ b/llvm/tools/llvm-mca/include/Context.h
@@ -17,7 +17,7 @@
#ifndef LLVM_TOOLS_LLVM_MCA_CONTEXT_H
#define LLVM_TOOLS_LLVM_MCA_CONTEXT_H
-#include "HardwareUnit.h"
+#include "HardwareUnits/HardwareUnit.h"
#include "InstrBuilder.h"
#include "Pipeline.h"
#include "SourceMgr.h"
diff --git a/llvm/tools/llvm-mca/HWEventListener.h b/llvm/tools/llvm-mca/include/HWEventListener.h
similarity index 100%
rename from llvm/tools/llvm-mca/HWEventListener.h
rename to llvm/tools/llvm-mca/include/HWEventListener.h
diff --git a/llvm/tools/llvm-mca/HardwareUnit.h b/llvm/tools/llvm-mca/include/HardwareUnits/HardwareUnit.h
similarity index 100%
rename from llvm/tools/llvm-mca/HardwareUnit.h
rename to llvm/tools/llvm-mca/include/HardwareUnits/HardwareUnit.h
diff --git a/llvm/tools/llvm-mca/LSUnit.h b/llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h
similarity index 99%
rename from llvm/tools/llvm-mca/LSUnit.h
rename to llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h
index ecd0fd3..b65f59b 100644
--- a/llvm/tools/llvm-mca/LSUnit.h
+++ b/llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h
@@ -16,7 +16,7 @@
#ifndef LLVM_TOOLS_LLVM_MCA_LSUNIT_H
#define LLVM_TOOLS_LLVM_MCA_LSUNIT_H
-#include "HardwareUnit.h"
+#include "HardwareUnits/HardwareUnit.h"
#include <set>
namespace mca {
diff --git a/llvm/tools/llvm-mca/RegisterFile.h b/llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h
similarity index 99%
rename from llvm/tools/llvm-mca/RegisterFile.h
rename to llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h
index 1f574cc..17272d6 100644
--- a/llvm/tools/llvm-mca/RegisterFile.h
+++ b/llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h
@@ -17,7 +17,7 @@
#ifndef LLVM_TOOLS_LLVM_MCA_REGISTER_FILE_H
#define LLVM_TOOLS_LLVM_MCA_REGISTER_FILE_H
-#include "HardwareUnit.h"
+#include "HardwareUnits/HardwareUnit.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSchedule.h"
diff --git a/llvm/tools/llvm-mca/ResourceManager.h b/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h
similarity index 100%
rename from llvm/tools/llvm-mca/ResourceManager.h
rename to llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h
diff --git a/llvm/tools/llvm-mca/RetireControlUnit.h b/llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h
similarity index 98%
rename from llvm/tools/llvm-mca/RetireControlUnit.h
rename to llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h
index 4f2fed1..7f2d699 100644
--- a/llvm/tools/llvm-mca/RetireControlUnit.h
+++ b/llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h
@@ -15,7 +15,7 @@
#ifndef LLVM_TOOLS_LLVM_MCA_RETIRE_CONTROL_UNIT_H
#define LLVM_TOOLS_LLVM_MCA_RETIRE_CONTROL_UNIT_H
-#include "HardwareUnit.h"
+#include "HardwareUnits/HardwareUnit.h"
#include "Instruction.h"
#include "llvm/MC/MCSchedule.h"
#include <vector>
diff --git a/llvm/tools/llvm-mca/Scheduler.h b/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h
similarity index 98%
rename from llvm/tools/llvm-mca/Scheduler.h
rename to llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h
index 70f90c5..61bbf3f 100644
--- a/llvm/tools/llvm-mca/Scheduler.h
+++ b/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h
@@ -15,8 +15,8 @@
#ifndef LLVM_TOOLS_LLVM_MCA_SCHEDULER_H
#define LLVM_TOOLS_LLVM_MCA_SCHEDULER_H
-#include "HardwareUnit.h"
-#include "LSUnit.h"
+#include "HardwareUnits/HardwareUnit.h"
+#include "HardwareUnits/LSUnit.h"
#include "ResourceManager.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCSchedule.h"
diff --git a/llvm/tools/llvm-mca/InstrBuilder.h b/llvm/tools/llvm-mca/include/InstrBuilder.h
similarity index 100%
rename from llvm/tools/llvm-mca/InstrBuilder.h
rename to llvm/tools/llvm-mca/include/InstrBuilder.h
diff --git a/llvm/tools/llvm-mca/Instruction.h b/llvm/tools/llvm-mca/include/Instruction.h
similarity index 100%
rename from llvm/tools/llvm-mca/Instruction.h
rename to llvm/tools/llvm-mca/include/Instruction.h
diff --git a/llvm/tools/llvm-mca/Pipeline.h b/llvm/tools/llvm-mca/include/Pipeline.h
similarity index 97%
rename from llvm/tools/llvm-mca/Pipeline.h
rename to llvm/tools/llvm-mca/include/Pipeline.h
index dfc3fc1..dc8ee0a 100644
--- a/llvm/tools/llvm-mca/Pipeline.h
+++ b/llvm/tools/llvm-mca/include/Pipeline.h
@@ -16,8 +16,8 @@
#ifndef LLVM_TOOLS_LLVM_MCA_PIPELINE_H
#define LLVM_TOOLS_LLVM_MCA_PIPELINE_H
-#include "Scheduler.h"
-#include "Stage.h"
+#include "HardwareUnits/Scheduler.h"
+#include "Stages/Stage.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Error.h"
diff --git a/llvm/tools/llvm-mca/SourceMgr.h b/llvm/tools/llvm-mca/include/SourceMgr.h
similarity index 100%
rename from llvm/tools/llvm-mca/SourceMgr.h
rename to llvm/tools/llvm-mca/include/SourceMgr.h
diff --git a/llvm/tools/llvm-mca/DispatchStage.h b/llvm/tools/llvm-mca/include/Stages/DispatchStage.h
similarity index 96%
rename from llvm/tools/llvm-mca/DispatchStage.h
rename to llvm/tools/llvm-mca/include/Stages/DispatchStage.h
index 8b18413..8caa002 100644
--- a/llvm/tools/llvm-mca/DispatchStage.h
+++ b/llvm/tools/llvm-mca/include/Stages/DispatchStage.h
@@ -20,10 +20,10 @@
#define LLVM_TOOLS_LLVM_MCA_DISPATCH_STAGE_H
#include "HWEventListener.h"
+#include "HardwareUnits/RegisterFile.h"
+#include "HardwareUnits/RetireControlUnit.h"
#include "Instruction.h"
-#include "RegisterFile.h"
-#include "RetireControlUnit.h"
-#include "Stage.h"
+#include "Stages/Stage.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
diff --git a/llvm/tools/llvm-mca/ExecuteStage.h b/llvm/tools/llvm-mca/include/Stages/ExecuteStage.h
similarity index 97%
rename from llvm/tools/llvm-mca/ExecuteStage.h
rename to llvm/tools/llvm-mca/include/Stages/ExecuteStage.h
index 13ca612..b6bcba9 100644
--- a/llvm/tools/llvm-mca/ExecuteStage.h
+++ b/llvm/tools/llvm-mca/include/Stages/ExecuteStage.h
@@ -18,9 +18,9 @@
#ifndef LLVM_TOOLS_LLVM_MCA_EXECUTE_STAGE_H
#define LLVM_TOOLS_LLVM_MCA_EXECUTE_STAGE_H
+#include "HardwareUnits/Scheduler.h"
#include "Instruction.h"
-#include "Scheduler.h"
-#include "Stage.h"
+#include "Stages/Stage.h"
#include "llvm/ADT/ArrayRef.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/FetchStage.h b/llvm/tools/llvm-mca/include/Stages/FetchStage.h
similarity index 98%
rename from llvm/tools/llvm-mca/FetchStage.h
rename to llvm/tools/llvm-mca/include/Stages/FetchStage.h
index a0ab68a..10a89c9 100644
--- a/llvm/tools/llvm-mca/FetchStage.h
+++ b/llvm/tools/llvm-mca/include/Stages/FetchStage.h
@@ -18,7 +18,7 @@
#include "InstrBuilder.h"
#include "SourceMgr.h"
-#include "Stage.h"
+#include "Stages/Stage.h"
#include <map>
namespace mca {
diff --git a/llvm/tools/llvm-mca/InstructionTables.h b/llvm/tools/llvm-mca/include/Stages/InstructionTables.h
similarity index 94%
rename from llvm/tools/llvm-mca/InstructionTables.h
rename to llvm/tools/llvm-mca/include/Stages/InstructionTables.h
index 346f872..f8a299a 100644
--- a/llvm/tools/llvm-mca/InstructionTables.h
+++ b/llvm/tools/llvm-mca/include/Stages/InstructionTables.h
@@ -17,9 +17,9 @@
#ifndef LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
#define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
+#include "HardwareUnits/Scheduler.h"
#include "InstrBuilder.h"
-#include "Scheduler.h"
-#include "Stage.h"
+#include "Stages/Stage.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/MCSchedule.h"
diff --git a/llvm/tools/llvm-mca/RetireStage.h b/llvm/tools/llvm-mca/include/Stages/RetireStage.h
similarity index 92%
rename from llvm/tools/llvm-mca/RetireStage.h
rename to llvm/tools/llvm-mca/include/Stages/RetireStage.h
index b4432ca..88a7d26 100644
--- a/llvm/tools/llvm-mca/RetireStage.h
+++ b/llvm/tools/llvm-mca/include/Stages/RetireStage.h
@@ -17,9 +17,9 @@
#ifndef LLVM_TOOLS_LLVM_MCA_RETIRE_STAGE_H
#define LLVM_TOOLS_LLVM_MCA_RETIRE_STAGE_H
-#include "RegisterFile.h"
-#include "RetireControlUnit.h"
-#include "Stage.h"
+#include "HardwareUnits/RegisterFile.h"
+#include "HardwareUnits/RetireControlUnit.h"
+#include "Stages/Stage.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/Stage.h b/llvm/tools/llvm-mca/include/Stages/Stage.h
similarity index 100%
rename from llvm/tools/llvm-mca/Stage.h
rename to llvm/tools/llvm-mca/include/Stages/Stage.h
diff --git a/llvm/tools/llvm-mca/Support.h b/llvm/tools/llvm-mca/include/Support.h
similarity index 100%
rename from llvm/tools/llvm-mca/Support.h
rename to llvm/tools/llvm-mca/include/Support.h
diff --git a/llvm/tools/llvm-mca/lib/CMakeLists.txt b/llvm/tools/llvm-mca/lib/CMakeLists.txt
new file mode 100644
index 0000000..df9ed32
--- /dev/null
+++ b/llvm/tools/llvm-mca/lib/CMakeLists.txt
@@ -0,0 +1,33 @@
+include_directories(${LLVM_MCA_SOURCE_DIR}/include)
+
+add_library(LLVMMCA
+ STATIC
+ Context.cpp
+ HWEventListener.cpp
+ HardwareUnits/HardwareUnit.cpp
+ HardwareUnits/LSUnit.cpp
+ HardwareUnits/RegisterFile.cpp
+ HardwareUnits/ResourceManager.cpp
+ HardwareUnits/RetireControlUnit.cpp
+ HardwareUnits/Scheduler.cpp
+ InstrBuilder.cpp
+ Instruction.cpp
+ Pipeline.cpp
+ Stages/DispatchStage.cpp
+ Stages/ExecuteStage.cpp
+ Stages/FetchStage.cpp
+ Stages/InstructionTables.cpp
+ Stages/RetireStage.cpp
+ Stages/Stage.cpp
+ Support.cpp
+ )
+
+llvm_update_compile_flags(LLVMMCA)
+llvm_map_components_to_libnames(libs
+ CodeGen
+ MC
+ Support
+ )
+
+target_link_libraries(LLVMMCA ${libs})
+set_target_properties(LLVMMCA PROPERTIES FOLDER "Libraries")
diff --git a/llvm/tools/llvm-mca/Context.cpp b/llvm/tools/llvm-mca/lib/Context.cpp
similarity index 89%
rename from llvm/tools/llvm-mca/Context.cpp
rename to llvm/tools/llvm-mca/lib/Context.cpp
index bf57498..31c09dc 100644
--- a/llvm/tools/llvm-mca/Context.cpp
+++ b/llvm/tools/llvm-mca/lib/Context.cpp
@@ -16,13 +16,13 @@
//===----------------------------------------------------------------------===//
#include "Context.h"
-#include "DispatchStage.h"
-#include "ExecuteStage.h"
-#include "FetchStage.h"
-#include "RegisterFile.h"
-#include "RetireControlUnit.h"
-#include "RetireStage.h"
-#include "Scheduler.h"
+#include "HardwareUnits/RegisterFile.h"
+#include "HardwareUnits/RetireControlUnit.h"
+#include "HardwareUnits/Scheduler.h"
+#include "Stages/DispatchStage.h"
+#include "Stages/ExecuteStage.h"
+#include "Stages/FetchStage.h"
+#include "Stages/RetireStage.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/HWEventListener.cpp b/llvm/tools/llvm-mca/lib/HWEventListener.cpp
similarity index 100%
rename from llvm/tools/llvm-mca/HWEventListener.cpp
rename to llvm/tools/llvm-mca/lib/HWEventListener.cpp
diff --git a/llvm/tools/llvm-mca/HardwareUnit.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp
similarity index 93%
rename from llvm/tools/llvm-mca/HardwareUnit.cpp
rename to llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp
index 103cde9..daeda06 100644
--- a/llvm/tools/llvm-mca/HardwareUnit.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp
@@ -13,7 +13,7 @@
///
//===----------------------------------------------------------------------===//
-#include "HardwareUnit.h"
+#include "HardwareUnits/HardwareUnit.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/LSUnit.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp
similarity index 98%
rename from llvm/tools/llvm-mca/LSUnit.cpp
rename to llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp
index e8d32da..b845c5b 100644
--- a/llvm/tools/llvm-mca/LSUnit.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp
@@ -12,9 +12,8 @@
///
//===----------------------------------------------------------------------===//
-#include "LSUnit.h"
+#include "HardwareUnits/LSUnit.h"
#include "Instruction.h"
-
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/llvm/tools/llvm-mca/RegisterFile.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp
similarity index 99%
rename from llvm/tools/llvm-mca/RegisterFile.cpp
rename to llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp
index cba17a6..081fd3b 100644
--- a/llvm/tools/llvm-mca/RegisterFile.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp
@@ -14,7 +14,7 @@
///
//===----------------------------------------------------------------------===//
-#include "RegisterFile.h"
+#include "HardwareUnits/RegisterFile.h"
#include "Instruction.h"
#include "llvm/Support/Debug.h"
diff --git a/llvm/tools/llvm-mca/ResourceManager.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
similarity index 99%
rename from llvm/tools/llvm-mca/ResourceManager.cpp
rename to llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
index 80ea73e..18d0e74 100644
--- a/llvm/tools/llvm-mca/ResourceManager.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp
@@ -13,7 +13,7 @@
///
//===----------------------------------------------------------------------===//
-#include "ResourceManager.h"
+#include "HardwareUnits/ResourceManager.h"
#include "Support.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/llvm/tools/llvm-mca/RetireControlUnit.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp
similarity index 98%
rename from llvm/tools/llvm-mca/RetireControlUnit.cpp
rename to llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp
index 1230585..205fe84 100644
--- a/llvm/tools/llvm-mca/RetireControlUnit.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp
@@ -12,7 +12,7 @@
///
//===----------------------------------------------------------------------===//
-#include "RetireControlUnit.h"
+#include "HardwareUnits/RetireControlUnit.h"
#include "llvm/Support/Debug.h"
using namespace llvm;
diff --git a/llvm/tools/llvm-mca/Scheduler.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp
similarity index 99%
rename from llvm/tools/llvm-mca/Scheduler.cpp
rename to llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp
index b0b0d71..151af23 100644
--- a/llvm/tools/llvm-mca/Scheduler.cpp
+++ b/llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp
@@ -11,7 +11,7 @@
//
//===----------------------------------------------------------------------===//
-#include "Scheduler.h"
+#include "HardwareUnits/Scheduler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/llvm/tools/llvm-mca/InstrBuilder.cpp b/llvm/tools/llvm-mca/lib/InstrBuilder.cpp
similarity index 100%
rename from llvm/tools/llvm-mca/InstrBuilder.cpp
rename to llvm/tools/llvm-mca/lib/InstrBuilder.cpp
diff --git a/llvm/tools/llvm-mca/Instruction.cpp b/llvm/tools/llvm-mca/lib/Instruction.cpp
similarity index 100%
rename from llvm/tools/llvm-mca/Instruction.cpp
rename to llvm/tools/llvm-mca/lib/Instruction.cpp
diff --git a/llvm/tools/llvm-mca/lib/LLVMBuild.txt b/llvm/tools/llvm-mca/lib/LLVMBuild.txt
new file mode 100644
index 0000000..e3bf632
--- /dev/null
+++ b/llvm/tools/llvm-mca/lib/LLVMBuild.txt
@@ -0,0 +1,22 @@
+;===- ./tools/llvm-mca/lib/LLVMBuild.txt -----------------------*- Conf -*--===;
+;
+; The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+; http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Library
+name = MCA
+parent = Libraries
+required_libraries = CodeGen MC Support
diff --git a/llvm/tools/llvm-mca/Pipeline.cpp b/llvm/tools/llvm-mca/lib/Pipeline.cpp
similarity index 100%
rename from llvm/tools/llvm-mca/Pipeline.cpp
rename to llvm/tools/llvm-mca/lib/Pipeline.cpp
diff --git a/llvm/tools/llvm-mca/DispatchStage.cpp b/llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp
similarity index 98%
rename from llvm/tools/llvm-mca/DispatchStage.cpp
rename to llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp
index cb96446..81098cb 100644
--- a/llvm/tools/llvm-mca/DispatchStage.cpp
+++ b/llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp
@@ -16,9 +16,9 @@
///
//===----------------------------------------------------------------------===//
-#include "DispatchStage.h"
+#include "Stages/DispatchStage.h"
#include "HWEventListener.h"
-#include "Scheduler.h"
+#include "HardwareUnits/Scheduler.h"
#include "llvm/Support/Debug.h"
using namespace llvm;
diff --git a/llvm/tools/llvm-mca/ExecuteStage.cpp b/llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp
similarity index 99%
rename from llvm/tools/llvm-mca/ExecuteStage.cpp
rename to llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp
index 7f604d6..7fff4b8 100644
--- a/llvm/tools/llvm-mca/ExecuteStage.cpp
+++ b/llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp
@@ -15,7 +15,7 @@
///
//===----------------------------------------------------------------------===//
-#include "ExecuteStage.h"
+#include "Stages/ExecuteStage.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Debug.h"
diff --git a/llvm/tools/llvm-mca/FetchStage.cpp b/llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp
similarity index 98%
rename from llvm/tools/llvm-mca/FetchStage.cpp
rename to llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp
index 60c9e6f..99c0aab 100644
--- a/llvm/tools/llvm-mca/FetchStage.cpp
+++ b/llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp
@@ -13,7 +13,7 @@
///
//===----------------------------------------------------------------------===//
-#include "FetchStage.h"
+#include "Stages/FetchStage.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/InstructionTables.cpp b/llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp
similarity index 98%
rename from llvm/tools/llvm-mca/InstructionTables.cpp
rename to llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp
index be948d8..1fdeefa 100644
--- a/llvm/tools/llvm-mca/InstructionTables.cpp
+++ b/llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp
@@ -15,7 +15,7 @@
///
//===----------------------------------------------------------------------===//
-#include "InstructionTables.h"
+#include "Stages/InstructionTables.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/RetireStage.cpp b/llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp
similarity index 98%
rename from llvm/tools/llvm-mca/RetireStage.cpp
rename to llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp
index 4e0f380..768a68e 100644
--- a/llvm/tools/llvm-mca/RetireStage.cpp
+++ b/llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp
@@ -14,7 +14,7 @@
///
//===----------------------------------------------------------------------===//
-#include "RetireStage.h"
+#include "Stages/RetireStage.h"
#include "HWEventListener.h"
#include "llvm/Support/Debug.h"
diff --git a/llvm/tools/llvm-mca/Stage.cpp b/llvm/tools/llvm-mca/lib/Stages/Stage.cpp
similarity index 96%
rename from llvm/tools/llvm-mca/Stage.cpp
rename to llvm/tools/llvm-mca/lib/Stages/Stage.cpp
index 5cf76ab..e8cd74f 100644
--- a/llvm/tools/llvm-mca/Stage.cpp
+++ b/llvm/tools/llvm-mca/lib/Stages/Stage.cpp
@@ -13,7 +13,7 @@
///
//===----------------------------------------------------------------------===//
-#include "Stage.h"
+#include "Stages/Stage.h"
namespace mca {
diff --git a/llvm/tools/llvm-mca/Support.cpp b/llvm/tools/llvm-mca/lib/Support.cpp
similarity index 100%
rename from llvm/tools/llvm-mca/Support.cpp
rename to llvm/tools/llvm-mca/lib/Support.cpp
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 6ef9367..5a94a6b 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -22,11 +22,9 @@
//===----------------------------------------------------------------------===//
#include "CodeRegion.h"
-#include "Context.h"
-#include "FetchStage.h"
-#include "InstructionTables.h"
-#include "Pipeline.h"
#include "PipelinePrinter.h"
+#include "Stages/FetchStage.h"
+#include "Stages/InstructionTables.h"
#include "Views/DispatchStatistics.h"
#include "Views/InstructionInfoView.h"
#include "Views/RegisterFileStatistics.h"
@@ -35,6 +33,8 @@
#include "Views/SchedulerStatistics.h"
#include "Views/SummaryView.h"
#include "Views/TimelineView.h"
+#include "include/Context.h"
+#include "include/Pipeline.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectFileInfo.h"