[llvm] 03aa6b9 - [NFC][llvm-exegesis] Ensure that target options show up in --help

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 16:39:09 PST 2022


Author: Roman Lebedev
Date: 2022-12-21T03:38:30+03:00
New Revision: 03aa6b9197a500b43d010be881e5ee158e2e74b9

URL: https://github.com/llvm/llvm-project/commit/03aa6b9197a500b43d010be881e5ee158e2e74b9
DIFF: https://github.com/llvm/llvm-project/commit/03aa6b9197a500b43d010be881e5ee158e2e74b9.diff

LOG: [NFC][llvm-exegesis] Ensure that target options show up in --help

Fixes https://github.com/llvm/llvm-project/issues/59377

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/Target.cpp
    llvm/tools/llvm-exegesis/lib/Target.h
    llvm/tools/llvm-exegesis/lib/X86/Target.cpp
    llvm/tools/llvm-exegesis/llvm-exegesis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/Target.cpp b/llvm/tools/llvm-exegesis/lib/Target.cpp
index 1ee5b319419ca..8c6275bc7bd3a 100644
--- a/llvm/tools/llvm-exegesis/lib/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Target.cpp
@@ -17,6 +17,10 @@
 namespace llvm {
 namespace exegesis {
 
+cl::OptionCategory Options("llvm-exegesis options");
+cl::OptionCategory BenchmarkOptions("llvm-exegesis benchmark options");
+cl::OptionCategory AnalysisOptions("llvm-exegesis analysis options");
+
 ExegesisTarget::~ExegesisTarget() {} // anchor.
 
 static ExegesisTarget *FirstTarget = nullptr;

diff  --git a/llvm/tools/llvm-exegesis/lib/Target.h b/llvm/tools/llvm-exegesis/lib/Target.h
index 9487869d86df8..3d631b9375ea5 100644
--- a/llvm/tools/llvm-exegesis/lib/Target.h
+++ b/llvm/tools/llvm-exegesis/lib/Target.h
@@ -28,11 +28,16 @@
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
 namespace exegesis {
 
+extern cl::OptionCategory Options;
+extern cl::OptionCategory BenchmarkOptions;
+extern cl::OptionCategory AnalysisOptions;
+
 struct PfmCountersInfo {
   // An optional name of a performance counter that can be used to measure
   // cycles.

diff  --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
index b14857405504d..5344cfad88ddf 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -38,9 +38,6 @@
 namespace llvm {
 namespace exegesis {
 
-static cl::OptionCategory
-    BenchmarkOptions("llvm-exegesis benchmark x86-options");
-
 // If a positive value is specified, we are going to use the LBR in
 // latency-mode.
 //

diff  --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
index 04aac6aa5a70d..646c46cf4426c 100644
--- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -47,10 +47,6 @@
 namespace llvm {
 namespace exegesis {
 
-static cl::OptionCategory Options("llvm-exegesis options");
-static cl::OptionCategory BenchmarkOptions("llvm-exegesis benchmark options");
-static cl::OptionCategory AnalysisOptions("llvm-exegesis analysis options");
-
 static cl::opt<int> OpcodeIndex(
     "opcode-index",
     cl::desc("opcode to measure, by index, or -1 to measure all opcodes"),


        


More information about the llvm-commits mailing list