Page MenuHomePhabricator

[Sparc] Fix useDeprecatedPositionallyEncodedOperands errors.
ClosedPublic

Authored by jyknight on Sep 19 2022, 10:59 AM.

Details

Summary

This is a follow-on to https://reviews.llvm.org/D134073.

It renames a few fields to have consistent names, as well as renaming
operands to match the field names.

Behavior is unchanged by this cleanup. (The only generated code change
is for the disassembler for LDSTUB/LDSTUBA, but in both old and new
versions, it fails to add enough operands, and thus triggers a runtime
abort. I will address that bug in a future commit.)

Diff Detail

Event Timeline

jyknight created this revision.Sep 19 2022, 10:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 10:59 AM
jyknight requested review of this revision.Sep 19 2022, 10:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 11:00 AM
MaskRay accepted this revision.EditedOct 25 2022, 3:45 PM

In the build directory, I use rsync -aR -f '+ */' -f '+ *.inc' -f '- *' ./lib/Target/Sparc /tmp/new/ (and /tmp/old) to compare *.inc files before and after the change.

LDSTUBrr/LDSTUBri have differences as mentioned. Is the case 74: difference expected?

% diff -ur /tmp/{old,new}
diff -ur /tmp/old/lib/Target/Sparc/SparcGenDisassemblerTables.inc /tmp/new/lib/Target/Sparc/SparcGenDisassemblerTables.inc
--- /tmp/old/lib/Target/Sparc/SparcGenDisassemblerTables.inc    2022-10-25 15:43:12.603059757 -0700
+++ /tmp/new/lib/Target/Sparc/SparcGenDisassemblerTables.inc    2022-10-25 15:44:15.299347605 -0700
@@ -1511,9 +1511,9 @@
 /* 6918 */    MCD::OPC_ExtractField, 13, 1,  // Inst{13} ...
 /* 6921 */    MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 6937
 /* 6926 */    MCD::OPC_CheckField, 5, 8, 0, 99, 4, 0, // Skip to: 8056
-/* 6933 */    MCD::OPC_Decode, 174, 4, 4, // Opcode: LDSTUBrr
+/* 6933 */    MCD::OPC_Decode, 174, 4, 17, // Opcode: LDSTUBrr
 /* 6937 */    MCD::OPC_FilterValue, 1, 90, 4, 0, // Skip to: 8056
-/* 6942 */    MCD::OPC_Decode, 173, 4, 4, // Opcode: LDSTUBri
+/* 6942 */    MCD::OPC_Decode, 173, 4, 17, // Opcode: LDSTUBri
 /* 6946 */    MCD::OPC_FilterValue, 14, 28, 0, 0, // Skip to: 6979
 /* 6951 */    MCD::OPC_ExtractField, 13, 1,  // Inst{13} ...
 /* 6954 */    MCD::OPC_FilterValue, 0, 11, 0, 0, // Skip to: 6970
@@ -2312,6 +2312,8 @@
     if (DecodeSWAP(MI, insn, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     return S;
   case 74:
+    tmp = fieldFromInstruction(insn, 25, 5);
+    if (DecodeIntRegsRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { return MCDisassembler::Fail; }
     tmp = fieldFromInstruction(insn, 5, 8);
     MI.addOperand(MCOperand::createImm(tmp));
     return S;
This revision is now accepted and ready to land.Oct 25 2022, 3:45 PM

LDSTUBrr/LDSTUBri have differences as mentioned. Is the case 74: difference expected?

Yep, that's expected (the decoder currently just silently ignores non-matching operands, and "dst" didn't match anything, but "rd" does -- so now it emits (correctly) an additional operand in decoding). It's still broken, as mentioned, though, since the sub-operands aren't supported in decoding yet. Patch coming soon will address that and make other improvements here.

This revision was landed with ongoing or failed builds.Oct 26 2022, 11:06 AM
This revision was automatically updated to reflect the committed changes.