================
@@ -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));
----------------
bharadwajy wrote:
> This can be simplified with `std::tie`
Changed to compare `VersionTuple` typed values.
https://github.com/llvm/llvm-project/pull/87803