[llvm] [SandboxVec][Legality] Scaffolding for Legality (PR #112623)

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 23:28:18 PDT 2024


================
@@ -48,14 +106,37 @@ class Widen final : public LegalityResult {
   }
 };
 
+class Pack final : public LegalityResultWithReason {
+  Pack(ResultReason Reason)
+      : LegalityResultWithReason(LegalityResultID::Pack, Reason) {}
+  friend class LegalityAnalysis; // For constructor.
+
+public:
+  static bool classof(const LegalityResult *From) {
+    return From->getSubclassID() == LegalityResultID::Pack;
+  }
+};
+
 /// Performs the legality analysis and returns a LegalityResult object.
 class LegalityAnalysis {
+  /// Owns the legality result objects created by createLegalityResult().
+  SmallVector<std::unique_ptr<LegalityResult>> ResultPool;
+  /// Checks opcodes, types and other IR-specifics and returns nullopt if it is
+  /// not illegal to vectorize, otherwise it returns a ResultReason object.
----------------
tmsri wrote:

nit: not illegal -> legal

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


More information about the llvm-commits mailing list