[Mlir-commits] [llvm] [mlir] [LLVM] Refactor intrinsic validation (PR #194061)

Durgadoss R llvmlistbot at llvm.org
Mon Apr 27 04:54:02 PDT 2026


================
@@ -262,41 +262,33 @@ namespace Intrinsic {
   LLVM_ABI void getIntrinsicInfoTableEntries(ID id,
                                              SmallVectorImpl<IITDescriptor> &T);
 
-  enum MatchIntrinsicTypesResult {
-    MatchIntrinsicTypes_Match = 0,
-    MatchIntrinsicTypes_NoMatchRet = 1,
-    MatchIntrinsicTypes_NoMatchArg = 2,
-  };
-
   /// Match the specified function type with the type constraints specified by
   /// the .td file. If the given type is an overloaded type it is pushed to the
   /// OverloadTys vector.
   ///
   /// Returns false if the given type matches with the constraints, true
-  /// otherwise.
-  LLVM_ABI MatchIntrinsicTypesResult
-  matchIntrinsicSignature(FunctionType *FTy, ArrayRef<IITDescriptor> &Infos,
-                          SmallVectorImpl<Type *> &OverloadTys);
-
-  /// Verify if the intrinsic has variable arguments. This method is intended to
-  /// be called after all the fixed arguments have been matched first.
-  ///
-  /// This method returns true on error.
-  LLVM_ABI bool matchIntrinsicVarArg(bool isVarArg,
-                                     ArrayRef<IITDescriptor> &Infos);
-
-  /// Gets the type arguments of an intrinsic call by matching type contraints
-  /// specified by the .td file. The overloaded types are pushed into the
+  /// otherwise. If returning true, an error message to indicate the reason of
+  /// mismatch is printed to \p OS.
+  LLVM_ABI bool matchIntrinsicSignature(FunctionType *FTy,
+                                        ArrayRef<IITDescriptor> &Infos,
+                                        SmallVectorImpl<Type *> &OverloadTys,
+                                        raw_ostream &OS);
+
+  /// Returns true if \p FT is a valid function type for intrinsic \p ID. If
+  /// `ID` is an overloaded intrinsic, the overload types are pushed into the
   /// OverloadTys vector.
   ///
   /// Returns false if the given ID and function type combination is not a
-  /// valid intrinsic call.
-  LLVM_ABI bool getIntrinsicSignature(Intrinsic::ID, FunctionType *FT,
-                                      SmallVectorImpl<Type *> &OverloadTys);
+  /// valid intrinsic call. Also prints the error message to indicate the reason
+  /// of the mismatch to \p OS.
+  LLVM_ABI bool isSignatureValid(Intrinsic::ID ID, FunctionType *FT,
----------------
durga4github wrote:

+1 for this rename!

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


More information about the Mlir-commits mailing list