diff options
author | Fangrui Song <maskray@google.com> | 2018-10-30 15:56:08 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-10-30 15:56:08 +0000 |
commit | 5a8fd65700324a0b2e8cc704ad2302114404a11a (patch) | |
tree | e558d06929eebb61dbd903b7ef28bfcadbd46d93 | |
parent | 74583444e7309233eff1fb30511158041737e1c9 (diff) | |
download | bcm5719-llvm-5a8fd65700324a0b2e8cc704ad2302114404a11a.tar.gz bcm5719-llvm-5a8fd65700324a0b2e8cc704ad2302114404a11a.zip |
[llvm-mca] Move namespace mca inside llvm::
Summary: This allows to remove `using namespace llvm;` in those *.cpp files
When we want to revisit the decision (everything resides in llvm::mca::*) in the future, we can move things to a nested namespace of llvm::mca::, to conceptually make them separate from the rest of llvm::mca::*
Reviewers: andreadb, mattd
Reviewed By: andreadb
Subscribers: javed.absar, tschuett, gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D53407
llvm-svn: 345612
59 files changed, 118 insertions, 42 deletions
diff --git a/llvm/tools/llvm-mca/CodeRegion.cpp b/llvm/tools/llvm-mca/CodeRegion.cpp index 591c45feb6d..29a27c50c17 100644 --- a/llvm/tools/llvm-mca/CodeRegion.cpp +++ b/llvm/tools/llvm-mca/CodeRegion.cpp @@ -14,6 +14,7 @@ #include "CodeRegion.h" +namespace llvm { namespace mca { bool CodeRegion::isLocInRange(llvm::SMLoc Loc) const { @@ -63,3 +64,4 @@ void CodeRegions::addInstruction(const llvm::MCInst &Instruction) { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/CodeRegion.h b/llvm/tools/llvm-mca/CodeRegion.h index 21ca8da9b53..6ca2bd15128 100644 --- a/llvm/tools/llvm-mca/CodeRegion.h +++ b/llvm/tools/llvm-mca/CodeRegion.h @@ -41,6 +41,7 @@ #include "llvm/Support/SourceMgr.h" #include <vector> +namespace llvm { namespace mca { /// A region of assembly code. @@ -123,5 +124,6 @@ public: }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/PipelinePrinter.cpp b/llvm/tools/llvm-mca/PipelinePrinter.cpp index 8b2157a8eb6..18ef45fc2a6 100644 --- a/llvm/tools/llvm-mca/PipelinePrinter.cpp +++ b/llvm/tools/llvm-mca/PipelinePrinter.cpp @@ -15,6 +15,7 @@ #include "PipelinePrinter.h" #include "Views/View.h" +namespace llvm { namespace mca { void PipelinePrinter::printReport(llvm::raw_ostream &OS) const { @@ -22,3 +23,4 @@ void PipelinePrinter::printReport(llvm::raw_ostream &OS) const { V->printView(OS); } } // namespace mca. +} // namespace llvm diff --git a/llvm/tools/llvm-mca/PipelinePrinter.h b/llvm/tools/llvm-mca/PipelinePrinter.h index a90b3a2af42..7e426383f21 100644 --- a/llvm/tools/llvm-mca/PipelinePrinter.h +++ b/llvm/tools/llvm-mca/PipelinePrinter.h @@ -24,6 +24,7 @@ #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { /// A printer class that knows how to collects statistics on the @@ -48,5 +49,6 @@ public: void printReport(llvm::raw_ostream &OS) const; }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_PIPELINEPRINTER_H diff --git a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp index 98adcfb450d..2562c82407b 100644 --- a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp @@ -16,8 +16,7 @@ #include "Views/DispatchStatistics.h" #include "llvm/Support/Format.h" -using namespace llvm; - +namespace llvm { namespace mca { void DispatchStatistics::onEvent(const HWStallEvent &Event) { @@ -84,3 +83,4 @@ void DispatchStatistics::printDispatchStalls(raw_ostream &OS) const { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/DispatchStatistics.h b/llvm/tools/llvm-mca/Views/DispatchStatistics.h index 0f6f75e0954..6679c81efe9 100644 --- a/llvm/tools/llvm-mca/Views/DispatchStatistics.h +++ b/llvm/tools/llvm-mca/Views/DispatchStatistics.h @@ -39,6 +39,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include <map> +namespace llvm { namespace mca { class DispatchStatistics : public View { @@ -80,5 +81,6 @@ public: } }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp b/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp index 0a97e569c47..5016afb49e4 100644 --- a/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp +++ b/llvm/tools/llvm-mca/Views/InstructionInfoView.cpp @@ -14,10 +14,9 @@ #include "Views/InstructionInfoView.h" +namespace llvm { namespace mca { -using namespace llvm; - void InstructionInfoView::printView(raw_ostream &OS) const { std::string Buffer; raw_string_ostream TempStream(Buffer); @@ -87,3 +86,4 @@ void InstructionInfoView::printView(raw_ostream &OS) const { OS << Buffer; } } // namespace mca. +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/InstructionInfoView.h b/llvm/tools/llvm-mca/Views/InstructionInfoView.h index f7bbe6147d7..3ef95d47449 100644 --- a/llvm/tools/llvm-mca/Views/InstructionInfoView.h +++ b/llvm/tools/llvm-mca/Views/InstructionInfoView.h @@ -45,6 +45,7 @@ #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { /// A view that prints out generic instruction information. @@ -63,5 +64,6 @@ public: void printView(llvm::raw_ostream &OS) const override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp index 2697f528a0a..bd638d9795a 100644 --- a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp @@ -15,8 +15,7 @@ #include "Views/RegisterFileStatistics.h" #include "llvm/Support/Format.h" -using namespace llvm; - +namespace llvm { namespace mca { RegisterFileStatistics::RegisterFileStatistics(const MCSubtargetInfo &sti) @@ -106,3 +105,4 @@ void RegisterFileStatistics::printView(raw_ostream &OS) const { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.h b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.h index 1e89d66dc50..86858d8bba8 100644 --- a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.h +++ b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.h @@ -36,6 +36,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCSubtargetInfo.h" +namespace llvm { namespace mca { class RegisterFileStatistics : public View { @@ -58,5 +59,6 @@ public: void printView(llvm::raw_ostream &OS) const override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp b/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp index e7943252206..6df61840437 100644 --- a/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp +++ b/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp @@ -16,10 +16,9 @@ #include "llvm/Support/FormattedStream.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { -using namespace llvm; - ResourcePressureView::ResourcePressureView(const llvm::MCSubtargetInfo &sti, MCInstPrinter &Printer, ArrayRef<MCInst> S) @@ -183,3 +182,4 @@ void ResourcePressureView::printResourcePressurePerInst(raw_ostream &OS) const { } } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/ResourcePressureView.h b/llvm/tools/llvm-mca/Views/ResourcePressureView.h index 5ee86df424b..572ce6fe6b7 100644 --- a/llvm/tools/llvm-mca/Views/ResourcePressureView.h +++ b/llvm/tools/llvm-mca/Views/ResourcePressureView.h @@ -65,6 +65,7 @@ #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCSubtargetInfo.h" +namespace llvm { namespace mca { /// This class collects resource pressure statistics and it is able to print @@ -98,5 +99,6 @@ public: } }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp index a9a4ac9a33d..7e2fd316c97 100644 --- a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp @@ -15,8 +15,7 @@ #include "Views/RetireControlUnitStatistics.h" #include "llvm/Support/Format.h" -using namespace llvm; - +namespace llvm { namespace mca { void RetireControlUnitStatistics::onEvent(const HWInstructionEvent &Event) { @@ -47,3 +46,4 @@ void RetireControlUnitStatistics::printView(raw_ostream &OS) const { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h index e9be542a786..9a4821ec31a 100644 --- a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h +++ b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.h @@ -30,6 +30,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include <map> +namespace llvm { namespace mca { class RetireControlUnitStatistics : public View { @@ -54,5 +55,6 @@ public: void printView(llvm::raw_ostream &OS) const override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/SchedulerStatistics.cpp b/llvm/tools/llvm-mca/Views/SchedulerStatistics.cpp index 958b3b548f4..edd6056c1e8 100644 --- a/llvm/tools/llvm-mca/Views/SchedulerStatistics.cpp +++ b/llvm/tools/llvm-mca/Views/SchedulerStatistics.cpp @@ -16,8 +16,7 @@ #include "llvm/Support/Format.h" #include "llvm/Support/FormattedStream.h" -using namespace llvm; - +namespace llvm { namespace mca { void SchedulerStatistics::onEvent(const HWInstructionEvent &Event) { @@ -127,3 +126,4 @@ void SchedulerStatistics::printView(raw_ostream &OS) const { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/SchedulerStatistics.h b/llvm/tools/llvm-mca/Views/SchedulerStatistics.h index 3515546f083..56dd3af1912 100644 --- a/llvm/tools/llvm-mca/Views/SchedulerStatistics.h +++ b/llvm/tools/llvm-mca/Views/SchedulerStatistics.h @@ -42,6 +42,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include <map> +namespace llvm { namespace mca { class SchedulerStatistics final : public View { @@ -86,5 +87,6 @@ public: void printView(llvm::raw_ostream &OS) const override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/SummaryView.cpp b/llvm/tools/llvm-mca/Views/SummaryView.cpp index 2007746b81f..fdf27600c93 100644 --- a/llvm/tools/llvm-mca/Views/SummaryView.cpp +++ b/llvm/tools/llvm-mca/Views/SummaryView.cpp @@ -18,12 +18,11 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Format.h" +namespace llvm { namespace mca { #define DEBUG_TYPE "llvm-mca" -using namespace llvm; - SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef<MCInst> S, unsigned Width) : SM(Model), Source(S), DispatchWidth(Width), LastInstructionIdx(0), @@ -88,3 +87,4 @@ void SummaryView::printView(raw_ostream &OS) const { OS << Buffer; } } // namespace mca. +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/SummaryView.h b/llvm/tools/llvm-mca/Views/SummaryView.h index 8c330f28f39..f59fd4233fb 100644 --- a/llvm/tools/llvm-mca/Views/SummaryView.h +++ b/llvm/tools/llvm-mca/Views/SummaryView.h @@ -34,6 +34,7 @@ #include "llvm/MC/MCSchedule.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { /// A view that collects and prints a few performance numbers. @@ -71,5 +72,6 @@ public: void printView(llvm::raw_ostream &OS) const override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/TimelineView.cpp b/llvm/tools/llvm-mca/Views/TimelineView.cpp index de347b54bd9..7d55bbc99c7 100644 --- a/llvm/tools/llvm-mca/Views/TimelineView.cpp +++ b/llvm/tools/llvm-mca/Views/TimelineView.cpp @@ -14,8 +14,7 @@ #include "Views/TimelineView.h" -using namespace llvm; - +namespace llvm { namespace mca { TimelineView::TimelineView(const MCSubtargetInfo &sti, MCInstPrinter &Printer, @@ -292,3 +291,4 @@ void TimelineView::printTimeline(raw_ostream &OS) const { } } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/TimelineView.h b/llvm/tools/llvm-mca/Views/TimelineView.h index 9b39a98c74a..ee981800161 100644 --- a/llvm/tools/llvm-mca/Views/TimelineView.h +++ b/llvm/tools/llvm-mca/Views/TimelineView.h @@ -108,6 +108,7 @@ #include "llvm/Support/FormattedStream.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { /// This class listens to instruction state transition events @@ -183,5 +184,6 @@ public: } }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/Views/View.cpp b/llvm/tools/llvm-mca/Views/View.cpp index 1cf4daeec84..6cfb9dd9f39 100644 --- a/llvm/tools/llvm-mca/Views/View.cpp +++ b/llvm/tools/llvm-mca/Views/View.cpp @@ -14,7 +14,9 @@ #include "Views/View.h" +namespace llvm { namespace mca { void View::anchor() {} } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/Views/View.h b/llvm/tools/llvm-mca/Views/View.h index 9ba94a5da97..c332bb53938 100644 --- a/llvm/tools/llvm-mca/Views/View.h +++ b/llvm/tools/llvm-mca/Views/View.h @@ -19,6 +19,7 @@ #include "HWEventListener.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { class View : public HWEventListener { @@ -28,5 +29,6 @@ public: void anchor() override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/Context.h b/llvm/tools/llvm-mca/include/Context.h index 9d64ae32f1c..d383e2361be 100644 --- a/llvm/tools/llvm-mca/include/Context.h +++ b/llvm/tools/llvm-mca/include/Context.h @@ -25,6 +25,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include <memory> +namespace llvm { namespace mca { /// This is a convenience struct to hold the parameters necessary for creating @@ -64,4 +65,5 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_CONTEXT_H diff --git a/llvm/tools/llvm-mca/include/HWEventListener.h b/llvm/tools/llvm-mca/include/HWEventListener.h index cef78041565..81c76c5eb8d 100644 --- a/llvm/tools/llvm-mca/include/HWEventListener.h +++ b/llvm/tools/llvm-mca/include/HWEventListener.h @@ -19,6 +19,7 @@ #include "Support.h" #include "llvm/ADT/ArrayRef.h" +namespace llvm { namespace mca { // An HWInstructionEvent represents state changes of instructions that @@ -151,5 +152,6 @@ private: virtual void anchor(); }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/HardwareUnit.h b/llvm/tools/llvm-mca/include/HardwareUnits/HardwareUnit.h index e8c496ab967..5070418c11b 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/HardwareUnit.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/HardwareUnit.h @@ -16,6 +16,7 @@ #ifndef LLVM_TOOLS_LLVM_MCA_HARDWAREUNIT_H #define LLVM_TOOLS_LLVM_MCA_HARDWAREUNIT_H +namespace llvm { namespace mca { class HardwareUnit { @@ -28,4 +29,5 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_HARDWAREUNIT_H diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h b/llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h index b348c973ee0..c979ac9cf82 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/LSUnit.h @@ -19,6 +19,7 @@ #include "HardwareUnits/HardwareUnit.h" #include <set> +namespace llvm { namespace mca { class InstRef; @@ -156,5 +157,6 @@ public: }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h b/llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h index 4b8b623bfe6..5a5543ebacd 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/RegisterFile.h @@ -24,6 +24,7 @@ #include "llvm/MC/MCSchedule.h" #include "llvm/Support/Error.h" +namespace llvm { namespace mca { class ReadState; @@ -225,5 +226,6 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_REGISTER_FILE_H diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h b/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h index dfac15f53fc..bf7c1e67115 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h @@ -23,6 +23,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCSchedule.h" +namespace llvm { namespace mca { /// Used to notify the internal state of a processor resource. @@ -357,5 +358,6 @@ public: #endif }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_RESOURCE_MANAGER_H diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h b/llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h index 552a2094ff1..2f7a1b1d503 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/RetireControlUnit.h @@ -20,6 +20,7 @@ #include "llvm/MC/MCSchedule.h" #include <vector> +namespace llvm { namespace mca { /// This class tracks which instructions are in-flight (i.e., dispatched but not @@ -98,5 +99,6 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_RETIRE_CONTROL_UNIT_H diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h b/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h index db124958ee5..941224c1204 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h @@ -22,6 +22,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCSchedule.h" +namespace llvm { namespace mca { class SchedulerStrategy { @@ -209,5 +210,6 @@ public: #endif // !NDEBUG }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_SCHEDULER_H diff --git a/llvm/tools/llvm-mca/include/InstrBuilder.h b/llvm/tools/llvm-mca/include/InstrBuilder.h index 0fd97cb1ed5..ca615c053c8 100644 --- a/llvm/tools/llvm-mca/include/InstrBuilder.h +++ b/llvm/tools/llvm-mca/include/InstrBuilder.h @@ -23,6 +23,7 @@ #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/Support/Error.h" +namespace llvm { namespace mca { /// A builder class that knows how to construct Instruction objects. @@ -71,5 +72,6 @@ public: createInstruction(const llvm::MCInst &MCI); }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/Instruction.h b/llvm/tools/llvm-mca/include/Instruction.h index bbb40c42576..8509af2e0ff 100644 --- a/llvm/tools/llvm-mca/include/Instruction.h +++ b/llvm/tools/llvm-mca/include/Instruction.h @@ -29,6 +29,7 @@ #include <set> #include <vector> +namespace llvm { namespace mca { constexpr int UNKNOWN_CYCLES = -512; @@ -508,5 +509,6 @@ public: }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/Pipeline.h b/llvm/tools/llvm-mca/include/Pipeline.h index ad487e7564b..cb58e9a1fbd 100644 --- a/llvm/tools/llvm-mca/include/Pipeline.h +++ b/llvm/tools/llvm-mca/include/Pipeline.h @@ -21,6 +21,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Error.h" +namespace llvm { namespace mca { class HWEventListener; @@ -70,5 +71,6 @@ public: void addEventListener(HWEventListener *Listener); }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_PIPELINE_H diff --git a/llvm/tools/llvm-mca/include/SourceMgr.h b/llvm/tools/llvm-mca/include/SourceMgr.h index 54b1a2c31ce..4a55bdba5b4 100644 --- a/llvm/tools/llvm-mca/include/SourceMgr.h +++ b/llvm/tools/llvm-mca/include/SourceMgr.h @@ -18,6 +18,7 @@ #include "llvm/ADT/ArrayRef.h" +namespace llvm { namespace mca { class Instruction; @@ -51,5 +52,6 @@ public: }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/Stages/DispatchStage.h b/llvm/tools/llvm-mca/include/Stages/DispatchStage.h index 5a2ac3e6088..0153c649b42 100644 --- a/llvm/tools/llvm-mca/include/Stages/DispatchStage.h +++ b/llvm/tools/llvm-mca/include/Stages/DispatchStage.h @@ -27,6 +27,7 @@ #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" +namespace llvm { namespace mca { // Implements the hardware dispatch logic. @@ -92,5 +93,6 @@ public: #endif }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_DISPATCH_STAGE_H diff --git a/llvm/tools/llvm-mca/include/Stages/ExecuteStage.h b/llvm/tools/llvm-mca/include/Stages/ExecuteStage.h index 63e6f0bc2b8..0f46c8a3878 100644 --- a/llvm/tools/llvm-mca/include/Stages/ExecuteStage.h +++ b/llvm/tools/llvm-mca/include/Stages/ExecuteStage.h @@ -23,6 +23,7 @@ #include "Stages/Stage.h" #include "llvm/ADT/ArrayRef.h" +namespace llvm { namespace mca { class ExecuteStage final : public Stage { @@ -74,5 +75,6 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_EXECUTE_STAGE_H diff --git a/llvm/tools/llvm-mca/include/Stages/FetchStage.h b/llvm/tools/llvm-mca/include/Stages/FetchStage.h index a7aba2276d9..8622ab07e9e 100644 --- a/llvm/tools/llvm-mca/include/Stages/FetchStage.h +++ b/llvm/tools/llvm-mca/include/Stages/FetchStage.h @@ -20,6 +20,7 @@ #include "Stages/Stage.h" #include <map> +namespace llvm { namespace mca { class FetchStage final : public Stage { @@ -45,5 +46,6 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_FETCH_STAGE_H diff --git a/llvm/tools/llvm-mca/include/Stages/InstructionTables.h b/llvm/tools/llvm-mca/include/Stages/InstructionTables.h index de31a7949bb..2b6e542d973 100644 --- a/llvm/tools/llvm-mca/include/Stages/InstructionTables.h +++ b/llvm/tools/llvm-mca/include/Stages/InstructionTables.h @@ -23,6 +23,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCSchedule.h" +namespace llvm { namespace mca { class InstructionTables final : public Stage { @@ -39,5 +40,6 @@ public: llvm::Error execute(InstRef &IR) override; }; } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/include/Stages/RetireStage.h b/llvm/tools/llvm-mca/include/Stages/RetireStage.h index 2041105a194..e9975ca3bbd 100644 --- a/llvm/tools/llvm-mca/include/Stages/RetireStage.h +++ b/llvm/tools/llvm-mca/include/Stages/RetireStage.h @@ -21,6 +21,7 @@ #include "HardwareUnits/RetireControlUnit.h" #include "Stages/Stage.h" +namespace llvm { namespace mca { class RetireStage final : public Stage { @@ -42,5 +43,6 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_RETIRE_STAGE_H diff --git a/llvm/tools/llvm-mca/include/Stages/Stage.h b/llvm/tools/llvm-mca/include/Stages/Stage.h index 5470c9cf0d9..383abbe217e 100644 --- a/llvm/tools/llvm-mca/include/Stages/Stage.h +++ b/llvm/tools/llvm-mca/include/Stages/Stage.h @@ -20,6 +20,7 @@ #include "llvm/Support/Error.h" #include <set> +namespace llvm { namespace mca { class InstRef; @@ -83,4 +84,5 @@ public: }; } // namespace mca +} // namespace llvm #endif // LLVM_TOOLS_LLVM_MCA_STAGE_H diff --git a/llvm/tools/llvm-mca/include/Support.h b/llvm/tools/llvm-mca/include/Support.h index 9371394542d..43fb72c0229 100644 --- a/llvm/tools/llvm-mca/include/Support.h +++ b/llvm/tools/llvm-mca/include/Support.h @@ -20,6 +20,7 @@ #include "llvm/MC/MCSchedule.h" #include "llvm/Support/Error.h" +namespace llvm { namespace mca { template <typename T> @@ -114,5 +115,6 @@ double computeBlockRThroughput(const llvm::MCSchedModel &SM, unsigned DispatchWidth, unsigned NumMicroOps, llvm::ArrayRef<unsigned> ProcResourceUsage); } // namespace mca +} // namespace llvm #endif diff --git a/llvm/tools/llvm-mca/lib/Context.cpp b/llvm/tools/llvm-mca/lib/Context.cpp index 4e30fc9de31..5b6f52478dd 100644 --- a/llvm/tools/llvm-mca/lib/Context.cpp +++ b/llvm/tools/llvm-mca/lib/Context.cpp @@ -24,10 +24,9 @@ #include "Stages/FetchStage.h" #include "Stages/RetireStage.h" +namespace llvm { namespace mca { -using namespace llvm; - std::unique_ptr<Pipeline> Context::createDefaultPipeline(const PipelineOptions &Opts, InstrBuilder &IB, SourceMgr &SrcMgr) { @@ -63,3 +62,4 @@ Context::createDefaultPipeline(const PipelineOptions &Opts, InstrBuilder &IB, } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HWEventListener.cpp b/llvm/tools/llvm-mca/lib/HWEventListener.cpp index f27a04a9a98..3930e2555a9 100644 --- a/llvm/tools/llvm-mca/lib/HWEventListener.cpp +++ b/llvm/tools/llvm-mca/lib/HWEventListener.cpp @@ -14,8 +14,10 @@ #include "HWEventListener.h" +namespace llvm { namespace mca { // Anchor the vtable here. void HWEventListener::anchor() {} } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp index daeda06d859..4e46ffacbd4 100644 --- a/llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp +++ b/llvm/tools/llvm-mca/lib/HardwareUnits/HardwareUnit.cpp @@ -15,9 +15,11 @@ #include "HardwareUnits/HardwareUnit.h" +namespace llvm { namespace mca { // Pin the vtable with this method. HardwareUnit::~HardwareUnit() = default; } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp index aca90165af2..6923c6e0dc8 100644 --- a/llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp +++ b/llvm/tools/llvm-mca/lib/HardwareUnits/LSUnit.cpp @@ -17,10 +17,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -using namespace llvm; - #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { #ifndef NDEBUG @@ -164,3 +163,4 @@ void LSUnit::onInstructionExecuted(const InstRef &IR) { } } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp index 4a2a00523ae..71aec49ce77 100644 --- a/llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp +++ b/llvm/tools/llvm-mca/lib/HardwareUnits/RegisterFile.cpp @@ -18,10 +18,9 @@ #include "Instruction.h" #include "llvm/Support/Debug.h" -using namespace llvm; - #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { RegisterFile::RegisterFile(const MCSchedModel &SM, const MCRegisterInfo &mri, @@ -469,3 +468,4 @@ void RegisterFile::dump() const { #endif } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp index e033217d52d..e371f50ed48 100644 --- a/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp +++ b/llvm/tools/llvm-mca/lib/HardwareUnits/ResourceManager.cpp @@ -18,10 +18,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { -using namespace llvm; - #define DEBUG_TYPE "llvm-mca" ResourceStrategy::~ResourceStrategy() = default; @@ -305,3 +304,4 @@ void ResourceManager::releaseResource(uint64_t ResourceID) { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp index 8f543eeb8c2..0456e1d7a5b 100644 --- a/llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp +++ b/llvm/tools/llvm-mca/lib/HardwareUnits/RetireControlUnit.cpp @@ -15,10 +15,9 @@ #include "HardwareUnits/RetireControlUnit.h" #include "llvm/Support/Debug.h" -using namespace llvm; - #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { RetireControlUnit::RetireControlUnit(const MCSchedModel &SM) @@ -85,3 +84,4 @@ void RetireControlUnit::dump() const { #endif } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp b/llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp index 3d91cb12c2d..b1ac8d99b86 100644 --- a/llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp +++ b/llvm/tools/llvm-mca/lib/HardwareUnits/Scheduler.cpp @@ -15,10 +15,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { -using namespace llvm; - #define DEBUG_TYPE "llvm-mca" void Scheduler::initializeStrategy(std::unique_ptr<SchedulerStrategy> S) { @@ -243,3 +242,4 @@ bool Scheduler::isReady(const InstRef &IR) const { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/InstrBuilder.cpp b/llvm/tools/llvm-mca/lib/InstrBuilder.cpp index 3704eaf6a50..535ad4d57fe 100644 --- a/llvm/tools/llvm-mca/lib/InstrBuilder.cpp +++ b/llvm/tools/llvm-mca/lib/InstrBuilder.cpp @@ -22,10 +22,9 @@ #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { -using namespace llvm; - InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti, const llvm::MCInstrInfo &mcii, const llvm::MCRegisterInfo &mri, @@ -539,3 +538,4 @@ InstrBuilder::createInstruction(const MCInst &MCI) { return std::move(NewIS); } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Instruction.cpp b/llvm/tools/llvm-mca/lib/Instruction.cpp index 42f5cd38ee9..832a6199f00 100644 --- a/llvm/tools/llvm-mca/lib/Instruction.cpp +++ b/llvm/tools/llvm-mca/lib/Instruction.cpp @@ -16,10 +16,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +namespace llvm { namespace mca { -using namespace llvm; - void ReadState::writeStartEvent(unsigned Cycles) { assert(DependentWrites); assert(CyclesLeft == UNKNOWN_CYCLES); @@ -181,3 +180,4 @@ void Instruction::cycleEvent() { const unsigned WriteRef::INVALID_IID = std::numeric_limits<unsigned>::max(); } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Pipeline.cpp b/llvm/tools/llvm-mca/lib/Pipeline.cpp index ad49522ad79..309f415913d 100644 --- a/llvm/tools/llvm-mca/lib/Pipeline.cpp +++ b/llvm/tools/llvm-mca/lib/Pipeline.cpp @@ -17,12 +17,11 @@ #include "HWEventListener.h" #include "llvm/Support/Debug.h" +namespace llvm { namespace mca { #define DEBUG_TYPE "llvm-mca" -using namespace llvm; - void Pipeline::addEventListener(HWEventListener *Listener) { if (Listener) Listeners.insert(Listener); @@ -95,3 +94,4 @@ void Pipeline::notifyCycleEnd() { Listener->onCycleEnd(); } } // namespace mca. +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp b/llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp index 0246151c64c..104446e711e 100644 --- a/llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp +++ b/llvm/tools/llvm-mca/lib/Stages/DispatchStage.cpp @@ -21,10 +21,9 @@ #include "HardwareUnits/Scheduler.h" #include "llvm/Support/Debug.h" -using namespace llvm; - #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { void DispatchStage::notifyInstructionDispatched(const InstRef &IR, @@ -185,3 +184,4 @@ void DispatchStage::dump() const { } #endif } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp b/llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp index 3b45a84c338..298f08a2887 100644 --- a/llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp +++ b/llvm/tools/llvm-mca/lib/Stages/ExecuteStage.cpp @@ -21,10 +21,9 @@ #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { -using namespace llvm; - HWStallEvent::GenericEventType toHWStallEventType(Scheduler::Status Status) { switch (Status) { case Scheduler::SC_LOAD_QUEUE_FULL: @@ -217,3 +216,4 @@ void ExecuteStage::notifyReservedOrReleasedBuffers(const InstRef &IR, } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp b/llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp index 85d06d2d183..6e91dd6121d 100644 --- a/llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp +++ b/llvm/tools/llvm-mca/lib/Stages/FetchStage.cpp @@ -16,6 +16,7 @@ #include "Stages/FetchStage.h" #include "Instruction.h" +namespace llvm { namespace mca { bool FetchStage::hasWorkToComplete() const { return CurrentInstruction; } @@ -69,3 +70,4 @@ llvm::Error FetchStage::cycleEnd() { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp b/llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp index 06319f857dc..33c30e7f95c 100644 --- a/llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp +++ b/llvm/tools/llvm-mca/lib/Stages/InstructionTables.cpp @@ -17,10 +17,9 @@ #include "Stages/InstructionTables.h" +namespace llvm { namespace mca { -using namespace llvm; - Error InstructionTables::execute(InstRef &IR) { const InstrDesc &Desc = IR.getInstruction()->getDesc(); UsedResources.clear(); @@ -67,3 +66,4 @@ Error InstructionTables::execute(InstRef &IR) { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp b/llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp index 8297c9c9ea5..47eed5f2c9c 100644 --- a/llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp +++ b/llvm/tools/llvm-mca/lib/Stages/RetireStage.cpp @@ -20,6 +20,7 @@ #define DEBUG_TYPE "llvm-mca" +namespace llvm { namespace mca { llvm::Error RetireStage::cycleStart() { @@ -58,3 +59,4 @@ void RetireStage::notifyInstructionRetired(const InstRef &IR) const { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Stages/Stage.cpp b/llvm/tools/llvm-mca/lib/Stages/Stage.cpp index e8cd74f2163..c3cfe47d24e 100644 --- a/llvm/tools/llvm-mca/lib/Stages/Stage.cpp +++ b/llvm/tools/llvm-mca/lib/Stages/Stage.cpp @@ -15,6 +15,7 @@ #include "Stages/Stage.h" +namespace llvm { namespace mca { // Pin the vtable here in the implementation file. @@ -25,3 +26,4 @@ void Stage::addListener(HWEventListener *Listener) { } } // namespace mca +} // namespace llvm diff --git a/llvm/tools/llvm-mca/lib/Support.cpp b/llvm/tools/llvm-mca/lib/Support.cpp index 8f6b8a91f38..a6ff26dafb5 100644 --- a/llvm/tools/llvm-mca/lib/Support.cpp +++ b/llvm/tools/llvm-mca/lib/Support.cpp @@ -16,10 +16,9 @@ #include "Support.h" #include "llvm/MC/MCSchedule.h" +namespace llvm { namespace mca { -using namespace llvm; - void computeProcResourceMasks(const MCSchedModel &SM, SmallVectorImpl<uint64_t> &Masks) { unsigned ProcResourceID = 0; @@ -77,3 +76,4 @@ double computeBlockRThroughput(const MCSchedModel &SM, unsigned DispatchWidth, } } // namespace mca +} // namespace llvm |