This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] add labels to +DumpCode output
ClosedPublic

Authored by tpr on Nov 17 2017, 1:13 AM.

Details

Summary

+DumpCode is a hack to embed disassembly in the ELF file. This commit
fixes it to include labels, to make it slightly more useful.

Diff Detail

Repository
rL LLVM

Event Timeline

tpr created this revision.Nov 17 2017, 1:13 AM
arsenm edited edge metadata.Nov 17 2017, 11:11 AM

I still don't understand why +DumpCode is here or why it's a subtarget feature, and would like to remove it. Why do you need this? Why can't the driver just disassemble the binary itself if it wants to look at the text form

tpr added a comment.Nov 20 2017, 4:01 AM

You're right, it's a hack, and I would like to remove it too. But first we need to get the disassembler working. The disassembler is missing some instructions, and it claims it does not support SI or CI.

In the meantime, as a short term fix, I would like to add this to make +DumpCode more useful. That will make it easier to do other work we need to do before we get to fixing the disassembler.

tpr added a comment.Nov 25 2017, 9:12 AM

If there are no further comments on this, I will land it in the next few days.

I don't think getting SI/CI to work in the disassembler will be that much work. Which instructions aren't supported? There can't be that many of them.

lib/Target/AMDGPU/AMDGPUAsmPrinter.h
200 ↗(On Diff #123304)

Using mutable here is questionable

tpr added inline comments.Nov 30 2017, 3:28 PM
lib/Target/AMDGPU/AMDGPUAsmPrinter.h
200 ↗(On Diff #123304)

Yes. The alternative is to do the label in EmitInstruction with a hack to tell when you have changed basic block, possibly including a non-thread-safe static variable. Would you prefer that?

In defense of using mutable, I think we all recognize +dumpcode as a hack that needs to be removed. This mutable would go with it.

arsenm accepted this revision.Dec 1 2017, 2:22 PM

LGTM

This revision is now accepted and ready to land.Dec 1 2017, 2:22 PM
This revision was automatically updated to reflect the committed changes.