[PATCH] D22373: [GlobalISel] Introduce a simple instruction selector.

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 08:37:26 PDT 2016


dberris added inline comments.

================
Comment at: include/llvm/CodeGen/GlobalISel/InstructionSelector.h:32-35
@@ +31,6 @@
+  ///
+  /// \returns whether selection succeeded.
+  /// \pre  I.getParent() && I.getParent()->getParent()
+  /// \post !isPreISelGenericOpcode(I.getOpcode())
+  virtual bool select(MachineInstr &I) const = 0;
+
----------------
Is a boolean sufficient for conveying the failure scenario for selection?

How do specific instruction selections convey the nuance of the failure? Could there be multiple passes on the same function caused by a failure to select -- maybe because there's not enough information yet?

For example, if an instruction is ignored by the selector, or replaced by a no-op, does it have to return failure? What will that cause the `InstructionSelect` pass to do? I'm not sure if that documentation has to happen in this interface or in the `InstructionSelect` pass instead.

================
Comment at: lib/CodeGen/GlobalISel/InstructionSelect.cpp:62-63
@@ +61,4 @@
+      MachineInstr &MI = *MII++;
+      if (!ISel->select(MI))
+        reportSelectionError(MI, "Cannot select");
+    }
----------------
Somewhat related to my question above on the `InstructionSelector` interface -- maybe we should delegate the selection error messaging to the implementation?


https://reviews.llvm.org/D22373





More information about the llvm-commits mailing list