diff options
author | Fangrui Song <maskray@google.com> | 2018-10-22 17:10:47 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-10-22 17:10:47 +0000 |
commit | 32401afd8cb86680afa1bc93e732b5fbc5a83401 (patch) | |
tree | 104d8d309cfeaaf0686baf678eb784dd6116b8a7 | |
parent | 8d8dcfe690e64608f89af071038851f1c4925ee4 (diff) | |
download | llvm-32401afd8cb86680afa1bc93e732b5fbc5a83401.zip llvm-32401afd8cb86680afa1bc93e732b5fbc5a83401.tar.gz llvm-32401afd8cb86680afa1bc93e732b5fbc5a83401.tar.bz2 |
[llvm-exegesis] Move namespace exegesis inside llvm::
Summary:
This allows simplifying references of llvm::foo with foo when the needs
come in the future.
Reviewers: courbet, gchatelet
Reviewed By: gchatelet
Subscribers: javed.absar, tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D53455
llvm-svn: 344922
47 files changed, 148 insertions, 52 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp b/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp index 90c5927..be8f0b4 100644 --- a/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp @@ -11,6 +11,7 @@ #include "AArch64.h" #include "AArch64RegisterInfo.h" +namespace llvm { namespace exegesis { namespace { @@ -90,3 +91,4 @@ void InitializeAArch64ExegesisTarget() { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.cpp b/llvm/tools/llvm-exegesis/lib/Analysis.cpp index 73c54f5..0dd6bcb 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.cpp +++ b/llvm/tools/llvm-exegesis/lib/Analysis.cpp @@ -15,6 +15,7 @@ #include <unordered_set> #include <vector> +namespace llvm { namespace exegesis { static const char kCsvSep = ','; @@ -796,3 +797,4 @@ std::vector<std::pair<uint16_t, float>> computeIdealizedProcResPressure( } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Analysis.h b/llvm/tools/llvm-exegesis/lib/Analysis.h index a65a2f1..9ee1493 100644 --- a/llvm/tools/llvm-exegesis/lib/Analysis.h +++ b/llvm/tools/llvm-exegesis/lib/Analysis.h @@ -30,6 +30,7 @@ #include <string> #include <unordered_map> +namespace llvm { namespace exegesis { // A helper class to analyze benchmark results for a target. @@ -135,5 +136,6 @@ std::vector<std::pair<uint16_t, float>> computeIdealizedProcResPressure( llvm::SmallVector<llvm::MCWriteProcResEntry, 8> WPRS); } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_CLUSTERING_H diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.cpp b/llvm/tools/llvm-exegesis/lib/Assembler.cpp index 1576cfe..771a6e9 100644 --- a/llvm/tools/llvm-exegesis/lib/Assembler.cpp +++ b/llvm/tools/llvm-exegesis/lib/Assembler.cpp @@ -23,6 +23,7 @@ #include "llvm/MC/MCInstrInfo.h" #include "llvm/Support/MemoryBuffer.h" +namespace llvm { namespace exegesis { static constexpr const char ModuleID[] = "ExegesisInfoTest"; @@ -295,3 +296,4 @@ ExecutableFunction::ExecutableFunction( } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Assembler.h b/llvm/tools/llvm-exegesis/lib/Assembler.h index f2a7716..ee6bc86 100644 --- a/llvm/tools/llvm-exegesis/lib/Assembler.h +++ b/llvm/tools/llvm-exegesis/lib/Assembler.h @@ -32,6 +32,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetMachine.h" +namespace llvm { namespace exegesis { class ExegesisTarget; @@ -82,5 +83,6 @@ struct ExecutableFunction { }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_ASSEMBLER_H diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h b/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h index b10dca5..38bea25 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkCode.h @@ -15,6 +15,7 @@ #include <string> #include <vector> +namespace llvm { namespace exegesis { // A collection of instructions that are to be assembled, executed and measured. @@ -35,5 +36,6 @@ struct BenchmarkCode { }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKCODE_H diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 5d4912e..4b91c6c 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -22,6 +22,10 @@ static constexpr const char kIntegerPrefix[] = "i_0x"; static constexpr const char kDoublePrefix[] = "f_"; static constexpr const char kInvalidOperand[] = "INVALID"; +namespace llvm { + +namespace { + // A mutable struct holding an LLVMState that can be passed through the // serialization process to encode/decode registers and instructions. struct YamlContext { @@ -141,13 +145,13 @@ private: return 0; } - const exegesis::LLVMState *State; + const llvm::exegesis::LLVMState *State; std::string LastError; llvm::raw_string_ostream ErrorStream; }; +} // namespace // Defining YAML traits for IO. -namespace llvm { namespace yaml { static YamlContext &getTypedContext(void *Ctx) { @@ -294,7 +298,6 @@ struct MappingContextTraits<exegesis::InstructionBenchmark, YamlContext> { }; } // namespace yaml -} // namespace llvm namespace exegesis { @@ -384,3 +387,4 @@ void PerInstructionStats::push(const BenchmarkMeasure &BM) { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h index 961c07b..773a2e5 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h @@ -28,6 +28,7 @@ #include <unordered_map> #include <vector> +namespace llvm { namespace exegesis { struct InstructionBenchmarkKey { @@ -111,5 +112,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 4eb5f1e..0d37236 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -22,6 +22,7 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Program.h" +namespace llvm { namespace exegesis { BenchmarkFailure::BenchmarkFailure(const llvm::Twine &S) @@ -173,3 +174,4 @@ BenchmarkRunner::writeObjectFile(const BenchmarkCode &BC, BenchmarkRunner::FunctionExecutor::~FunctionExecutor() {} } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h index 517155d..4f77f49 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -27,6 +27,7 @@ #include <memory> #include <vector> +namespace llvm { namespace exegesis { // A class representing failures that happened during Benchmark, they are used @@ -90,5 +91,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRUNNER_H diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp index b63afec..7616291 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp +++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp @@ -11,6 +11,7 @@ #include <string> #include <unordered_set> +namespace llvm { namespace exegesis { // The clustering problem has the following characteristics: @@ -170,3 +171,4 @@ InstructionBenchmarkClustering::create( } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.h b/llvm/tools/llvm-exegesis/lib/Clustering.h index c811020..9dc0adf 100644 --- a/llvm/tools/llvm-exegesis/lib/Clustering.h +++ b/llvm/tools/llvm-exegesis/lib/Clustering.h @@ -19,6 +19,7 @@ #include "llvm/Support/Error.h" #include <vector> +namespace llvm { namespace exegesis { class InstructionBenchmarkClustering { @@ -109,5 +110,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_CLUSTERING_H diff --git a/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp b/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp index 614d474..e159b00 100644 --- a/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp +++ b/llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp @@ -9,6 +9,7 @@ #include "CodeTemplate.h" +namespace llvm { namespace exegesis { CodeTemplate::CodeTemplate(CodeTemplate &&) = default; @@ -115,3 +116,4 @@ getExecutionModeBits(ExecutionMode Execution) { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/CodeTemplate.h b/llvm/tools/llvm-exegesis/lib/CodeTemplate.h index 734992f..4c55487 100644 --- a/llvm/tools/llvm-exegesis/lib/CodeTemplate.h +++ b/llvm/tools/llvm-exegesis/lib/CodeTemplate.h @@ -19,6 +19,7 @@ #include "MCInstrDescView.h" #include "llvm/ADT/BitmaskEnum.h" +namespace llvm { namespace exegesis { // A template for an Instruction holding values for each of its Variables. @@ -125,5 +126,6 @@ struct CodeTemplate { }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_CODETEMPLATE_H diff --git a/llvm/tools/llvm-exegesis/lib/Latency.cpp b/llvm/tools/llvm-exegesis/lib/Latency.cpp index 7d68d60..ec92d93 100644 --- a/llvm/tools/llvm-exegesis/lib/Latency.cpp +++ b/llvm/tools/llvm-exegesis/lib/Latency.cpp @@ -17,6 +17,7 @@ #include "llvm/MC/MCInstBuilder.h" #include "llvm/Support/FormatVariadic.h" +namespace llvm { namespace exegesis { struct ExecutionClass { @@ -200,3 +201,4 @@ LatencyBenchmarkRunner::runMeasurements( } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Latency.h b/llvm/tools/llvm-exegesis/lib/Latency.h index cb55f34..fef72cd 100644 --- a/llvm/tools/llvm-exegesis/lib/Latency.h +++ b/llvm/tools/llvm-exegesis/lib/Latency.h @@ -19,6 +19,7 @@ #include "MCInstrDescView.h" #include "SnippetGenerator.h" +namespace llvm { namespace exegesis { class LatencySnippetGenerator : public SnippetGenerator { @@ -43,5 +44,6 @@ private: virtual const char *getCounterName() const; }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_LATENCY_H diff --git a/llvm/tools/llvm-exegesis/lib/LlvmState.cpp b/llvm/tools/llvm-exegesis/lib/LlvmState.cpp index 279792e9..ba786cc 100644 --- a/llvm/tools/llvm-exegesis/lib/LlvmState.cpp +++ b/llvm/tools/llvm-exegesis/lib/LlvmState.cpp @@ -19,6 +19,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" +namespace llvm { namespace exegesis { LLVMState::LLVMState(const std::string &Triple, const std::string &CpuName) { @@ -71,3 +72,4 @@ bool LLVMState::canAssemble(const llvm::MCInst &Inst) const { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/LlvmState.h b/llvm/tools/llvm-exegesis/lib/LlvmState.h index aa7705a..f8ef866 100644 --- a/llvm/tools/llvm-exegesis/lib/LlvmState.h +++ b/llvm/tools/llvm-exegesis/lib/LlvmState.h @@ -25,6 +25,7 @@ #include <memory> #include <string> +namespace llvm { namespace exegesis { class ExegesisTarget; @@ -64,5 +65,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_LLVMSTATE_H diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp index 6fdb5a6..2b4624b 100644 --- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp +++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp @@ -15,6 +15,7 @@ #include "llvm/ADT/STLExtras.h" +namespace llvm { namespace exegesis { unsigned Variable::getIndex() const { @@ -343,3 +344,4 @@ void DumpMCInst(const llvm::MCRegisterInfo &MCRegisterInfo, } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h index 17f3e2b..4e8278b 100644 --- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h +++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h @@ -29,6 +29,7 @@ #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCInstrInfo.h" +namespace llvm { namespace exegesis { // A variable represents the value associated to an Operand or a set of Operands @@ -191,5 +192,6 @@ void DumpMCInst(const llvm::MCRegisterInfo &MCRegisterInfo, const llvm::MCInst &MCInst, llvm::raw_ostream &OS); } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_MCINSTRDESCVIEW_H diff --git a/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp b/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp index c145ea8..c1c242c 100644 --- a/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp +++ b/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp @@ -17,6 +17,7 @@ #endif #include <cassert> +namespace llvm { namespace exegesis { namespace pfm { @@ -136,3 +137,4 @@ int64_t Counter::read() const { return 42; } } // namespace pfm } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/PerfHelper.h b/llvm/tools/llvm-exegesis/lib/PerfHelper.h index 8c3f13e..2d08108 100644 --- a/llvm/tools/llvm-exegesis/lib/PerfHelper.h +++ b/llvm/tools/llvm-exegesis/lib/PerfHelper.h @@ -23,6 +23,7 @@ struct perf_event_attr; +namespace llvm { namespace exegesis { namespace pfm { @@ -102,5 +103,6 @@ void Measure( } // namespace pfm } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_PERFHELPER_H diff --git a/llvm/tools/llvm-exegesis/lib/RegisterAliasing.cpp b/llvm/tools/llvm-exegesis/lib/RegisterAliasing.cpp index 039f78d..54041ca 100644 --- a/llvm/tools/llvm-exegesis/lib/RegisterAliasing.cpp +++ b/llvm/tools/llvm-exegesis/lib/RegisterAliasing.cpp @@ -9,6 +9,7 @@ #include "RegisterAliasing.h" +namespace llvm { namespace exegesis { llvm::BitVector getAliasedBits(const llvm::MCRegisterInfo &RegInfo, @@ -81,3 +82,4 @@ RegisterAliasingTrackerCache::getRegisterClass(unsigned RegClassIndex) const { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/RegisterAliasing.h b/llvm/tools/llvm-exegesis/lib/RegisterAliasing.h index 064d933..94a2eb0 100644 --- a/llvm/tools/llvm-exegesis/lib/RegisterAliasing.h +++ b/llvm/tools/llvm-exegesis/lib/RegisterAliasing.h @@ -22,6 +22,7 @@ #include "llvm/ADT/PackedVector.h" #include "llvm/MC/MCRegisterInfo.h" +namespace llvm { namespace exegesis { // Returns the registers that are aliased by the ones set in SourceBits. @@ -104,5 +105,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_ALIASINGTRACKER_H diff --git a/llvm/tools/llvm-exegesis/lib/RegisterValue.cpp b/llvm/tools/llvm-exegesis/lib/RegisterValue.cpp index 1982a6c..2bf996c 100644 --- a/llvm/tools/llvm-exegesis/lib/RegisterValue.cpp +++ b/llvm/tools/llvm-exegesis/lib/RegisterValue.cpp @@ -10,6 +10,7 @@ #include "RegisterValue.h" #include "llvm/ADT/APFloat.h" +namespace llvm { namespace exegesis { static llvm::APFloat getFloatValue(const llvm::fltSemantics &FltSemantics, @@ -47,3 +48,4 @@ llvm::APInt bitcastFloatValue(const llvm::fltSemantics &FltSemantics, } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/RegisterValue.h b/llvm/tools/llvm-exegesis/lib/RegisterValue.h index a4ef8e0..51ea30a 100644 --- a/llvm/tools/llvm-exegesis/lib/RegisterValue.h +++ b/llvm/tools/llvm-exegesis/lib/RegisterValue.h @@ -17,6 +17,7 @@ #include <llvm/ADT/APFloat.h> #include <llvm/ADT/APInt.h> +namespace llvm { namespace exegesis { // A simple object storing the value for a particular register. @@ -43,3 +44,4 @@ llvm::APInt bitcastFloatValue(const llvm::fltSemantics &FltSemantics, PredefinedValues Value); } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp index cdf54a3..eb6a857 100644 --- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp +++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp @@ -20,6 +20,7 @@ #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Program.h" +namespace llvm { namespace exegesis { std::vector<CodeTemplate> getSingleton(CodeTemplate &&CT) { @@ -222,3 +223,4 @@ void randomizeUnsetVariables(const llvm::BitVector &ForbiddenRegs, } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h index 4b307fd..967b273 100644 --- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h +++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h @@ -28,6 +28,7 @@ #include <memory> #include <vector> +namespace llvm { namespace exegesis { std::vector<CodeTemplate> getSingleton(CodeTemplate &&CT); @@ -92,5 +93,6 @@ void randomizeUnsetVariables(const llvm::BitVector &ForbiddenRegs, InstructionTemplate &IT); } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_SNIPPETGENERATOR_H diff --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp index 8baa849..b7828a1 100644 --- a/llvm/tools/llvm-exegesis/lib/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/Target.cpp @@ -11,6 +11,7 @@ #include "Latency.h" #include "Uops.h" +namespace llvm { namespace exegesis { ExegesisTarget::~ExegesisTarget() {} // anchor. @@ -109,3 +110,4 @@ const ExegesisTarget &ExegesisTarget::getDefault() { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Target.h b/llvm/tools/llvm-exegesis/lib/Target.h index dd778d3..2e94727 100644 --- a/llvm/tools/llvm-exegesis/lib/Target.h +++ b/llvm/tools/llvm-exegesis/lib/Target.h @@ -28,6 +28,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCRegisterInfo.h" +namespace llvm { namespace exegesis { class ExegesisTarget { @@ -100,5 +101,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_TARGET_H diff --git a/llvm/tools/llvm-exegesis/lib/Uops.cpp b/llvm/tools/llvm-exegesis/lib/Uops.cpp index 50be707..5aa7262 100644 --- a/llvm/tools/llvm-exegesis/lib/Uops.cpp +++ b/llvm/tools/llvm-exegesis/lib/Uops.cpp @@ -78,6 +78,7 @@ // In that case we just use a greedy register assignment and hope for the // best. +namespace llvm { namespace exegesis { static llvm::SmallVector<const Variable *, 8> @@ -252,3 +253,4 @@ UopsBenchmarkRunner::runMeasurements(const FunctionExecutor &Executor) const { constexpr const size_t UopsSnippetGenerator::kMinNumDifferentAddresses; } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/lib/Uops.h b/llvm/tools/llvm-exegesis/lib/Uops.h index f75f2ed..b2a5ea1 100644 --- a/llvm/tools/llvm-exegesis/lib/Uops.h +++ b/llvm/tools/llvm-exegesis/lib/Uops.h @@ -18,6 +18,7 @@ #include "BenchmarkRunner.h" #include "SnippetGenerator.h" +namespace llvm { namespace exegesis { class UopsSnippetGenerator : public SnippetGenerator { @@ -73,5 +74,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_UOPS_H diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp index db1a23b..6980484 100644 --- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp +++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp @@ -17,6 +17,7 @@ #include "X86Subtarget.h" #include "llvm/MC/MCInstBuilder.h" +namespace llvm { namespace exegesis { namespace { @@ -423,3 +424,4 @@ void InitializeX86ExegesisTarget() { } } // namespace exegesis +} // namespace llvm diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp index bbc1c9b..ea99142 100644 --- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp +++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp @@ -38,63 +38,63 @@ #include <algorithm> #include <string> -static llvm::cl::opt<int> - OpcodeIndex("opcode-index", llvm::cl::desc("opcode to measure, by index"), - llvm::cl::init(0)); - -static llvm::cl::opt<std::string> OpcodeNames( - "opcode-name", - llvm::cl::desc("comma-separated list of opcodes to measure, by name"), - llvm::cl::init("")); - -static llvm::cl::opt<std::string> - SnippetsFile("snippets-file", llvm::cl::desc("code snippets to measure"), - llvm::cl::init("")); - -static llvm::cl::opt<std::string> - BenchmarkFile("benchmarks-file", llvm::cl::desc(""), llvm::cl::init("")); - -static llvm::cl::opt<exegesis::InstructionBenchmark::ModeE> BenchmarkMode( - "mode", llvm::cl::desc("the mode to run"), - llvm::cl::values(clEnumValN(exegesis::InstructionBenchmark::Latency, - "latency", "Instruction Latency"), - clEnumValN(exegesis::InstructionBenchmark::Uops, "uops", - "Uop Decomposition"), - // When not asking for a specific benchmark mode, we'll - // analyse the results. - clEnumValN(exegesis::InstructionBenchmark::Unknown, - "analysis", "Analysis"))); - -static llvm::cl::opt<unsigned> +namespace llvm { +namespace exegesis { + +static cl::opt<int> OpcodeIndex("opcode-index", + cl::desc("opcode to measure, by index"), + cl::init(0)); + +static cl::opt<std::string> + OpcodeNames("opcode-name", + cl::desc("comma-separated list of opcodes to measure, by name"), + cl::init("")); + +static cl::opt<std::string> SnippetsFile("snippets-file", + cl::desc("code snippets to measure"), + cl::init("")); + +static cl::opt<std::string> BenchmarkFile("benchmarks-file", cl::desc(""), + cl::init("")); + +static cl::opt<exegesis::InstructionBenchmark::ModeE> + BenchmarkMode("mode", cl::desc("the mode to run"), + cl::values(clEnumValN(exegesis::InstructionBenchmark::Latency, + "latency", "Instruction Latency"), + clEnumValN(exegesis::InstructionBenchmark::Uops, + "uops", "Uop Decomposition"), + // When not asking for a specific benchmark mode, + // we'll analyse the results. + clEnumValN(exegesis::InstructionBenchmark::Unknown, + "analysis", "Analysis"))); + +static cl::opt<unsigned> NumRepetitions("num-repetitions", - llvm::cl::desc("number of time to repeat the asm snippet"), - llvm::cl::init(10000)); + cl::desc("number of time to repeat the asm snippet"), + cl::init(10000)); -static llvm::cl::opt<bool> IgnoreInvalidSchedClass( +static cl::opt<bool> IgnoreInvalidSchedClass( "ignore-invalid-sched-class", - llvm::cl::desc("ignore instructions that do not define a sched class"), - llvm::cl::init(false)); + cl::desc("ignore instructions that do not define a sched class"), + cl::init(false)); -static llvm::cl::opt<unsigned> AnalysisNumPoints( +static cl::opt<unsigned> AnalysisNumPoints( "analysis-numpoints", - llvm::cl::desc("minimum number of points in an analysis cluster"), - llvm::cl::init(3)); + cl::desc("minimum number of points in an analysis cluster"), cl::init(3)); -static llvm::cl::opt<float> +static cl::opt<float> AnalysisEpsilon("analysis-epsilon", - llvm::cl::desc("dbscan epsilon for analysis clustering"), - llvm::cl::init(0.1)); + cl::desc("dbscan epsilon for analysis clustering"), + cl::init(0.1)); -static llvm::cl::opt<std::string> - AnalysisClustersOutputFile("analysis-clusters-output-file", - llvm::cl::desc(""), llvm::cl::init("-")); -static llvm::cl::opt<std::string> +static cl::opt<std::string> + AnalysisClustersOutputFile("analysis-clusters-output-file", cl::desc(""), + cl::init("-")); +static cl::opt<std::string> AnalysisInconsistenciesOutputFile("analysis-inconsistencies-output-file", - llvm::cl::desc(""), llvm::cl::init("-")); - -namespace exegesis { + cl::desc(""), cl::init("-")); -static llvm::ExitOnError ExitOnErr; +static ExitOnError ExitOnErr; #ifdef LLVM_EXEGESIS_INITIALIZE_NATIVE_TARGET void LLVM_EXEGESIS_INITIALIZE_NATIVE_TARGET(); @@ -430,9 +430,11 @@ static void analysisMain() { } } // namespace exegesis +} // namespace llvm int main(int Argc, char **Argv) { - llvm::cl::ParseCommandLineOptions(Argc, Argv, ""); + using namespace llvm; + cl::ParseCommandLineOptions(Argc, Argv, ""); exegesis::ExitOnErr.setExitCodeMapper([](const llvm::Error &Err) { if (Err.isA<llvm::StringError>()) @@ -440,7 +442,7 @@ int main(int Argc, char **Argv) { return EXIT_FAILURE; }); - if (BenchmarkMode == exegesis::InstructionBenchmark::Unknown) { + if (exegesis::BenchmarkMode == exegesis::InstructionBenchmark::Unknown) { exegesis::analysisMain(); } else { exegesis::benchmarkMain(); diff --git a/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp b/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp index 1f394ae..8a519bb 100644 --- a/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp @@ -9,6 +9,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { void InitializeAArch64ExegesisTarget(); @@ -60,3 +61,4 @@ TEST_F(AArch64TargetTest, SetRegToConstant) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp b/llvm/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp index db8b9df..a20fa55 100644 --- a/llvm/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp @@ -10,6 +10,7 @@ #include "../Common/AssemblerUtils.h" #include "ARMInstrInfo.h" +namespace llvm { namespace exegesis { namespace { @@ -47,3 +48,4 @@ TEST_F(ARMMachineFunctionGeneratorTest, DISABLED_JitFunctionADDrr) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp b/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp index 05b36a3..c518491 100644 --- a/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp @@ -11,6 +11,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { namespace { @@ -29,3 +30,4 @@ TEST(ScratchSpaceTest, Works) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp b/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp index e1bffd6..8ea77dc 100644 --- a/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp @@ -14,6 +14,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { namespace { @@ -104,3 +105,4 @@ TEST(ClusteringTest, Ordering) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h index cc00cee..8a144e5 100644 --- a/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h +++ b/llvm/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h @@ -24,6 +24,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { class MachineFunctionGeneratorBaseTest : public ::testing::Test { @@ -89,5 +90,6 @@ private: }; } // namespace exegesis +} // namespace llvm #endif diff --git a/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp b/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp index a8205f9..91ed4a6 100644 --- a/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/PerfHelperTest.cpp @@ -12,6 +12,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { namespace pfm { namespace { @@ -45,3 +46,4 @@ TEST(PerfHelperTest, FunctionalTest) { } // namespace } // namespace pfm } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/RegisterValueTest.cpp b/llvm/unittests/tools/llvm-exegesis/RegisterValueTest.cpp index 4ade990..8453720 100644 --- a/llvm/unittests/tools/llvm-exegesis/RegisterValueTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/RegisterValueTest.cpp @@ -11,6 +11,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { namespace { @@ -69,3 +70,4 @@ TEST(RegisterValueTest, Double) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp index d2d4c15..00ac629 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp @@ -8,6 +8,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { namespace { @@ -100,3 +101,4 @@ TEST_F(AnalysisTest, ComputeIdealizedProcResPressure_1P1_1P05_2P0156) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp index 8e81106..451c3f67 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp @@ -10,6 +10,7 @@ #include "../Common/AssemblerUtils.h" #include "X86InstrInfo.h" +namespace llvm { namespace exegesis { void InitializeX86ExegesisTarget(); @@ -63,3 +64,4 @@ TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionMOV32ri) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp index b17ae1c..f069c21 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp @@ -25,6 +25,7 @@ using ::testing::get; using ::testing::Pointwise; using ::testing::Property; +namespace llvm { namespace exegesis { bool operator==(const BenchmarkMeasure &A, const BenchmarkMeasure &B) { @@ -136,3 +137,4 @@ TEST(BenchmarkResultTest, PerInstructionStats) { } } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp index 12f7654..007b015 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp @@ -9,6 +9,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +namespace llvm { namespace exegesis { namespace { @@ -89,3 +90,4 @@ TEST_F(RegisterAliasingTest, TrackRegisterClassCache) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp index 4b3fa54..0451735 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp @@ -17,6 +17,7 @@ #include <unordered_set> +namespace llvm { namespace exegesis { void InitializeX86ExegesisTarget(); @@ -413,3 +414,4 @@ TEST_F(FakeSnippetGeneratorTest, ComputeRegisterInitialValuesAdd64rr) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp index 5ada03b..2d9d7bc 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/TargetTest.cpp @@ -35,6 +35,7 @@ bool operator==(const MCInst &a, const MCInst &b) { } // namespace llvm +namespace llvm { namespace exegesis { void InitializeX86ExegesisTarget(); @@ -376,3 +377,4 @@ TEST_F(Core2TargetTest, SetRegToFP1_4Bits) { } // namespace } // namespace exegesis +} // namespace llvm |