[llvm] [Exegesis][RISCV] Add RISCV support for llvm-exegesis (PR #89047)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 30 15:52:01 PST 2024


================
@@ -50,15 +50,27 @@
 namespace llvm {
 namespace exegesis {
 
+struct OpcodeNameParser
+    : public cl::parser<std::vector<std::pair<StringRef, StringRef>>> {
+  OpcodeNameParser(cl::Option &O)
+      : cl::parser<std::vector<std::pair<StringRef, StringRef>>>(O) {}
+  bool parse(cl::Option &O, StringRef ArgName, const StringRef ArgValue,
+             std::vector<std::pair<StringRef, StringRef>> &Val);
+};
+
 static cl::opt<int> OpcodeIndex(
     "opcode-index",
     cl::desc("opcode to measure, by index, or -1 to measure all opcodes"),
     cl::cat(BenchmarkOptions), cl::init(0));
 
-static cl::opt<std::string>
+static cl::opt<std::vector<std::pair<StringRef, StringRef>>, false,
+               OpcodeNameParser>
     OpcodeNames("opcode-name",
-                cl::desc("comma-separated list of opcodes to measure, by name"),
-                cl::cat(BenchmarkOptions), cl::init(""));
+                cl::desc("comma-separated list of opcodes to measure, "
+                         "each item is either opcode name ('OP') "
+                         "or opcode range ('OP1..OP2', ends are inclusive)"),
----------------
topperc wrote:

Is there a test for this range functionality? It feels unreliable since new opcodes can be added to the compiler which might change the contents of a range between different compiler versions. The order of the opcodes in the enum is currently alphabetical excepts pseudos are ordered earier, but nothing I know of requires it to be alphabetical. So this is adding a new constraint.

https://github.com/llvm/llvm-project/pull/89047


More information about the llvm-commits mailing list