[llvm] [GlobalISel][TableGen] Take first result for multi-output instructions (PR #81130)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 02:26:13 PST 2024


================
@@ -288,11 +289,21 @@ static std::string getMangledRootDefName(StringRef DefOperandName) {
 
 //===- GlobalISelEmitter class --------------------------------------------===//
 
-static Expected<LLTCodeGen> getInstResultType(const TreePatternNode &Dst) {
+static Expected<LLTCodeGen> getInstResultType(const TreePatternNode &Dst,
+                                              const CodeGenTarget &Target) {
+  // While we allow more than one output (both implicit and explicit defs)
+  // below, we only expect one explicit def here.
+  assert(Dst.getOperator()->isSubClassOf("Instruction"));
+  CodeGenInstruction &InstInfo = Target.getInstruction(Dst.getOperator());
+  if (InstInfo.Operands.NumDefs != 1)
+    return failedImport("Dst pattern child is not having exactly one result");
----------------
arsenm wrote:

Phrasing 
```suggestion
    return failedImport("Dst pattern child only supported with exactly one result");
```

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


More information about the llvm-commits mailing list