By setting up the AsmStrings correctly we can remove some special cases
from AMDGPUInstPrinter::printOffset.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Unfortunately I can't reliably test this change with FileCheck. It seems to tolerate a double space in the input when I only want to match a single space, even if I use a regexp pattern like {{\ }}.
| llvm/lib/Target/AMDGPU/DSInstructions.td | ||
|---|---|---|
| 333 | ||
| llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp | ||
|---|---|---|
| 142 | Are you sure it didn't add an extra space in some other instructions? Are there any other instructions where offset can be the first operand? | |
| llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp | ||
|---|---|---|
| 142 |
Well it didn't break any disassembler tests with -strict-whitespace. I did wonder if it might add an extra space at the *end* of some other instruction, that would be hidden because -show-encoding pads with spaces to a fixed column number before adding the "; encoding:" comment. But...
No, I have looked through the output of tablegen and I can't find any others. | |
| llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp | ||
|---|---|---|
| 142 | An alternative fix would be to remove this special handling of OpNo==0 and change the AsmStrings to remove the space between the mnemonic and the $offset operand. I can try that out. | |
| llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp | ||
|---|---|---|
| 142 | If it works it would be cleaner. | |
Why is there a $gds operand here if it's not used for printing?