[llvm] 2bb8a56 - [MC] emitCodeAlignment: take MCSubtargetInfo by reference. NFC (#205140)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 22 10:48:07 PDT 2026
Author: Fangrui Song
Date: 2026-06-22T17:48:02Z
New Revision: 2bb8a56e7dfc6e0a90c0464d9b65640f0252883d
URL: https://github.com/llvm/llvm-project/commit/2bb8a56e7dfc6e0a90c0464d9b65640f0252883d
DIFF: https://github.com/llvm/llvm-project/commit/2bb8a56e7dfc6e0a90c0464d9b65640f0252883d.diff
LOG: [MC] emitCodeAlignment: take MCSubtargetInfo by reference. NFC (#205140)
The fragment member cannot be null, and the sibling streamer hooks
(emitInstruction, initSections, emitPrefAlign) already take it by
reference.
Added:
Modified:
bolt/lib/Core/BinaryEmitter.cpp
llvm/include/llvm/MC/MCObjectStreamer.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/lib/MC/MCStreamer.cpp
llvm/lib/MC/MCWinCOFFStreamer.cpp
llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
llvm/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/lib/Target/ARM/ARMMCInstLower.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.cpp
llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
llvm/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp
llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.h
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/X86MCInstLower.cpp
Removed:
################################################################################
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index 6affddafd3bf5..43b42703c86d7 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -319,14 +319,14 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
// tentative layout.
Section->ensureMinAlignment(Align(opts::AlignFunctions));
- Streamer.emitCodeAlignment(Function.getMinAlign(), &*BC.STI);
+ Streamer.emitCodeAlignment(Function.getMinAlign(), *BC.STI);
uint16_t MaxAlignBytes = FF.isSplitFragment()
? Function.getMaxColdAlignmentBytes()
: Function.getMaxAlignmentBytes();
if (MaxAlignBytes > 0)
- Streamer.emitCodeAlignment(Function.getAlign(), &*BC.STI, MaxAlignBytes);
+ Streamer.emitCodeAlignment(Function.getAlign(), *BC.STI, MaxAlignBytes);
} else {
- Streamer.emitCodeAlignment(Function.getAlign(), &*BC.STI);
+ Streamer.emitCodeAlignment(Function.getAlign(), *BC.STI);
}
if (size_t Padding = opts::padFunctionBefore(Function)) {
@@ -459,7 +459,7 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, FunctionFragment &FF,
for (BinaryBasicBlock *const BB : FF) {
if ((opts::AlignBlocks || opts::PreserveBlocksAlignment) &&
BB->getAlignment() > 1)
- Streamer.emitCodeAlignment(BB->getAlign(), &*BC.STI,
+ Streamer.emitCodeAlignment(BB->getAlign(), *BC.STI,
BB->getAlignmentMaxBytes());
Streamer.emitLabel(BB->getLabel());
if (!EmitCodeOnly) {
@@ -537,7 +537,7 @@ void BinaryEmitter::emitConstantIslands(BinaryFunction &BF, bool EmitColdPart,
const uint16_t Alignment = OnBehalfOf
? OnBehalfOf->getConstantIslandAlignment()
: BF.getConstantIslandAlignment();
- Streamer.emitCodeAlignment(Align(Alignment), &*BC.STI);
+ Streamer.emitCodeAlignment(Align(Alignment), *BC.STI);
if (!OnBehalfOf) {
if (!EmitColdPart)
diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h
index cb2694b231d5b..003f6106d15ba 100644
--- a/llvm/include/llvm/MC/MCObjectStreamer.h
+++ b/llvm/include/llvm/MC/MCObjectStreamer.h
@@ -137,7 +137,7 @@ class LLVM_ABI MCObjectStreamer : public MCStreamer {
void emitValueToAlignment(Align Alignment, int64_t Fill = 0,
uint8_t FillLen = 1,
unsigned MaxBytesToEmit = 0) override;
- void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI,
+ void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit = 0) override;
void emitPrefAlign(Align Alignment, const MCSymbol &End, bool EmitNops,
uint8_t Fill, const MCSubtargetInfo &STI) override;
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index 3b25cc5440c52..f1479f860e885 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -853,7 +853,7 @@ class LLVM_ABI MCStreamer {
/// \param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If
/// the alignment cannot be reached in this many bytes, no bytes are
/// emitted.
- virtual void emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI,
+ virtual void emitCodeAlignment(Align Alignment, const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit = 0);
virtual void emitPrefAlign(Align A, const MCSymbol &End, bool EmitNops,
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index cdb9d760606f6..d93e06f0300ed 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2754,12 +2754,12 @@ void AsmPrinter::emitGlobalIFunc(Module &M, const GlobalIFunc &GI) {
MCSymbol *Stub = getSymbol(&GI);
EmitLinkage(Stub);
- OutStreamer->emitCodeAlignment(TextAlign, getIFuncMCSubtargetInfo());
+ OutStreamer->emitCodeAlignment(TextAlign, *getIFuncMCSubtargetInfo());
OutStreamer->emitLabel(Stub);
emitVisibility(Stub, GI.getVisibility());
emitMachOIFuncStubBody(M, GI, LazyPointer);
- OutStreamer->emitCodeAlignment(TextAlign, getIFuncMCSubtargetInfo());
+ OutStreamer->emitCodeAlignment(TextAlign, *getIFuncMCSubtargetInfo());
OutStreamer->emitLabel(StubHelper);
emitVisibility(StubHelper, GI.getVisibility());
emitMachOIFuncStubHelperBody(M, GI, LazyPointer);
@@ -3833,7 +3833,7 @@ Align AsmPrinter::emitAlignment(Align Alignment, const GlobalObject *GV,
STI = &getSubtargetInfo();
else
STI = &TM.getMCSubtargetInfo();
- OutStreamer->emitCodeAlignment(Alignment, STI, MaxBytesToEmit);
+ OutStreamer->emitCodeAlignment(Alignment, *STI, MaxBytesToEmit);
} else
OutStreamer->emitValueToAlignment(Alignment, 0, 1, MaxBytesToEmit);
return Alignment;
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index 0344d1c0ead03..a518daa997945 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -284,7 +284,7 @@ class MCAsmStreamer final : public MCAsmBaseStreamer {
uint8_t FillLen = 1,
unsigned MaxBytesToEmit = 0) override;
- void emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI,
+ void emitCodeAlignment(Align Alignment, const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit = 0) override;
void emitPrefAlign(Align Alignment, const MCSymbol &End, bool EmitNops,
uint8_t Fill, const MCSubtargetInfo &STI) override;
@@ -1573,7 +1573,7 @@ void MCAsmStreamer::emitValueToAlignment(Align Alignment, int64_t Fill,
}
void MCAsmStreamer::emitCodeAlignment(Align Alignment,
- const MCSubtargetInfo *STI,
+ const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit) {
// Emit with a text fill value.
if (MAI->getTextAlignFillValue())
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index a7e450de4f1bc..a18b27b2dc132 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -54,7 +54,7 @@ void MCELFStreamer::initSections(const MCSubtargetInfo &STI) {
MCContext &Ctx = getContext();
switchSection(Ctx.getObjectFileInfo()->getTextSection());
emitCodeAlignment(Align(Ctx.getObjectFileInfo()->getTextSectionAlignment()),
- &STI);
+ STI);
}
void MCELFStreamer::emitLabel(MCSymbol *S, SMLoc Loc) {
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 81410b37069fb..d89e5df706b21 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -683,12 +683,12 @@ void MCObjectStreamer::emitValueToAlignment(Align Alignment, int64_t Fill,
}
void MCObjectStreamer::emitCodeAlignment(Align Alignment,
- const MCSubtargetInfo *STI,
+ const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit) {
auto *F = getCurrentFragment();
emitValueToAlignment(Alignment, 0, 1, MaxBytesToEmit);
F->u.align.EmitNops = true;
- F->STI = STI;
+ F->STI = &STI;
}
void MCObjectStreamer::emitPrefAlign(Align Alignment, const MCSymbol &End,
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index c4cc4d870ccf6..e0ad48f6e1932 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3480,8 +3480,8 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, uint8_t ValueSize) {
// Check whether we should use optimal code alignment for this .align
// directive.
if (MAI.useCodeAlign(*Section) && !HasFillExpr) {
- getStreamer().emitCodeAlignment(
- Align(Alignment), &getTargetParser().getSTI(), MaxBytesToFill);
+ getStreamer().emitCodeAlignment(Align(Alignment),
+ getTargetParser().getSTI(), MaxBytesToFill);
} else {
// FIXME: Target specific behavior about how the "extra" bytes are filled.
getStreamer().emitValueToAlignment(Align(Alignment), FillExpr, ValueSize,
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index 14443a63dda63..0a4ab8a552dad 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -4227,7 +4227,7 @@ bool MasmParser::emitAlignTo(int64_t Alignment) {
const MCSection *Section = getStreamer().getCurrentSectionOnly();
if (MAI.useCodeAlign(*Section)) {
getStreamer().emitCodeAlignment(Align(Alignment),
- &getTargetParser().getSTI(),
+ getTargetParser().getSTI(),
/*MaxBytesToEmit=*/0);
} else {
// FIXME: Target specific behavior about how the "extra" bytes are filled.
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 1f0d915fae8ab..1cd94715b2592 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -1523,7 +1523,7 @@ void MCStreamer::emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
void MCStreamer::emitValueToAlignment(Align, int64_t, uint8_t, unsigned) {}
void MCStreamer::emitPrefAlign(Align A, const MCSymbol &End, bool EmitNops,
uint8_t Fill, const MCSubtargetInfo &STI) {}
-void MCStreamer::emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI,
+void MCStreamer::emitCodeAlignment(Align Alignment, const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit) {}
void MCStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value,
SMLoc Loc) {}
diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp
index 7b4faad7ad88f..467b8e634f03e 100644
--- a/llvm/lib/MC/MCWinCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp
@@ -138,13 +138,13 @@ void MCWinCOFFStreamer::initSections(const MCSubtargetInfo &STI) {
// This emulates the same behavior of GNU as. This makes it easier
// to compare the output as the major sections are in the same order.
switchSection(getContext().getObjectFileInfo()->getTextSection());
- emitCodeAlignment(Align(4), &STI);
+ emitCodeAlignment(Align(4), STI);
switchSection(getContext().getObjectFileInfo()->getDataSection());
- emitCodeAlignment(Align(4), &STI);
+ emitCodeAlignment(Align(4), STI);
switchSection(getContext().getObjectFileInfo()->getBSSSection());
- emitCodeAlignment(Align(4), &STI);
+ emitCodeAlignment(Align(4), STI);
switchSection(getContext().getObjectFileInfo()->getTextSection());
}
diff --git a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
index b16c0460adf38..156c12c5ab8dd 100644
--- a/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ b/llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -510,7 +510,7 @@ void AArch64AsmPrinter::emitSled(const MachineInstr &MI, SledKind Kind) {
// ;DATA: higher 32 bits of the address of the trampoline
// LDP X0, X30, [SP], #16 ; pop X0 and the link register from the stack
//
- OutStreamer->emitCodeAlignment(Align(4), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(4), getSubtargetInfo());
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
OutStreamer->emitLabel(CurSled);
auto Target = OutContext.createTempSymbol();
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index 8b8d0bc9ada11..c25a2cfeff8d6 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -2403,7 +2403,7 @@ void ARMAsmPrinter::emitInstruction(const MachineInstr *MI) {
// FIXME: Ideally we could vary the LDRB index based on the padding
// between the sequence and jump table, however that relies on MCExprs
// for load indexes which are currently not supported.
- OutStreamer->emitCodeAlignment(Align(4), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(4), getSubtargetInfo());
EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tADDhirr)
.addReg(Idx)
.addReg(Idx)
diff --git a/llvm/lib/Target/ARM/ARMMCInstLower.cpp b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
index 79ee0f22f3c1e..6f948f4cb33ad 100644
--- a/llvm/lib/Target/ARM/ARMMCInstLower.cpp
+++ b/llvm/lib/Target/ARM/ARMMCInstLower.cpp
@@ -213,7 +213,7 @@ void ARMAsmPrinter::EmitSled(const MachineInstr &MI, SledKind Kind)
// BLX ip
// POP{ r0, lr }
//
- OutStreamer->emitCodeAlignment(Align(4), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(4), getSubtargetInfo());
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
OutStreamer->emitLabel(CurSled);
auto Target = OutContext.createTempSymbol();
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index a4ac7f61713e0..1cac96a744733 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -11650,7 +11650,7 @@ bool ARMAsmParser::parseDirectiveThumb(SMLoc L) {
SwitchMode();
getTargetStreamer().emitCode16();
- getParser().getStreamer().emitCodeAlignment(Align(2), &getSTI(), 0);
+ getParser().getStreamer().emitCodeAlignment(Align(2), getSTI(), 0);
return false;
}
@@ -11663,7 +11663,7 @@ bool ARMAsmParser::parseDirectiveARM(SMLoc L) {
if (isThumb())
SwitchMode();
getTargetStreamer().emitCode32();
- getParser().getStreamer().emitCodeAlignment(Align(4), &getSTI(), 0);
+ getParser().getStreamer().emitCodeAlignment(Align(4), getSTI(), 0);
return false;
}
@@ -12320,7 +12320,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
assert(Section && "must have section to emit alignment");
if (getContext().getAsmInfo().useCodeAlign(*Section))
- getStreamer().emitCodeAlignment(Align(2), &getSTI());
+ getStreamer().emitCodeAlignment(Align(2), getSTI());
else
getStreamer().emitValueToAlignment(Align(2));
@@ -12518,7 +12518,7 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) {
const MCSection *Section = getStreamer().getCurrentSectionOnly();
assert(Section && "must have section to emit alignment");
if (getContext().getAsmInfo().useCodeAlign(*Section))
- getStreamer().emitCodeAlignment(Align(4), &getSTI(), 0);
+ getStreamer().emitCodeAlignment(Align(4), getSTI(), 0);
else
getStreamer().emitValueToAlignment(Align(4), 0, 1, 0);
return false;
diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.cpp
index c2a389515b856..d787f251087ee 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYTargetStreamer.cpp
@@ -31,7 +31,7 @@ void CSKYConstantPool::emitAll(MCStreamer &Streamer) {
for (const ConstantPoolEntry &Entry : Entries) {
Streamer.emitCodeAlignment(
Align(Entry.Size),
- Streamer.getContext().getSubtargetInfo()); // align naturally
+ *Streamer.getContext().getSubtargetInfo()); // align naturally
Streamer.emitLabel(Entry.Label);
Streamer.emitValue(Entry.Value, Entry.Size, Entry.Loc);
}
diff --git a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
index dd27d05e2a368..a0927d5e58a18 100644
--- a/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
+++ b/llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
@@ -1559,7 +1559,7 @@ int HexagonAsmParser::processInstruction(MCInst &Inst,
MES->switchSection(mySection);
unsigned byteSize = is32bit ? 4 : 8;
- getStreamer().emitCodeAlignment(Align(byteSize), &getSTI(), byteSize);
+ getStreamer().emitCodeAlignment(Align(byteSize), getSTI(), byteSize);
MCSymbol *Sym;
diff --git a/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp b/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
index 89291a05cc05e..2a1427b38142c 100644
--- a/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonAsmPrinter.cpp
@@ -208,7 +208,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
OutStreamer.emitLabel(Sym);
OutStreamer.emitSymbolAttribute(Sym, MCSA_Global);
OutStreamer.emitIntValue(Value, AlignSize);
- OutStreamer.emitCodeAlignment(Align(AlignSize), &STI);
+ OutStreamer.emitCodeAlignment(Align(AlignSize), STI);
}
} else {
assert(Imm.isExpr() && "Expected expression and found none");
@@ -236,7 +236,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI,
OutStreamer.emitLabel(Sym);
OutStreamer.emitSymbolAttribute(Sym, MCSA_Local);
OutStreamer.emitValue(Imm.getExpr(), AlignSize);
- OutStreamer.emitCodeAlignment(Align(AlignSize), &STI);
+ OutStreamer.emitCodeAlignment(Align(AlignSize), STI);
}
}
return Sym;
diff --git a/llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp b/llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
index df1037469a078..52afb2a8af199 100644
--- a/llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
@@ -250,7 +250,7 @@ void LoongArchAsmPrinter::emitSled(const MachineInstr &MI, SledKind Kind) {
// The count here should be adjusted accordingly if the implementation
// changes.
const int8_t NoopsInSledCount = 11;
- OutStreamer->emitCodeAlignment(Align(4), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(4), getSubtargetInfo());
MCSymbol *BeginOfSled = OutContext.createTempSymbol("xray_sled_begin");
MCSymbol *EndOfSled = OutContext.createTempSymbol("xray_sled_end");
OutStreamer->emitLabel(BeginOfSled);
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index e0725b713a5aa..abdb9778e8233 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -971,7 +971,7 @@ void MipsTargetELFStreamer::finish() {
Align Alignment = Section.getAlign();
S.switchSection(&Section);
if (getContext().getAsmInfo().useCodeAlign(Section))
- S.emitCodeAlignment(Alignment, &STI, Alignment.value());
+ S.emitCodeAlignment(Alignment, STI, Alignment.value());
else
S.emitValueToAlignment(Alignment, 0, 1, Alignment.value());
}
diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
index 715b96e52e6c8..62fd0ef319e1a 100644
--- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
+++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp
@@ -1185,7 +1185,7 @@ void MipsAsmPrinter::EmitSled(const MachineInstr &MI, SledKind Kind) {
// LD RA, 8(SP)
// DADDIU SP, SP, 16
//
- OutStreamer->emitCodeAlignment(Align(4), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(4), getSubtargetInfo());
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
OutStreamer->emitLabel(CurSled);
auto Target = OutContext.createTempSymbol();
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index b9e03f087082d..7b2d2be503d72 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -52,7 +52,7 @@ void PPCELFStreamer::emitPrefixedInstruction(const MCInst &Inst,
// all of the nops required as part of the alignment operation. In the cases
// when no nops are added then The fragment is still created but it remains
// empty.
- emitCodeAlignment(Align(64), &STI, 4);
+ emitCodeAlignment(Align(64), STI, 4);
// Emit the instruction.
// Since the previous emit created a new fragment then adding this instruction
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
index 54163ee306cba..fae35c4248e7e 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFStreamer.cpp
@@ -42,7 +42,7 @@ void PPCXCOFFStreamer::emitPrefixedInstruction(const MCInst &Inst,
// prefixed instruction. Align to 64 bytes if possible but add a maximum of 4
// bytes when trying to do that. If alignment requires adding more than 4
// bytes then the instruction won't be aligned.
- emitCodeAlignment(Align(64), &STI, 4);
+ emitCodeAlignment(Align(64), STI, 4);
// Emit the instruction.
// Since the previous emit created a new fragment then adding this instruction
diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 0a2c7a1719042..51f2ff4a68be7 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1901,7 +1901,7 @@ void PPCLinuxAsmPrinter::emitInstruction(const MachineInstr *MI) {
//
// Update compiler-rt/lib/xray/xray_powerpc64.cc accordingly when number
// of instructions change.
- OutStreamer->emitCodeAlignment(Align(8), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(8), getSubtargetInfo());
MCSymbol *BeginOfSled = OutContext.createTempSymbol();
OutStreamer->emitLabel(BeginOfSled);
EmitToStreamer(*OutStreamer, RetInst);
diff --git a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
index a5e35977f8407..ef140fc79ffd9 100644
--- a/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
+++ b/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
@@ -292,7 +292,7 @@ void RISCVAsmPrinter::emitLpadAlignedCall(const MachineInstr &MI) {
HasRelax = MCSTI.hasFeature(RISCV::FeatureRelax);
if (HasZca)
- OutStreamer->emitCodeAlignment(Align(4), &MCSTI);
+ OutStreamer->emitCodeAlignment(Align(4), MCSTI);
if (OutStreamer->hasRawTextSupport()) {
// Assembly path: wrap call with .option push/exact/pop and emit LPAD
@@ -597,7 +597,7 @@ void RISCVAsmPrinter::emitSled(const MachineInstr *MI, SledKind Kind) {
// is a chance that we'll use C.JAL instead, so an additional NOP is needed.
const uint8_t NoopsInSledCount = STI->is64Bit() ? 33 : 21;
- OutStreamer->emitCodeAlignment(Align(4), STI);
+ OutStreamer->emitCodeAlignment(Align(4), *STI);
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
OutStreamer->emitLabel(CurSled);
auto Target = OutContext.createTempSymbol();
diff --git a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
index 96cbb262aa170..c311af40ef142 100644
--- a/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -345,7 +345,7 @@ void SparcAsmPrinter::emitInstruction(const MachineInstr *MI) {
case SP::SWAPrr:
case SP::SWAPri:
if (MF->getSubtarget<SparcSubtarget>().fixTN0011())
- OutStreamer->emitCodeAlignment(Align(16), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(16), getSubtargetInfo());
break;
case SP::GETPCX:
LowerGETPCXAndEmitMCInsts(MI, getSubtargetInfo());
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp
index b38bbb09fb8fa..9e7c35b5c3ce9 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.cpp
@@ -154,7 +154,7 @@ void SystemZHLASMAsmStreamer::emitValueToAlignment(Align Alignment,
}
void SystemZHLASMAsmStreamer::emitCodeAlignment(Align Alignment,
- const MCSubtargetInfo *STI,
+ const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit) {
// Emit with a text fill value.
if (MAI->getTextAlignFillValue())
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.h b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.h
index ee7c5dcbf552c..d3fe8d791dd0f 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.h
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMAsmStreamer.h
@@ -87,7 +87,7 @@ class SystemZHLASMAsmStreamer final : public MCStreamer {
void emitValueToAlignment(Align Alignment, int64_t Fill, uint8_t FillLen,
unsigned MaxBytesToEmit) override;
- void emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI,
+ void emitCodeAlignment(Align Alignment, const MCSubtargetInfo &STI,
unsigned MaxBytesToEmit = 0) override;
/// Return true if this streamer supports verbose assembly at all.
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 33ce25425b29e..45aff90a9998c 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -4951,7 +4951,7 @@ bool X86AsmParser::parseDirectiveEven(SMLoc L) {
Section = getStreamer().getCurrentSectionOnly();
}
if (getContext().getAsmInfo().useCodeAlign(*Section))
- getStreamer().emitCodeAlignment(Align(2), &getSTI(), 0);
+ getStreamer().emitCodeAlignment(Align(2), getSTI(), 0);
else
getStreamer().emitValueToAlignment(Align(2), 0, 1, 0);
return false;
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index 9d285b5e2dcf0..2219d0a222cfc 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -1127,7 +1127,7 @@ void X86AsmPrinter::LowerPATCHABLE_EVENT_CALL(const MachineInstr &MI,
// First we emit the label and the jump.
auto CurSled = OutContext.createTempSymbol("xray_event_sled_", true);
OutStreamer->AddComment("# XRay Custom Event Log");
- OutStreamer->emitCodeAlignment(Align(2), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(2), getSubtargetInfo());
OutStreamer->emitLabel(CurSled);
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
@@ -1225,7 +1225,7 @@ void X86AsmPrinter::LowerPATCHABLE_TYPED_EVENT_CALL(const MachineInstr &MI,
// First we emit the label and the jump.
auto CurSled = OutContext.createTempSymbol("xray_typed_event_sled_", true);
OutStreamer->AddComment("# XRay Typed Event Log");
- OutStreamer->emitCodeAlignment(Align(2), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(2), getSubtargetInfo());
OutStreamer->emitLabel(CurSled);
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
@@ -1325,7 +1325,7 @@ void X86AsmPrinter::LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI,
// call <relative offset, 32-bits> // 5 bytes
//
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
- OutStreamer->emitCodeAlignment(Align(2), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(2), getSubtargetInfo());
OutStreamer->emitLabel(CurSled);
// Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as
@@ -1355,7 +1355,7 @@ void X86AsmPrinter::LowerPATCHABLE_RET(const MachineInstr &MI,
//
// This just makes sure that the alignment for the next instruction is 2.
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
- OutStreamer->emitCodeAlignment(Align(2), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(2), getSubtargetInfo());
OutStreamer->emitLabel(CurSled);
unsigned OpCode = MI.getOperand(0).getImm();
MCInst Ret;
@@ -1408,7 +1408,7 @@ void X86AsmPrinter::LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI,
// the PATCHABLE_FUNCTION_ENTER case, followed by the lowering of the actual
// tail call much like how we have it in PATCHABLE_RET.
auto CurSled = OutContext.createTempSymbol("xray_sled_", true);
- OutStreamer->emitCodeAlignment(Align(2), &getSubtargetInfo());
+ OutStreamer->emitCodeAlignment(Align(2), getSubtargetInfo());
OutStreamer->emitLabel(CurSled);
auto Target = OutContext.createTempSymbol();
More information about the llvm-commits
mailing list