-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
[llc] Add -M for InstPrinter options #121078
base: main
Are you sure you want to change the base?
[llc] Add -M for InstPrinter options #121078
Conversation
Created using spr 1.3.5-bogner
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.
The way it is currently implemented it only works when invoking llc directly.
It would be great if the option could be set by the compiler driver, which passes options in memory.
See
MCOptions.AsmVerbose = true; |
Some targets prefer to not print aliases by default; there should be a way of enabling this behavior.
return createStringError(inconvertibleErrorCode(), | ||
"invalid InstPrinter option '" + Opt + "'"); |
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.
(nit) There is an overload accepting Twine
:
return createStringError(inconvertibleErrorCode(), | |
"invalid InstPrinter option '" + Opt + "'"); | |
return createStringError("invalid InstPrinter option '" + Opt + "'"); |
if (auto Err = MCStreamerOrErr.takeError()) { | ||
Context.reportError(SMLoc(), toString(std::move(Err))); |
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.
(nit) Could avoid moving the Error twice:
if (auto Err = MCStreamerOrErr.takeError()) { | |
Context.reportError(SMLoc(), toString(std::move(Err))); | |
if (!MCStreamerOrErr) { | |
Context.reportError(SMLoc(), toString(MCStreamerOrErr.takeError())); |
Thanks for the quick response. This patch intends to port You are right that Clang cc1as sets |
I'm not against the current approach, it is just I'm not sure that this option would be as useful for |
For many targets, llvm-objdump and llvm-mc
(https://reviews.llvm.org/D103004) support -M no-aliases (e.g.
RISCVInstPrinter::applyTargetSpecificCLOption
).This patch implements -M for llc.
While here, rename "DisassemblerOptions" in llvm-mc to the more
appropriate "InstPrinterOptions". For llvm-mc --assemble, there is no
disassembler involved.