[PATCH] D94898: [llvm-exegesis] Ignore instructions using custom inserter

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 18 01:48:08 PST 2021


qiucf created this revision.
qiucf added reviewers: gchatelet, courbet, jsji.
Herald added subscribers: mstojanovic, nemanjai.
qiucf requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Some instructions defined in table-gen files sets `usesCustomInserter` bit, which means it has to be lowered by target code and isn't actually valid instruction at MC level. So we should treat them like pseudo instructions.


https://reviews.llvm.org/D94898

Files:
  llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
  llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
  llvm/tools/llvm-exegesis/llvm-exegesis.cpp


Index: llvm/tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- llvm/tools/llvm-exegesis/llvm-exegesis.cpp
+++ llvm/tools/llvm-exegesis/llvm-exegesis.cpp
@@ -251,8 +251,9 @@
   const Instruction &Instr = State.getIC().getInstr(Opcode);
   const MCInstrDesc &InstrDesc = Instr.Description;
   // Ignore instructions that we cannot run.
-  if (InstrDesc.isPseudo())
-    return make_error<Failure>("Unsupported opcode: isPseudo");
+  if (InstrDesc.isPseudo() || InstrDesc.usesCustomInsertionHook())
+    return make_error<Failure>(
+        "Unsupported opcode: isPseudo/usesCustomInserter");
   if (InstrDesc.isBranch() || InstrDesc.isIndirectBranch())
     return make_error<Failure>("Unsupported opcode: isBranch/isIndirectBranch");
   if (InstrDesc.isCall() || InstrDesc.isReturn())
Index: llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
+++ llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp
@@ -51,7 +51,7 @@
     const Instruction &OtherInstr = State.getIC().getInstr(OtherOpcode);
     const MCInstrDesc &OtherInstrDesc = OtherInstr.Description;
     // Ignore instructions that we cannot run.
-    if (OtherInstrDesc.isPseudo() ||
+    if (OtherInstrDesc.isPseudo() || OtherInstrDesc.usesCustomInsertionHook() ||
         OtherInstrDesc.isBranch() || OtherInstrDesc.isIndirectBranch() ||
         OtherInstrDesc.isCall() || OtherInstrDesc.isReturn()) {
           continue;
Index: llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-exegesis/PowerPC/unsupported-opcode.s
@@ -0,0 +1,3 @@
+# RUN: llvm-exegesis -mode=latency -opcode-name=SELECT_I8 2>&1 | FileCheck %s
+
+CHECK: Unsupported opcode: isPseudo/usesCustomInserter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94898.317285.patch
Type: text/x-patch
Size: 1944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210118/b566689c/attachment.bin>


More information about the llvm-commits mailing list