@@ -184,13 +184,20 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) {
184
184
std::vector<Record *> OverloadTypeRecs =
185
185
R->getValueAsListOfDefs (" OpOverloadTypes" );
186
186
// Sort records in ascending order of Shader Model version
187
- std::sort (
188
- OverloadTypeRecs.begin (), OverloadTypeRecs.end (),
189
- [](Record *a, Record *b) {
190
- return (
191
- a->getValueAsDef (" ShaderModel" )->getValueAsInt (" MajorAndMinor" ) <
192
- b->getValueAsDef (" ShaderModel" )->getValueAsInt (" MajorAndMinor" ));
193
- });
187
+ std::sort (OverloadTypeRecs.begin (), OverloadTypeRecs.end (),
188
+ [](Record *RecA, Record *RecB) {
189
+ uint16_t RecAMaj =
190
+ RecA->getValueAsDef (" ShaderModel" )->getValueAsInt (" Major" );
191
+ uint16_t RecAMin =
192
+ RecA->getValueAsDef (" ShaderModel" )->getValueAsInt (" Minor" );
193
+ uint16_t RecBMaj =
194
+ RecB->getValueAsDef (" ShaderModel" )->getValueAsInt (" Major" );
195
+ uint16_t RecBMin =
196
+ RecB->getValueAsDef (" ShaderModel" )->getValueAsInt (" Minor" );
197
+
198
+ return (COMPUTE_SM_VERSION_VALUE (RecAMaj, RecAMin) <
199
+ COMPUTE_SM_VERSION_VALUE (RecBMaj, RecBMin));
200
+ });
194
201
unsigned OverloadTypeRecsSize = OverloadTypeRecs.size ();
195
202
// Populate OpOverloads with
196
203
for (unsigned I = 0 ; I < OverloadTypeRecsSize; I++) {
@@ -255,6 +262,11 @@ static std::string getParameterKindStr(ParameterKind Kind) {
255
262
llvm_unreachable (" Unknown llvm::dxil::ParameterKind enum" );
256
263
}
257
264
265
+ // / Return a string representation of OverloadKind enum that maps to
266
+ // / input LLVMType record
267
+ // / \param R TableGen def record of class LLVMType
268
+ // / \return std::string string representation of OverloadKind
269
+
258
270
static std::string getOverloadKindStr (const Record *R) {
259
271
Record *VTRec = R->getValueAsDef (" VT" );
260
272
switch (getValueType (VTRec)) {
@@ -293,10 +305,12 @@ static std::string getOverloadKindStrs(const SmallVector<Record *> Recs) {
293
305
OverloadString.append (" {" );
294
306
for (auto OvRec : Recs) {
295
307
OverloadString.append (Prefix).append (" {" );
296
- OverloadString
297
- .append (std::to_string (OvRec->getValueAsDef (" ShaderModel" )
298
- ->getValueAsInt (" MajorAndMinor" )))
299
- .append (" , " );
308
+ uint16_t RecAMaj =
309
+ OvRec->getValueAsDef (" ShaderModel" )->getValueAsInt (" Major" );
310
+ uint16_t RecAMin =
311
+ OvRec->getValueAsDef (" ShaderModel" )->getValueAsInt (" Minor" );
312
+ uint16_t RecMajMin = COMPUTE_SM_VERSION_VALUE (RecAMaj, RecAMin);
313
+ OverloadString.append (std::to_string (RecMajMin)).append (" , " );
300
314
auto OverloadTys = OvRec->getValueAsListOfDefs (" OpOverloads" );
301
315
auto Iter = OverloadTys.begin ();
302
316
OverloadString.append (getOverloadKindStr (*Iter++));
0 commit comments