Skip to content

Commit

Permalink
[MC] Migrate to createAsmStreamer without unused bool parameters
Browse files Browse the repository at this point in the history
In bolt/lib/Passes/AsmDump.cpp, the MCInstPrinter is created with false
AsmVerbose. The AsmVerbose argument to createAsmStreamer is unused.

Deprecate the legacy Target::createAsmStreamer overload, which might be
used by downstream.
  • Loading branch information
MaskRay committed Jul 21, 2024
1 parent 14a543e commit 867faee
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
7 changes: 2 additions & 5 deletions bolt/lib/Passes/AsmDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,8 @@ void dumpFunction(const BinaryFunction &BF) {
auto FOut = std::make_unique<formatted_raw_ostream>(OS);
FOut->SetUnbuffered();
std::unique_ptr<MCStreamer> AsmStreamer(
createAsmStreamer(*LocalCtx, std::move(FOut),
/*isVerboseAsm=*/true,
/*useDwarfDirectory=*/false, InstructionPrinter,
std::move(MCEInstance.MCE), std::move(MAB),
/*ShowInst=*/false));
createAsmStreamer(*LocalCtx, std::move(FOut), InstructionPrinter,
std::move(MCEInstance.MCE), std::move(MAB)));
AsmStreamer->initSections(true, *BC.STI);
std::unique_ptr<TargetMachine> TM(BC.TheTarget->createTargetMachine(
BC.TripleName, "", "", TargetOptions(), std::nullopt));
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/MC/TargetRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ MCStreamer *createNullStreamer(MCContext &Ctx);
/// the assembly.
MCStreamer *
createAsmStreamer(MCContext &Ctx, std::unique_ptr<formatted_raw_ostream> OS,
bool isVerboseAsm, bool useDwarfDirectory,
MCInstPrinter *InstPrint, std::unique_ptr<MCCodeEmitter> &&CE,
std::unique_ptr<MCAsmBackend> &&TAB, bool ShowInst);
std::unique_ptr<MCAsmBackend> &&TAB);

MCStreamer *createELFStreamer(MCContext &Ctx,
std::unique_ptr<MCAsmBackend> &&TAB,
Expand Down Expand Up @@ -544,6 +543,7 @@ class Target {
MCInstPrinter *IP,
std::unique_ptr<MCCodeEmitter> CE,
std::unique_ptr<MCAsmBackend> TAB) const;
LLVM_DEPRECATED("Use the overload without the 3 unused bool", "")
MCStreamer *
createAsmStreamer(MCContext &Ctx, std::unique_ptr<formatted_raw_ostream> OS,
bool IsVerboseAsm, bool UseDwarfDirectory,
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/MC/MCAsmStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2657,11 +2657,9 @@ void MCAsmStreamer::doFinalizationAtSectionEnd(MCSection *Section) {

MCStreamer *llvm::createAsmStreamer(MCContext &Context,
std::unique_ptr<formatted_raw_ostream> OS,
bool isVerboseAsm, bool useDwarfDirectory,
MCInstPrinter *IP,
std::unique_ptr<MCCodeEmitter> &&CE,
std::unique_ptr<MCAsmBackend> &&MAB,
bool ShowInst) {
std::unique_ptr<MCAsmBackend> &&MAB) {
return new MCAsmStreamer(Context, std::move(OS), IP, std::move(CE),
std::move(MAB));
}
4 changes: 2 additions & 2 deletions llvm/lib/MC/TargetRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ MCStreamer *Target::createAsmStreamer(MCContext &Ctx,
std::unique_ptr<MCCodeEmitter> CE,
std::unique_ptr<MCAsmBackend> TAB) const {
formatted_raw_ostream &OSRef = *OS;
MCStreamer *S = llvm::createAsmStreamer(Ctx, std::move(OS), false, false, IP,
std::move(CE), std::move(TAB), false);
MCStreamer *S = llvm::createAsmStreamer(Ctx, std::move(OS), IP,
std::move(CE), std::move(TAB));
auto *TO = Ctx.getTargetOptions();
createAsmTargetStreamer(*S, OSRef, IP, TO && TO->AsmVerbose);
return S;
Expand Down

0 comments on commit 867faee

Please sign in to comment.