-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm] Adopt WithMarkup in the MIPS backend #65384
Conversation
Adopt the new markup overload, introduced in 77d1032, in the MIPS backend.
@@ -213,12 +213,11 @@ void MipsInstPrinter::printMemOperand(const MCInst *MI, int opNum, | |||
break; | |||
} | |||
|
|||
O << markup("<mem:"); | |||
WithMarkup M = markup(O, Markup::Memory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless here because printOperand will change the color yet again and reset it to the default before returning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It keeps the original behavior, but if you're saying that's wrong then I'm happy to update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was thinking about colors and forgot about the "<mem:" part.
I don't know what the markup has beed used for and whether nested tags are allowed. I was trying to say that the memory operand will not have Memory style. Instead, it will be displayed as Immediate + Register or Register + Register (and default-style parentheses). If that's OK from lldb's point of view, I don't see other issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LLDB uses the ANSI escape characters for coloring, not the markup annotations so for LLDB this becomes a NOOP as you pointed out. I don't know who relies on the markup annotations but it's probably best to keep the existing behavior to avoid breaking any tools that might be relying on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me as long as the memory operands are printed the way lldb wants, though I have no relation to the MIPS backend.
Here is the proposal for annotated assembly output and the initial implementation.
PS I wouldn't mind if the support for marked-up disassembly was removed in favor of colored up disassembly. I doubt that there are any tools that actually parse the markup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but as noted the WithMarkup bit isn't very clear. I think that'd be better being explicit markup()'s just like the rest
@@ -213,12 +213,11 @@ void MipsInstPrinter::printMemOperand(const MCInst *MI, int opNum, | |||
break; | |||
} | |||
|
|||
O << markup("<mem:"); | |||
WithMarkup M = markup(O, Markup::Memory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with WithMarkup but I don't think it's very clear that this (I assume) affects the stream until it's destroyed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, something like make_scoped_markup
would've been clearer at the cost of being more verbose. Given that most uses use operator <<
I decided to prioritize readability for those cases.
Local branch amd-gfx 1b3f7c5 Merged main:ddbcc10b9e26 into amd-gfx:632a231f2ac6 Remote branch main c473215 [llvm] Adopt WithMarkup in the MIPS backend (llvm#65384)
Adopt the new markup overload, introduced in 77d1032, in the MIPS backend.
Adopt the new markup overload, introduced in 77d1032, in the MIPS backend.