[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
================
@@ -172,9 +176,34 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
if (!OverloadParamIndices.empty()) {
if (OverloadParamIndices.size() > 1)
report_fatal_error("Multiple overload type specification not supported",
- false);
+ /*gen_crash_diag*/ false);
OverloadParamIndex = OverloadParamIndices[0];
}
+
+ // Get valid overload types of the Operation
+ std::vector<Record *> OverloadTypeRecs =
+ R->getValueAsListOfDefs("OpOverloadTypes");
+ // Sort records in ascending order of Shader Model version
+ std::sort(OverloadTypeRecs.begin(), OverloadTypeRecs.end(),
+ [](Record *RecA, Record *RecB) {
+ uint16_t RecAMaj =
+ RecA->getValueAsDef("ShaderModel")->getValueAsInt("Major");
+ uint16_t RecAMin =
+ RecA->getValueAsDef("ShaderModel")->getValueAsInt("Minor");
+ uint16_t RecBMaj =
+ RecB->getValueAsDef("ShaderModel")->getValueAsInt("Major");
+ uint16_t RecBMin =
+ RecB->getValueAsDef("ShaderModel")->getValueAsInt("Minor");
+
+ return (COMPUTE_SM_VERSION_VALUE(RecAMaj, RecAMin) <
+ COMPUTE_SM_VERSION_VALUE(RecBMaj, RecBMin));
----------------
bogner wrote:
This can be simplified with `std::tie`
https://github.com/llvm/llvm-project/pull/87803
More information about the llvm-commits
mailing list