[llvm] [DXIL] Model DXIL Class and Shader Model association of DXIL Ops in DXIL.td (PR #87803)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 17:10:34 PDT 2024


================
@@ -249,16 +255,38 @@ static FunctionType *getDXILOpFunctionType(const OpCodeProperty *Prop,
       ArgTys[0], ArrayRef<Type *>(&ArgTys[1], ArgTys.size() - 1), false);
 }
 
+static uint16_t getValidOverloadMask(const OpCodeProperty *Prop,
+                                     uint32_t SMVer) {
+  uint16_t ValidTyMask = 0;
+  // std::vector Prop->OverloadProp is in ascending order of SM Version
+  // Overloads of highest SM version that is not greater than SMVer
+  // are the ones that are valid for SMVer.
+  for (auto OL : Prop->OverloadProp) {
+    if (OL.ShaderModelVer <= SMVer) {
+      ValidTyMask = OL.ValidTys;
+    } else {
+      break;
+    }
+  }
+  return ValidTyMask;
+}
----------------
bogner wrote:

`std::binary_search`?

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


More information about the llvm-commits mailing list