Index: tools/llvm-mca/CMakeLists.txt =================================================================== --- tools/llvm-mca/CMakeLists.txt +++ 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) Index: tools/llvm-mca/include/Context.h =================================================================== --- tools/llvm-mca/include/Context.h +++ 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" Index: tools/llvm-mca/include/HardwareUnits/LSUnit.h =================================================================== --- tools/llvm-mca/include/HardwareUnits/LSUnit.h +++ 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 namespace mca { Index: tools/llvm-mca/include/HardwareUnits/RegisterFile.h =================================================================== --- tools/llvm-mca/include/HardwareUnits/RegisterFile.h +++ 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" Index: tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h =================================================================== --- tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h +++ 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 Index: tools/llvm-mca/include/HardwareUnits/Scheduler.h =================================================================== --- tools/llvm-mca/include/HardwareUnits/Scheduler.h +++ 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" Index: tools/llvm-mca/include/Pipeline.h =================================================================== --- tools/llvm-mca/include/Pipeline.h +++ 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" Index: tools/llvm-mca/include/Stages/DispatchStage.h =================================================================== --- tools/llvm-mca/include/Stages/DispatchStage.h +++ 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" Index: tools/llvm-mca/include/Stages/ExecuteStage.h =================================================================== --- tools/llvm-mca/include/Stages/ExecuteStage.h +++ 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 { Index: tools/llvm-mca/include/Stages/FetchStage.h =================================================================== --- tools/llvm-mca/include/Stages/FetchStage.h +++ 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 namespace mca { Index: tools/llvm-mca/include/Stages/InstructionTables.h =================================================================== --- tools/llvm-mca/include/Stages/InstructionTables.h +++ 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" Index: tools/llvm-mca/include/Stages/RetireStage.h =================================================================== --- tools/llvm-mca/include/Stages/RetireStage.h +++ 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 { Index: tools/llvm-mca/lib/CMakeLists.txt =================================================================== --- /dev/null +++ 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") Index: tools/llvm-mca/lib/Context.cpp =================================================================== --- tools/llvm-mca/lib/Context.cpp +++ 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 { Index: tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp +++ tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp @@ -13,7 +13,7 @@ /// //===----------------------------------------------------------------------===// -#include "HardwareUnit.h" +#include "HardwareUnits/HardwareUnit.h" namespace mca { Index: tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp +++ 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" Index: tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp +++ 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" Index: tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp +++ 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" Index: tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp +++ 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; Index: tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp =================================================================== --- tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp +++ 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" Index: tools/llvm-mca/lib/LLVMBuild.txt =================================================================== --- /dev/null +++ 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 Index: tools/llvm-mca/lib/Stages/DispatchStage.cpp =================================================================== --- tools/llvm-mca/lib/Stages/DispatchStage.cpp +++ 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; Index: tools/llvm-mca/lib/Stages/ExecuteStage.cpp =================================================================== --- tools/llvm-mca/lib/Stages/ExecuteStage.cpp +++ 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" Index: tools/llvm-mca/lib/Stages/FetchStage.cpp =================================================================== --- tools/llvm-mca/lib/Stages/FetchStage.cpp +++ tools/llvm-mca/lib/Stages/FetchStage.cpp @@ -13,7 +13,7 @@ /// //===----------------------------------------------------------------------===// -#include "FetchStage.h" +#include "Stages/FetchStage.h" namespace mca { Index: tools/llvm-mca/lib/Stages/InstructionTables.cpp =================================================================== --- tools/llvm-mca/lib/Stages/InstructionTables.cpp +++ tools/llvm-mca/lib/Stages/InstructionTables.cpp @@ -15,7 +15,7 @@ /// //===----------------------------------------------------------------------===// -#include "InstructionTables.h" +#include "Stages/InstructionTables.h" namespace mca { Index: tools/llvm-mca/lib/Stages/RetireStage.cpp =================================================================== --- tools/llvm-mca/lib/Stages/RetireStage.cpp +++ 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" Index: tools/llvm-mca/lib/Stages/Stage.cpp =================================================================== --- tools/llvm-mca/lib/Stages/Stage.cpp +++ tools/llvm-mca/lib/Stages/Stage.cpp @@ -13,7 +13,7 @@ /// //===----------------------------------------------------------------------===// -#include "Stage.h" +#include "Stages/Stage.h" namespace mca { Index: tools/llvm-mca/llvm-mca.cpp =================================================================== --- tools/llvm-mca/llvm-mca.cpp +++ 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"