diff --git a/tools/llvm-exegesis/lib/AArch64/Target.cpp b/tools/llvm-exegesis/lib/AArch64/Target.cpp index 90c5927ad29..be8f0b41ede 100644 --- a/tools/llvm-exegesis/lib/AArch64/Target.cpp +++ b/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/tools/llvm-exegesis/lib/Analysis.cpp b/tools/llvm-exegesis/lib/Analysis.cpp index 73c54f53225..0dd6bcbd466 100644 --- a/tools/llvm-exegesis/lib/Analysis.cpp +++ b/tools/llvm-exegesis/lib/Analysis.cpp @@ -15,6 +15,7 @@ #include #include +namespace llvm { namespace exegesis { static const char kCsvSep = ','; @@ -796,3 +797,4 @@ std::vector> computeIdealizedProcResPressure( } } // namespace exegesis +} // namespace llvm diff --git a/tools/llvm-exegesis/lib/Analysis.h b/tools/llvm-exegesis/lib/Analysis.h index a65a2f1b1da..9ee1493f4e0 100644 --- a/tools/llvm-exegesis/lib/Analysis.h +++ b/tools/llvm-exegesis/lib/Analysis.h @@ -30,6 +30,7 @@ #include #include +namespace llvm { namespace exegesis { // A helper class to analyze benchmark results for a target. @@ -135,5 +136,6 @@ std::vector> computeIdealizedProcResPressure( llvm::SmallVector WPRS); } // namespace exegesis +} // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_CLUSTERING_H diff --git a/tools/llvm-exegesis/lib/Assembler.cpp b/tools/llvm-exegesis/lib/Assembler.cpp index 1576cfe58e0..771a6e9ad24 100644 --- a/tools/llvm-exegesis/lib/Assembler.cpp +++ b/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/tools/llvm-exegesis/lib/Assembler.h b/tools/llvm-exegesis/lib/Assembler.h index f2a77168cb7..ee6bc86f378 100644 --- a/tools/llvm-exegesis/lib/Assembler.h +++ b/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/tools/llvm-exegesis/lib/BenchmarkCode.h b/tools/llvm-exegesis/lib/BenchmarkCode.h index b10dca5c25e..38bea2519a6 100644 --- a/tools/llvm-exegesis/lib/BenchmarkCode.h +++ b/tools/llvm-exegesis/lib/BenchmarkCode.h @@ -15,6 +15,7 @@ #include #include +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/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 5d4912ea407..4b91c6c3b3c 100644 --- a/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/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 { }; } // namespace yaml -} // namespace llvm namespace exegesis { @@ -384,3 +387,4 @@ void PerInstructionStats::push(const BenchmarkMeasure &BM) { } } // namespace exegesis +} // namespace llvm diff --git a/tools/llvm-exegesis/lib/BenchmarkResult.h b/tools/llvm-exegesis/lib/BenchmarkResult.h index 961c07b99dd..773a2e50abc 100644 --- a/tools/llvm-exegesis/lib/BenchmarkResult.h +++ b/tools/llvm-exegesis/lib/BenchmarkResult.h @@ -28,6 +28,7 @@ #include #include +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/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index 4eb5f1e880c..0d372363927 100644 --- a/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/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/tools/llvm-exegesis/lib/BenchmarkRunner.h b/tools/llvm-exegesis/lib/BenchmarkRunner.h index 517155dbdfb..4f77f492ab4 100644 --- a/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -27,6 +27,7 @@ #include #include +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/tools/llvm-exegesis/lib/Clustering.cpp b/tools/llvm-exegesis/lib/Clustering.cpp index b63afec945f..761629167bb 100644 --- a/tools/llvm-exegesis/lib/Clustering.cpp +++ b/tools/llvm-exegesis/lib/Clustering.cpp @@ -11,6 +11,7 @@ #include #include +namespace llvm { namespace exegesis { // The clustering problem has the following characteristics: @@ -170,3 +171,4 @@ InstructionBenchmarkClustering::create( } } // namespace exegesis +} // namespace llvm diff --git a/tools/llvm-exegesis/lib/Clustering.h b/tools/llvm-exegesis/lib/Clustering.h index c811020e0fe..9dc0adffb1e 100644 --- a/tools/llvm-exegesis/lib/Clustering.h +++ b/tools/llvm-exegesis/lib/Clustering.h @@ -19,6 +19,7 @@ #include "llvm/Support/Error.h" #include +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/tools/llvm-exegesis/lib/CodeTemplate.cpp b/tools/llvm-exegesis/lib/CodeTemplate.cpp index 614d4749b1f..e159b000755 100644 --- a/tools/llvm-exegesis/lib/CodeTemplate.cpp +++ b/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/tools/llvm-exegesis/lib/CodeTemplate.h b/tools/llvm-exegesis/lib/CodeTemplate.h index 734992f0afa..4c55487f3d1 100644 --- a/tools/llvm-exegesis/lib/CodeTemplate.h +++ b/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/tools/llvm-exegesis/lib/Latency.cpp b/tools/llvm-exegesis/lib/Latency.cpp index 7d68d60c48b..ec92d936de3 100644 --- a/tools/llvm-exegesis/lib/Latency.cpp +++ b/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/tools/llvm-exegesis/lib/Latency.h b/tools/llvm-exegesis/lib/Latency.h index cb55f340a5a..fef72cde5a6 100644 --- a/tools/llvm-exegesis/lib/Latency.h +++ b/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/tools/llvm-exegesis/lib/LlvmState.cpp b/tools/llvm-exegesis/lib/LlvmState.cpp index 279792e9031..ba786cc97ce 100644 --- a/tools/llvm-exegesis/lib/LlvmState.cpp +++ b/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/tools/llvm-exegesis/lib/LlvmState.h b/tools/llvm-exegesis/lib/LlvmState.h index aa7705a36a6..f8ef8665f44 100644 --- a/tools/llvm-exegesis/lib/LlvmState.h +++ b/tools/llvm-exegesis/lib/LlvmState.h @@ -25,6 +25,7 @@ #include #include +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/tools/llvm-exegesis/lib/MCInstrDescView.cpp b/tools/llvm-exegesis/lib/MCInstrDescView.cpp index 6fdb5a68419..2b4624b9b64 100644 --- a/tools/llvm-exegesis/lib/MCInstrDescView.cpp +++ b/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/tools/llvm-exegesis/lib/MCInstrDescView.h b/tools/llvm-exegesis/lib/MCInstrDescView.h index 17f3e2b930d..4e8278ba2b5 100644 --- a/tools/llvm-exegesis/lib/MCInstrDescView.h +++ b/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/tools/llvm-exegesis/lib/PerfHelper.cpp b/tools/llvm-exegesis/lib/PerfHelper.cpp index c145ea8404b..c1c242ca88f 100644 --- a/tools/llvm-exegesis/lib/PerfHelper.cpp +++ b/tools/llvm-exegesis/lib/PerfHelper.cpp @@ -17,6 +17,7 @@ #endif #include +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/tools/llvm-exegesis/lib/PerfHelper.h b/tools/llvm-exegesis/lib/PerfHelper.h index 8c3f13e6c5c..2d081084660 100644 --- a/tools/llvm-exegesis/lib/PerfHelper.h +++ b/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/tools/llvm-exegesis/lib/RegisterAliasing.cpp b/tools/llvm-exegesis/lib/RegisterAliasing.cpp index 039f78db985..54041ca30aa 100644 --- a/tools/llvm-exegesis/lib/RegisterAliasing.cpp +++ b/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/tools/llvm-exegesis/lib/RegisterAliasing.h b/tools/llvm-exegesis/lib/RegisterAliasing.h index 064d9333beb..94a2eb07f49 100644 --- a/tools/llvm-exegesis/lib/RegisterAliasing.h +++ b/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/tools/llvm-exegesis/lib/RegisterValue.cpp b/tools/llvm-exegesis/lib/RegisterValue.cpp index 1982a6c53b2..2bf996cead4 100644 --- a/tools/llvm-exegesis/lib/RegisterValue.cpp +++ b/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/tools/llvm-exegesis/lib/RegisterValue.h b/tools/llvm-exegesis/lib/RegisterValue.h index a4ef8e0ba1e..51ea30ac8eb 100644 --- a/tools/llvm-exegesis/lib/RegisterValue.h +++ b/tools/llvm-exegesis/lib/RegisterValue.h @@ -17,6 +17,7 @@ #include #include +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/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/tools/llvm-exegesis/lib/SnippetGenerator.cpp index cdf54a32e4f..eb6a8577b57 100644 --- a/tools/llvm-exegesis/lib/SnippetGenerator.cpp +++ b/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 getSingleton(CodeTemplate &&CT) { @@ -222,3 +223,4 @@ void randomizeUnsetVariables(const llvm::BitVector &ForbiddenRegs, } } // namespace exegesis +} // namespace llvm diff --git a/tools/llvm-exegesis/lib/SnippetGenerator.h b/tools/llvm-exegesis/lib/SnippetGenerator.h index 4b307fd75ac..967b273182b 100644 --- a/tools/llvm-exegesis/lib/SnippetGenerator.h +++ b/tools/llvm-exegesis/lib/SnippetGenerator.h @@ -28,6 +28,7 @@ #include #include +namespace llvm { namespace exegesis { std::vector 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/tools/llvm-exegesis/lib/Target.cpp b/tools/llvm-exegesis/lib/Target.cpp index 8baa8499c92..b7828a13da0 100644 --- a/tools/llvm-exegesis/lib/Target.cpp +++ b/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/tools/llvm-exegesis/lib/Target.h b/tools/llvm-exegesis/lib/Target.h index dd778d35b72..2e94727d78d 100644 --- a/tools/llvm-exegesis/lib/Target.h +++ b/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/tools/llvm-exegesis/lib/Uops.cpp b/tools/llvm-exegesis/lib/Uops.cpp index 50be707feb2..5aa726218c7 100644 --- a/tools/llvm-exegesis/lib/Uops.cpp +++ b/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 @@ -252,3 +253,4 @@ UopsBenchmarkRunner::runMeasurements(const FunctionExecutor &Executor) const { constexpr const size_t UopsSnippetGenerator::kMinNumDifferentAddresses; } // namespace exegesis +} // namespace llvm diff --git a/tools/llvm-exegesis/lib/Uops.h b/tools/llvm-exegesis/lib/Uops.h index f75f2edd552..b2a5ea177f4 100644 --- a/tools/llvm-exegesis/lib/Uops.h +++ b/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/tools/llvm-exegesis/lib/X86/Target.cpp b/tools/llvm-exegesis/lib/X86/Target.cpp index db1a23b74cc..69804849e62 100644 --- a/tools/llvm-exegesis/lib/X86/Target.cpp +++ b/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/tools/llvm-exegesis/llvm-exegesis.cpp b/tools/llvm-exegesis/llvm-exegesis.cpp index bbc1c9ba28c..ea991420039 100644 --- a/tools/llvm-exegesis/llvm-exegesis.cpp +++ b/tools/llvm-exegesis/llvm-exegesis.cpp @@ -38,63 +38,63 @@ #include #include -static llvm::cl::opt - OpcodeIndex("opcode-index", llvm::cl::desc("opcode to measure, by index"), - llvm::cl::init(0)); - -static llvm::cl::opt OpcodeNames( - "opcode-name", - llvm::cl::desc("comma-separated list of opcodes to measure, by name"), - llvm::cl::init("")); - -static llvm::cl::opt - SnippetsFile("snippets-file", llvm::cl::desc("code snippets to measure"), - llvm::cl::init("")); - -static llvm::cl::opt - BenchmarkFile("benchmarks-file", llvm::cl::desc(""), llvm::cl::init("")); - -static llvm::cl::opt 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 - NumRepetitions("num-repetitions", - llvm::cl::desc("number of time to repeat the asm snippet"), - llvm::cl::init(10000)); - -static llvm::cl::opt IgnoreInvalidSchedClass( - "ignore-invalid-sched-class", - llvm::cl::desc("ignore instructions that do not define a sched class"), - llvm::cl::init(false)); - -static llvm::cl::opt AnalysisNumPoints( - "analysis-numpoints", - llvm::cl::desc("minimum number of points in an analysis cluster"), - llvm::cl::init(3)); - -static llvm::cl::opt - AnalysisEpsilon("analysis-epsilon", - llvm::cl::desc("dbscan epsilon for analysis clustering"), - llvm::cl::init(0.1)); - -static llvm::cl::opt - AnalysisClustersOutputFile("analysis-clusters-output-file", - llvm::cl::desc(""), llvm::cl::init("-")); -static llvm::cl::opt - AnalysisInconsistenciesOutputFile("analysis-inconsistencies-output-file", - llvm::cl::desc(""), llvm::cl::init("-")); - +namespace llvm { namespace exegesis { -static llvm::ExitOnError ExitOnErr; +static cl::opt OpcodeIndex("opcode-index", + cl::desc("opcode to measure, by index"), + cl::init(0)); + +static cl::opt + OpcodeNames("opcode-name", + cl::desc("comma-separated list of opcodes to measure, by name"), + cl::init("")); + +static cl::opt SnippetsFile("snippets-file", + cl::desc("code snippets to measure"), + cl::init("")); + +static cl::opt BenchmarkFile("benchmarks-file", cl::desc(""), + cl::init("")); + +static cl::opt + 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 + NumRepetitions("num-repetitions", + cl::desc("number of time to repeat the asm snippet"), + cl::init(10000)); + +static cl::opt IgnoreInvalidSchedClass( + "ignore-invalid-sched-class", + cl::desc("ignore instructions that do not define a sched class"), + cl::init(false)); + +static cl::opt AnalysisNumPoints( + "analysis-numpoints", + cl::desc("minimum number of points in an analysis cluster"), cl::init(3)); + +static cl::opt + AnalysisEpsilon("analysis-epsilon", + cl::desc("dbscan epsilon for analysis clustering"), + cl::init(0.1)); + +static cl::opt + AnalysisClustersOutputFile("analysis-clusters-output-file", cl::desc(""), + cl::init("-")); +static cl::opt + AnalysisInconsistenciesOutputFile("analysis-inconsistencies-output-file", + cl::desc(""), cl::init("-")); + +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()) @@ -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/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp b/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp index 1f394ae2efd..8a519bb2e7b 100644 --- a/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp +++ b/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/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp b/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp index db8b9dfc3b7..a20fa5556bb 100644 --- a/unittests/tools/llvm-exegesis/ARM/AssemblerTest.cpp +++ b/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/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp b/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp index 05b36a31b9e..c518491063a 100644 --- a/unittests/tools/llvm-exegesis/BenchmarkRunnerTest.cpp +++ b/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/unittests/tools/llvm-exegesis/ClusteringTest.cpp b/unittests/tools/llvm-exegesis/ClusteringTest.cpp index e1bffd63454..8ea77dcbdde 100644 --- a/unittests/tools/llvm-exegesis/ClusteringTest.cpp +++ b/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/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h b/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h index cc00cee58e3..8a144e5c26f 100644 --- a/unittests/tools/llvm-exegesis/Common/AssemblerUtils.h +++ b/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/unittests/tools/llvm-exegesis/PerfHelperTest.cpp b/unittests/tools/llvm-exegesis/PerfHelperTest.cpp index a8205f9e3eb..91ed4a60967 100644 --- a/unittests/tools/llvm-exegesis/PerfHelperTest.cpp +++ b/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/unittests/tools/llvm-exegesis/RegisterValueTest.cpp b/unittests/tools/llvm-exegesis/RegisterValueTest.cpp index 4ade990382d..8453720dc70 100644 --- a/unittests/tools/llvm-exegesis/RegisterValueTest.cpp +++ b/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/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp b/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp index d2d4c152d79..00ac6290aed 100644 --- a/unittests/tools/llvm-exegesis/X86/AnalysisTest.cpp +++ b/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/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp b/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp index 8e81106db8d..451c3f67e75 100644 --- a/unittests/tools/llvm-exegesis/X86/AssemblerTest.cpp +++ b/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/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp b/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp index b17ae1caff3..f069c21b364 100644 --- a/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp +++ b/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/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp b/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp index 12f76541d4d..007b0156b1f 100644 --- a/unittests/tools/llvm-exegesis/X86/RegisterAliasingTest.cpp +++ b/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/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp b/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp index 4b3fa5455a3..04517359d8a 100644 --- a/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp +++ b/unittests/tools/llvm-exegesis/X86/SnippetGeneratorTest.cpp @@ -17,6 +17,7 @@ #include +namespace llvm { namespace exegesis { void InitializeX86ExegesisTarget(); @@ -413,3 +414,4 @@ TEST_F(FakeSnippetGeneratorTest, ComputeRegisterInitialValuesAdd64rr) { } // namespace } // namespace exegesis +} // namespace llvm diff --git a/unittests/tools/llvm-exegesis/X86/TargetTest.cpp b/unittests/tools/llvm-exegesis/X86/TargetTest.cpp index 5ada03b2e9e..2d9d7bcd559 100644 --- a/unittests/tools/llvm-exegesis/X86/TargetTest.cpp +++ b/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