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

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 09:54:52 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);
----------------
AnastasiyaChernikova wrote:

Addressed

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


More information about the llvm-commits mailing list