[llvm] [SelectionDAG] Virtualize isTargetStrictFPOpcode / isTargetMemoryOpcode (PR #119969)

Sergey Barannikov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 19 06:27:13 PST 2024


================
@@ -35,6 +35,19 @@ class SelectionDAGTargetInfo {
   SelectionDAGTargetInfo &operator=(const SelectionDAGTargetInfo &) = delete;
   virtual ~SelectionDAGTargetInfo();
 
+  /// Returns true if a node with the given target-specific opcode has
+  /// a memory operand. Nodes with such opcodes can only be created with
+  /// `SelectionDAG::getMemIntrinsicNode`.
+  virtual bool isTargetMemoryOpcode(unsigned Opcode) const { return false; }
----------------
s-barannikov wrote:

Good question.
These methods are going to be autogenerated, and I don't think pulling the autogenerated stuff into TargetLowering would do any good -- the class is already overloaded too much. I'd prefer to do the opposite: move isBinOp / isCommutativeBinOp to SelectionDAGTargetInfo and autogenerate them too.
That is, I would like to make this class look more like TargetInstrInfo, but for SDNodes rather than MachineInstructions.


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


More information about the llvm-commits mailing list