This is an archive of the discontinued LLVM Phabricator instance.

[AsmWriter] Factor out mnemonic generation to accessible getMnemonic.
ClosedPublic

Authored by fhahn on Oct 23 2020, 6:36 AM.

Details

Summary

This patch factors out the part of printInstruction that gets the
mnemonic string for a given MCInst. This is intended to be used
subsequently for the instruction-mix remarks to display the final
mnemonic (D90040).

Unfortunately making getMnemonic available to the AsmPrinter
seems to require making it virtual. Not sure if there's a way around
that with the current layering of the AsmPrinters.

Diff Detail

Event Timeline

fhahn created this revision.Oct 23 2020, 6:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 23 2020, 6:36 AM
fhahn requested review of this revision.Oct 23 2020, 6:36 AM
fhahn updated this revision to Diff 301428.Oct 28 2020, 2:13 PM

Use const char * instead of std::string

fhahn edited the summary of this revision. (Show Details)Oct 28 2020, 2:17 PM

This seems reasonable to me.

fhahn updated this revision to Diff 303888.Nov 9 2020, 8:32 AM

Rebased, move assertion to printInstruction, so getMnemonic can be called with pseudo instructions as well.

This seems reasonable to me.

Thanks for taking a look! I think it would be good to review this together with the intended use case in D90040, to make sure using it there makes sense as well.

I see no problem with this.

This revision is now accepted and ready to land.Nov 13 2020, 11:57 AM
This revision was landed with ongoing or failed builds.Nov 17 2020, 1:48 AM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.Nov 17 2020, 1:49 AM

Thanks everyone for taking a look at this one!