Currently symbol names are printed in quotes if it contains something
outside of the arbitrary set of characters that isAcceptableChar tests
for. On somem targets, it is never OK to print a symbol name in quotes
so allow targets to opt out of this behavior.
Details
- Reviewers
arsenm
Diff Detail
Event Timeline
This needs a testcase.
This function is used to print assembly. You have an assembler that can handle any characters in the name? How?
include/llvm/MC/MCSymbol.h | ||
---|---|---|
58 | The comment is flipped, no? |
Replace with virtual function on MCAsmInfo to allow targets to control when symbols are quoted.
Most of the patch is threading MCAsmInfo arguments through all of the uses of MCSymbol/MCExpr printing
lib/MC/MCSymbol.cpp | ||
---|---|---|
29 | Can you pass a "const MCAsmInfo &" ? For the debug uses (i.e., dump), they can just say OS << Symbol->getName() instead of Symbol->print(OS, nullptr); |
lib/MC/MCSymbol.cpp | ||
---|---|---|
29 | I don't think so. For MCSymbol specifically, that would work. Most of these changes are for printing the MCExpr / MCOperands, which don't have a simple getName way of printing them, so those are handled with a null check in the MCSymbol printing |
Sorry for the delay.
It is looking a lot better, but there are still cases where we are passing a MCAsmInfo and it is not used.
lib/MC/MCInst.cpp | ||
---|---|---|
18 | This is just for debug, no? You can probably drop the MCAsmInfo from it. | |
44 | This is just for debug, you can drop the MCAsmInfo. | |
lib/MC/MCSymbol.cpp | ||
56 | This can be just "OS << getName();". |
OK, here is an updated patch.
The change from yours are:
- Note that empty names have to be quoted.
- Keep the old debug code in place.
Does it work for what you need?
Update for trunk.
I tried to merge in your changes, but may have missed some with the nasty merge from all of these functions changing names.
I does look like you missed some cases. A new patch is attached.
Please make sure to git-clang-format your patches.
Cheers,
Rafael
This is just for debug, no? You can probably drop the MCAsmInfo from it.