[PATCH] D143977: [GISel]]RFC] Allow match against iPTR operand in leaf node

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 20:52:04 PST 2023


lkail created this revision.
lkail added reviewers: qcolombet, dsanders, arsenm, Kai, nemanjai, shchenz, amyk, PowerPC.
Herald added a project: All.
lkail requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

When using `MVTToLLT` to check corresponding `LLT`, also allow `iPTR` to pass the check. Thus we can import more patterns like `ComplexPattern<iPTR, ...>` in SDAG.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143977

Files:
  llvm/utils/TableGen/GlobalISelEmitter.cpp


Index: llvm/utils/TableGen/GlobalISelEmitter.cpp
===================================================================
--- llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -4594,8 +4594,17 @@
       return failedImport("Dst pattern child has multiple results");
 
     std::optional<LLTCodeGen> OpTyOrNone;
-    if (ChildTypes.front().isMachineValueType())
-      OpTyOrNone = MVTToLLT(ChildTypes.front().getMachineValueType().SimpleTy);
+    if (ChildTypes.front().isMachineValueType()) {
+      MVT VT = ChildTypes.front().getMachineValueType();
+      // Allow import more patterns like ComplexPattern<iPTR, ..>.
+      if (VT == MVT::iPTR)
+        // Since we don't know the exact pointer size for target supporting
+        // multiple address modes when tables are generated, no LLT is passed
+        // into LLTCodeGen.
+        OpTyOrNone = LLTCodeGen();
+      else
+        OpTyOrNone = MVTToLLT(VT.SimpleTy);
+    }
     if (!OpTyOrNone)
       return failedImport("Dst operand has an unsupported type");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143977.497191.patch
Type: text/x-patch
Size: 1060 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230214/60ef6fbb/attachment.bin>


More information about the llvm-commits mailing list