[llvm] [LLVM-Tablegen] Explicit Type Constraints for Overloaded LLVM Intrinsics (PR #172442)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 7 05:30:35 PST 2026


================
@@ -448,6 +450,23 @@ class LLVMAnyPointerType : LLVMAnyType<pAny> {
   assert isAny, "pAny should have isOverloaded";
 }
 
+// AnyTypeOf: Constrain overloaded type to specific set of allowed types.
+// Encoding follows the pattern: [IIT_ARG, EncAny, IIT_ANYTYPE, count, type_sigs...].
+class AnyTypeOf<list<LLVMType> allowed_types> : LLVMAnyType<Any> {
+  list<LLVMType> AllowedTypes = allowed_types;
+  
+  // Validation: specifying maximal 255 number of allowed types.
----------------
jurahul wrote:

nit: this comment just restates the assert. Instead can we explain why there is a limit of 255? I am assuming its because its encoded in a single byte.

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


More information about the llvm-commits mailing list