[llvm] [DXIL] Model DXIL Class and Shader Model association of DXIL Ops in DXIL.td (PR #87803)
S. Bharadwaj Yadavalli via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 12:18:58 PDT 2024
================
@@ -276,14 +304,22 @@ CallInst *DXILOpBuilder::createDXILOpCall(dxil::OpCode OpCode, Type *ReturnTy,
return B.CreateCall(DXILFn, Args);
}
-Type *DXILOpBuilder::getOverloadTy(dxil::OpCode OpCode, FunctionType *FT) {
+Type *DXILOpBuilder::getOverloadTy(dxil::OpCode OpCode, uint32_t SMVer,
+ FunctionType *FT) {
const OpCodeProperty *Prop = getOpCodeProperty(OpCode);
// If DXIL Op has no overload parameter, just return the
// precise return type specified.
if (Prop->OverloadParamIndex < 0) {
auto &Ctx = FT->getContext();
- switch (Prop->OverloadTys) {
+ uint16_t ValidTyMask = getValidOverloadMask(Prop, SMVer);
+ if (ValidTyMask == 0) {
+ report_fatal_error(StringRef(std::to_string(SMVer).append(
+ ": Unhandled Shader Model Version")),
+ /*gen_crash_diag*/ false);
+ }
+
+ switch (ValidTyMask) {
----------------
bharadwajy wrote:
> Is this right? You have something that's called a mask but you're checking if it exactly matches specific bits?
This is in the body of the if-condition (`Prop->OverloadParamIndex < 0`) and thus the opcode has no valid overload types. Overload mask encodes the valid precise (single) type for such opcodes with no overloads. So, switching on the `ValidTyMask` with precise value is correct.
https://github.com/llvm/llvm-project/pull/87803
More information about the llvm-commits
mailing list