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

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 16:04:43 PDT 2024


================
@@ -296,6 +312,43 @@ T ExitOnFileError(const Twine &FileName, Expected<T> &&E) {
   return std::move(*E);
 }
 
+static const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State,
+                                                unsigned Opcode) {
+  const MCInstrDesc &InstrDesc = State.getIC().getInstr(Opcode).Description;
+  if (InstrDesc.isPseudo() || InstrDesc.usesCustomInsertionHook())
+    return "Unsupported opcode: isPseudo/usesCustomInserter";
+  if (InstrDesc.isBranch() || InstrDesc.isIndirectBranch())
+    return "Unsupported opcode: isBranch/isIndirectBranch";
+  if (InstrDesc.isCall() || InstrDesc.isReturn())
+    return "Unsupported opcode: isCall/isReturn";
+  return nullptr;
+}
+
+static bool isIgnoredOpcode(const LLVMState &State, unsigned Opcode) {
+  return getIgnoredOpcodeReasonOrNull(State, Opcode) != nullptr;
+}
+
+bool OpcodeNameParser::parse(
+    cl::Option &O, StringRef ArgName, const StringRef OpcodeNames,
+    std::vector<std::pair<StringRef, StringRef>> &Val) {
+  SmallVector<StringRef, 2> Pieces;
+  StringRef(OpcodeNames)
+      .split(Pieces, ",", /* MaxSplit */ -1, /* KeepEmpty */ false);
----------------
mshockwave wrote:

```suggestion
      .split(Pieces, ",", /*MaxSplit=*/-1, /*KeepEmpty=*/false);
```
https://llvm.org/docs/CodingStandards.html#comment-formatting

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


More information about the llvm-commits mailing list