[llvm] [IR][TableGen] Add RangeSet TableGen intrinsic property (PR #203623)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 08:52:19 PDT 2026


================
@@ -886,6 +891,52 @@ AttributeSet Intrinsic::getFnAttributes(LLVMContext &C, ID id) {{
                 NoFunctionAttrsID);
 }
 
+void IntrinsicEmitter::EmitImmArgRangeSetChecks(
+    const CodeGenIntrinsicTable &Ints, raw_ostream &OS) {
+  IfDefEmitter IfDef(OS, "GET_INTRINSIC_IMMARG_RANGE_SET_CHECKS");
+  OS << R"(
+bool Intrinsic::isImmArgValueInRangeSet(ID IID, unsigned ArgIdx,
----------------
jurahul wrote:

Several compilers are not that great in generating code for large switch cases/nested switch cases. In this case, it seems this code can easily be made mode table driven. Can you check if all the ranges can be dumpes into a SequenceToOffsetTable and we somehow encode the start/size of each range set for each ImmArg somehow to reduce and/or eliminate generating a per intrinsic switch?

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


More information about the llvm-commits mailing list