[Alignment][NFC] Use Align in MCStreamer::emitValueToAlignment

Differential Revision: https://reviews.llvm.org/D138674
This commit is contained in:
Guillaume Chatelet 2022-11-24 15:23:06 +00:00
parent b9e3f5f864
commit 6c09ea3fdd
43 changed files with 80 additions and 84 deletions

View File

@ -254,6 +254,7 @@ public:
uint64_t getEndAddress() const { return Address + Size; }
uint64_t getSize() const { return Size; }
uint64_t getInputFileOffset() const { return InputFileOffset; }
Align getAlign() const { return Align(Alignment); }
uint64_t getAlignment() const { return Alignment; }
bool isText() const {
if (isELF())

View File

@ -795,7 +795,7 @@ void BinaryEmitter::emitJumpTable(const JumpTable &JT, MCSection *HotSection,
LabelCounts[CurrentLabel] = CurrentLabelCount;
} else {
Streamer.switchSection(JT.Count > 0 ? HotSection : ColdSection);
Streamer.emitValueToAlignment(JT.EntrySize);
Streamer.emitValueToAlignment(Align(JT.EntrySize));
}
MCSymbol *LastLabel = nullptr;
uint64_t Offset = 0;
@ -815,7 +815,7 @@ void BinaryEmitter::emitJumpTable(const JumpTable &JT, MCSection *HotSection,
Streamer.switchSection(HotSection);
else
Streamer.switchSection(ColdSection);
Streamer.emitValueToAlignment(JT.EntrySize);
Streamer.emitValueToAlignment(Align(JT.EntrySize));
}
// Emit all labels registered at the address of this jump table
// to sync with our global symbol table. We may have two labels
@ -925,7 +925,7 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
const uint16_t TTypeAlignment = 4;
// Type tables have to be aligned at 4 bytes.
Streamer.emitValueToAlignment(TTypeAlignment);
Streamer.emitValueToAlignment(Align(TTypeAlignment));
// Emit the LSDA label.
MCSymbol *LSDASymbol = BF.getLSDASymbol(FF.getFragmentNum());

View File

@ -74,7 +74,7 @@ void BinarySection::emitAsData(MCStreamer &Streamer,
BC.Ctx->getELFSection(SectionName, getELFType(), getELFFlags());
Streamer.switchSection(ELFSection);
Streamer.emitValueToAlignment(getAlignment());
Streamer.emitValueToAlignment(getAlign());
if (BC.HasRelocations && opts::HotData && isReordered())
Streamer.emitLabel(BC.Ctx->getOrCreateSymbol("__hot_data_start"));

View File

@ -76,7 +76,7 @@ public:
void emitIdent(StringRef IdentString) override;
void emitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override;
void emitValueToAlignment(Align, int64_t, unsigned, unsigned) override;
void emitCGProfileEntry(const MCSymbolRefExpr *From,
const MCSymbolRefExpr *To, uint64_t Count) override;

View File

@ -152,7 +152,7 @@ public:
void emitBundleLock(bool AlignToEnd) override;
void emitBundleUnlock() override;
void emitBytes(StringRef Data) override;
void emitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
void emitValueToAlignment(Align Alignment, int64_t Value = 0,
unsigned ValueSize = 1,
unsigned MaxBytesToEmit = 0) override;
void emitCodeAlignment(Align ByteAlignment, const MCSubtargetInfo *STI,

View File

@ -854,15 +854,14 @@ public:
///
/// This used to implement the .align assembler directive.
///
/// \param ByteAlignment - The alignment to reach. This must be a power of
/// two on some targets.
/// \param Alignment - The alignment to reach.
/// \param Value - The value to use when filling bytes.
/// \param ValueSize - The size of the integer (in bytes) to emit for
/// \p Value. This must match a native machine width.
/// \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 emitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
virtual void emitValueToAlignment(Align Alignment, int64_t Value = 0,
unsigned ValueSize = 1,
unsigned MaxBytesToEmit = 0);

View File

@ -69,7 +69,7 @@ void AIXException::emitExceptionInfoTable(const MCSymbol *LSDA,
const unsigned PointerSize = DL.getPointerSize();
// Add necessary paddings in 64 bit mode.
Asm->OutStreamer->emitValueToAlignment(PointerSize);
Asm->OutStreamer->emitValueToAlignment(Align(PointerSize));
// LSDA location.
Asm->OutStreamer->emitValue(MCSymbolRefExpr::create(LSDA, Asm->OutContext),

View File

@ -531,7 +531,7 @@ template <typename DataT> void Dwarf5AccelTableWriter<DataT>::emit() {
emitOffsets(EntryPool);
emitAbbrevs();
emitData();
Asm->OutStreamer->emitValueToAlignment(4, 0);
Asm->OutStreamer->emitValueToAlignment(Align(4), 0);
Asm->OutStreamer->emitLabel(ContributionEnd);
}

View File

@ -2837,7 +2837,7 @@ void AsmPrinter::emitAlignment(Align Alignment, const GlobalObject *GV,
STI = TM.getMCSubtargetInfo();
OutStreamer->emitCodeAlignment(Alignment, STI, MaxBytesToEmit);
} else
OutStreamer->emitValueToAlignment(Alignment.value(), 0, 1, MaxBytesToEmit);
OutStreamer->emitValueToAlignment(Alignment, 0, 1, MaxBytesToEmit);
}
//===----------------------------------------------------------------------===//

View File

@ -560,7 +560,7 @@ void CodeViewDebug::maybeRecordLocation(const DebugLoc &DL,
}
void CodeViewDebug::emitCodeViewMagicVersion() {
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
OS.AddComment("Debug section magic");
OS.emitInt32(COFF::DEBUG_SECTION_MAGIC);
}
@ -754,7 +754,7 @@ void CodeViewDebug::emitTypeGlobalHashes() {
// hardcoded to version 0, SHA1.
OS.switchSection(Asm->getObjFileLowering().getCOFFGlobalTypeHashesSection());
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
OS.AddComment("Magic");
OS.emitInt32(COFF::DEBUG_HASHES_SECTION_MAGIC);
OS.AddComment("Section Version");
@ -3109,7 +3109,7 @@ MCSymbol *CodeViewDebug::beginCVSubsection(DebugSubsectionKind Kind) {
void CodeViewDebug::endCVSubsection(MCSymbol *EndLabel) {
OS.emitLabel(EndLabel);
// Every subsection must be aligned to a 4-byte boundary.
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
}
static StringRef getSymbolName(SymbolKind SymKind) {
@ -3136,7 +3136,7 @@ void CodeViewDebug::endSymbolRecord(MCSymbol *SymEnd) {
// an extra copy of every symbol record in LLD. This increases object file
// size by less than 1% in the clang build, and is compatible with the Visual
// C++ linker.
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
OS.emitLabel(SymEnd);
}

View File

@ -736,7 +736,7 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
// EHFlags & 1 -> Synchronous exceptions only, no async exceptions.
// EHFlags & 2 -> ???
// EHFlags & 4 -> The function is noexcept(true), unwinding can't continue.
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
OS.emitLabel(FuncInfoXData);
AddComment("MagicNumber");
@ -1010,7 +1010,7 @@ void WinException::emitExceptHandlerTable(const MachineFunction *MF) {
// Emit the __ehtable label that we use for llvm.x86.seh.lsda.
MCSymbol *LSDALabel = Asm->OutContext.getOrCreateLSDASymbol(FLinkageName);
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
OS.emitLabel(LSDALabel);
const auto *Per = cast<Function>(F.getPersonalityFn()->stripPointerCasts());

View File

@ -688,7 +688,7 @@ void StackMaps::emitCallsiteEntries(MCStreamer &OS) {
}
// Emit alignment to 8 byte.
OS.emitValueToAlignment(8);
OS.emitValueToAlignment(Align(8));
// Num live-out registers and padding to align to 4 byte.
OS.emitInt16(0);
@ -700,7 +700,7 @@ void StackMaps::emitCallsiteEntries(MCStreamer &OS) {
OS.emitIntValue(LO.Size, 1);
}
// Emit alignment to 8 byte.
OS.emitValueToAlignment(8);
OS.emitValueToAlignment(Align(8));
}
}

View File

@ -434,7 +434,7 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(
ELF::SHT_PROGBITS, Flags, 0);
unsigned Size = DL.getPointerSize();
Streamer.switchSection(Sec);
Streamer.emitValueToAlignment(DL.getPointerABIAlignment(0).value());
Streamer.emitValueToAlignment(DL.getPointerABIAlignment(0));
Streamer.emitSymbolAttribute(Label, MCSA_ELF_TypeObject);
const MCExpr *E = MCConstantExpr::create(Size, getContext());
Streamer.emitELFSize(Label, E);

View File

@ -28,7 +28,7 @@ void ConstantPool::emitEntries(MCStreamer &Streamer) {
return;
Streamer.emitDataRegion(MCDR_DataRegion);
for (const ConstantPoolEntry &Entry : Entries) {
Streamer.emitValueToAlignment(Entry.Size); // align naturally
Streamer.emitValueToAlignment(Align(Entry.Size)); // align naturally
Streamer.emitLabel(Entry.Label);
Streamer.emitValue(Entry.Value, Entry.Size, Entry.Loc);
}

View File

@ -252,7 +252,7 @@ public:
void emitAlignmentDirective(unsigned ByteAlignment, Optional<int64_t> Value,
unsigned ValueSize, unsigned MaxBytesToEmit);
void emitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
void emitValueToAlignment(Align Alignment, int64_t Value = 0,
unsigned ValueSize = 1,
unsigned MaxBytesToEmit = 0) override;
@ -1482,10 +1482,10 @@ void MCAsmStreamer::emitAlignmentDirective(unsigned ByteAlignment,
EmitEOL();
}
void MCAsmStreamer::emitValueToAlignment(unsigned ByteAlignment, int64_t Value,
void MCAsmStreamer::emitValueToAlignment(Align Alignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {
emitAlignmentDirective(ByteAlignment, Value, ValueSize, MaxBytesToEmit);
emitAlignmentDirective(Alignment.value(), Value, ValueSize, MaxBytesToEmit);
}
void MCAsmStreamer::emitCodeAlignment(Align Alignment,

View File

@ -185,7 +185,7 @@ void CodeViewContext::emitStringTable(MCObjectStreamer &OS) {
InsertedStrTabFragment = true;
}
OS.emitValueToAlignment(4, 0);
OS.emitValueToAlignment(Align(4), 0);
OS.emitLabel(StringEnd);
}
@ -233,7 +233,7 @@ void CodeViewContext::emitFileChecksums(MCObjectStreamer &OS) {
OS.emitInt8(static_cast<uint8_t>(File.Checksum.size()));
OS.emitInt8(File.ChecksumKind);
OS.emitBytes(toStringRef(File.Checksum));
OS.emitValueToAlignment(4);
OS.emitValueToAlignment(Align(4));
}
OS.emitLabel(FileEnd);

View File

@ -1686,7 +1686,7 @@ const MCSymbol &FrameEmitterImpl::EmitCIE(const MCDwarfFrameInfo &Frame) {
InitialCFAOffset = CFAOffset;
// Padding
Streamer.emitValueToAlignment(IsEH ? 4 : MAI->getCodePointerSize());
Streamer.emitValueToAlignment(Align(IsEH ? 4 : MAI->getCodePointerSize()));
Streamer.emitLabel(sectionEnd);
return *sectionStart;
@ -1763,8 +1763,8 @@ void FrameEmitterImpl::EmitFDE(const MCSymbol &cieStart,
// The size of a .eh_frame section has to be a multiple of the alignment
// since a null CIE is interpreted as the end. Old systems overaligned
// .eh_frame, so we do too and account for it in the last FDE.
unsigned Align = LastInSection ? asmInfo->getCodePointerSize() : PCSize;
Streamer.emitValueToAlignment(Align);
unsigned Alignment = LastInSection ? asmInfo->getCodePointerSize() : PCSize;
Streamer.emitValueToAlignment(Align(Alignment));
Streamer.emitLabel(fdeEnd);
}
@ -1869,7 +1869,7 @@ void MCDwarfFrameEmitter::Emit(MCObjectStreamer &Streamer, MCAsmBackend *MAB,
if (Frame.CompactUnwindEncoding == 0) continue;
if (!SectionEmitted) {
Streamer.switchSection(MOFI->getCompactUnwindSection());
Streamer.emitValueToAlignment(AsmInfo->getCodePointerSize());
Streamer.emitValueToAlignment(Align(AsmInfo->getCodePointerSize()));
SectionEmitted = true;
}
NeedsEHFrameSection |=

View File

@ -322,7 +322,7 @@ void MCELFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
MCSectionSubPair P = getCurrentSection();
switchSection(&Section);
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitValueToAlignment(Align(ByteAlignment), 0, 1, 0);
emitLabel(Symbol);
emitZeros(Size);
@ -365,14 +365,13 @@ void MCELFStreamer::emitValueImpl(const MCExpr *Value, unsigned Size,
MCObjectStreamer::emitValueImpl(Value, Size, Loc);
}
void MCELFStreamer::emitValueToAlignment(unsigned ByteAlignment,
int64_t Value,
void MCELFStreamer::emitValueToAlignment(Align Alignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {
if (isBundleLocked())
report_fatal_error("Emitting values inside a locked bundle is forbidden");
MCObjectStreamer::emitValueToAlignment(ByteAlignment, Value,
ValueSize, MaxBytesToEmit);
MCObjectStreamer::emitValueToAlignment(Alignment, Value, ValueSize,
MaxBytesToEmit);
}
void MCELFStreamer::emitCGProfileEntry(const MCSymbolRefExpr *From,

View File

@ -465,7 +465,7 @@ void MCMachOStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
// The symbol may not be present, which only creates the section.
if (Symbol) {
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitValueToAlignment(Align(ByteAlignment), 0, 1, 0);
emitLabel(Symbol);
emitZeros(Size);
}

View File

@ -641,25 +641,23 @@ void MCObjectStreamer::emitBytes(StringRef Data) {
DF->getContents().append(Data.begin(), Data.end());
}
void MCObjectStreamer::emitValueToAlignment(unsigned ByteAlignment,
int64_t Value,
void MCObjectStreamer::emitValueToAlignment(Align Alignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {
if (MaxBytesToEmit == 0)
MaxBytesToEmit = ByteAlignment;
insert(new MCAlignFragment(Align(ByteAlignment), Value, ValueSize,
MaxBytesToEmit));
MaxBytesToEmit = Alignment.value();
insert(new MCAlignFragment(Alignment, Value, ValueSize, MaxBytesToEmit));
// Update the maximum alignment on the current section if necessary.
MCSection *CurSec = getCurrentSectionOnly();
if (CurSec->getAlign() < ByteAlignment)
CurSec->setAlignment(Align(ByteAlignment));
if (CurSec->getAlign() < Alignment)
CurSec->setAlignment(Alignment);
}
void MCObjectStreamer::emitCodeAlignment(Align Alignment,
const MCSubtargetInfo *STI,
unsigned MaxBytesToEmit) {
emitValueToAlignment(Alignment.value(), 0, 1, MaxBytesToEmit);
emitValueToAlignment(Alignment, 0, 1, MaxBytesToEmit);
cast<MCAlignFragment>(getCurrentFragment())->setEmitNops(true, STI);
}

View File

@ -3489,7 +3489,7 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
Align(Alignment), &getTargetParser().getSTI(), MaxBytesToFill);
} else {
// FIXME: Target specific behavior about how the "extra" bytes are filled.
getStreamer().emitValueToAlignment(Alignment, FillExpr, ValueSize,
getStreamer().emitValueToAlignment(Align(Alignment), FillExpr, ValueSize,
MaxBytesToFill);
}

View File

@ -472,7 +472,7 @@ public:
} // end anonymous namespace
bool DarwinAsmParser::parseSectionSwitch(StringRef Segment, StringRef Section,
unsigned TAA, unsigned Align,
unsigned TAA, unsigned Alignment,
unsigned StubSize) {
if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in section switching directive");
@ -492,8 +492,8 @@ bool DarwinAsmParser::parseSectionSwitch(StringRef Segment, StringRef Section,
// the section. However, this is arguably more reasonable behavior, and there
// is no good reason for someone to intentionally emit incorrectly sized
// values into the implicitly aligned sections.
if (Align)
getStreamer().emitValueToAlignment(Align);
if (Alignment)
getStreamer().emitValueToAlignment(Align(Alignment));
return false;
}

View File

@ -868,7 +868,7 @@ bool ELFAsmParser::ParseDirectiveVersion(StringRef, SMLoc) {
getStreamer().emitInt32(1); // type = NT_VERSION
getStreamer().emitBytes(Data); // name
getStreamer().emitInt8(0); // NUL
getStreamer().emitValueToAlignment(4);
getStreamer().emitValueToAlignment(Align(4));
getStreamer().popSection();
return false;
}

View File

@ -4747,7 +4747,7 @@ bool MasmParser::emitAlignTo(int64_t Alignment) {
/*MaxBytesToEmit=*/0);
} else {
// FIXME: Target specific behavior about how the "extra" bytes are filled.
getStreamer().emitValueToAlignment(Alignment, /*Value=*/0,
getStreamer().emitValueToAlignment(Align(Alignment), /*Value=*/0,
/*ValueSize=*/1,
/*MaxBytesToEmit=*/0);
}

View File

@ -1219,7 +1219,7 @@ void MCStreamer::emitSLEB128Value(const MCExpr *Value) {}
void MCStreamer::emitFill(const MCExpr &NumBytes, uint64_t Value, SMLoc Loc) {}
void MCStreamer::emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
SMLoc Loc) {}
void MCStreamer::emitValueToAlignment(unsigned ByteAlignment, int64_t Value,
void MCStreamer::emitValueToAlignment(Align Alignment, int64_t Value,
unsigned ValueSize,
unsigned MaxBytesToEmit) {}
void MCStreamer::emitCodeAlignment(Align Alignment, const MCSubtargetInfo *STI,

View File

@ -156,7 +156,7 @@ static void EmitRuntimeFunction(MCStreamer &streamer,
const WinEH::FrameInfo *info) {
MCContext &context = streamer.getContext();
streamer.emitValueToAlignment(4);
streamer.emitValueToAlignment(Align(4));
EmitSymbolRefWithOfs(streamer, info->Begin, info->Begin);
EmitSymbolRefWithOfs(streamer, info->Begin, info->End);
streamer.emitValue(MCSymbolRefExpr::create(info->Symbol,
@ -172,7 +172,7 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
MCContext &context = streamer.getContext();
MCSymbol *Label = context.createTempSymbol();
streamer.emitValueToAlignment(4);
streamer.emitValueToAlignment(Align(4));
streamer.emitLabel(Label);
info->Symbol = Label;
@ -1169,7 +1169,7 @@ static void ARM64EmitUnwindInfoForSegment(MCStreamer &streamer,
MCContext &context = streamer.getContext();
MCSymbol *Label = context.createTempSymbol();
streamer.emitValueToAlignment(4);
streamer.emitValueToAlignment(Align(4));
streamer.emitLabel(Label);
Seg.Symbol = Label;
// Use the 1st segemnt's label as function's.
@ -2253,7 +2253,7 @@ static void ARMEmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info,
MCContext &context = streamer.getContext();
MCSymbol *Label = context.createTempSymbol();
streamer.emitValueToAlignment(4);
streamer.emitValueToAlignment(Align(4));
streamer.emitLabel(Label);
info->Symbol = Label;
@ -2465,7 +2465,7 @@ static void ARM64EmitRuntimeFunction(MCStreamer &streamer,
const WinEH::FrameInfo *info) {
MCContext &context = streamer.getContext();
streamer.emitValueToAlignment(4);
streamer.emitValueToAlignment(Align(4));
for (const auto &S : info->Segments) {
EmitSymbolRefWithOfs(streamer, info->Begin, S.Offset);
if (info->PackedInfo)
@ -2483,7 +2483,7 @@ static void ARMEmitRuntimeFunction(MCStreamer &streamer,
const WinEH::FrameInfo *info) {
MCContext &context = streamer.getContext();
streamer.emitValueToAlignment(4);
streamer.emitValueToAlignment(Align(4));
EmitSymbolRefWithOfs(streamer, info->Begin, info->Begin);
if (info->PackedInfo)
streamer.emitInt32(info->PackedInfo);

View File

@ -300,7 +300,7 @@ void MCWinCOFFStreamer::emitLocalCommonSymbol(MCSymbol *S, uint64_t Size,
MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
pushSection();
switchSection(Section);
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitValueToAlignment(Align(ByteAlignment), 0, 1, 0);
emitLabel(Symbol);
Symbol->setExternal(false);
emitZeros(Size);

View File

@ -103,7 +103,7 @@ void MCXCOFFStreamer::emitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
Align(ByteAlignment));
// Emit the alignment and storage for the variable to the section.
emitValueToAlignment(ByteAlignment);
emitValueToAlignment(Align(ByteAlignment));
emitZeros(Size);
}

View File

@ -79,7 +79,7 @@ void AArch64TargetStreamer::emitNoteSection(unsigned Flags) {
OutStreamer.switchSection(Nt);
// Emit the note header.
OutStreamer.emitValueToAlignment(Align(8).value());
OutStreamer.emitValueToAlignment(Align(8));
OutStreamer.emitIntValue(4, 4); // data size for "GNU\0"
OutStreamer.emitIntValue(4 * 4, 4); // Elf_Prop size
OutStreamer.emitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4);

View File

@ -252,7 +252,7 @@ void AMDGPUAsmPrinter::emitFunctionBodyEnd() {
// CP microcode requires the kernel descriptor to be allocated on 64 byte
// alignment.
Streamer.emitValueToAlignment(64, 0, 1, 0);
Streamer.emitValueToAlignment(Align(64), 0, 1, 0);
if (ReadOnlySection.getAlign() < 64)
ReadOnlySection.setAlignment(Align(64));

View File

@ -543,9 +543,9 @@ void AMDGPUTargetELFStreamer::EmitNote(
S.emitValue(DescSZ, 4); // descz
S.emitInt32(NoteType); // type
S.emitBytes(Name); // name
S.emitValueToAlignment(4, 0, 1, 0); // padding 0
S.emitValueToAlignment(Align(4), 0, 1, 0); // padding 0
EmitDesc(S); // desc
S.emitValueToAlignment(4, 0, 1, 0); // padding 0
S.emitValueToAlignment(Align(4), 0, 1, 0); // padding 0
S.popSection();
}
@ -840,7 +840,7 @@ bool AMDGPUTargetELFStreamer::EmitCodeEnd(const MCSubtargetInfo &STI) {
MCStreamer &OS = getStreamer();
OS.pushSection();
OS.emitValueToAlignment(CacheLineSize, Encoded_pad, 4);
OS.emitValueToAlignment(Align(CacheLineSize), Encoded_pad, 4);
for (unsigned I = 0; I < FillSize; I += 4)
OS.emitInt32(Encoded_pad);
OS.popSection();

View File

@ -11858,7 +11858,7 @@ bool ARMAsmParser::parseDirectiveEven(SMLoc L) {
if (Section->useCodeAlign())
getStreamer().emitCodeAlignment(Align(2), &getSTI());
else
getStreamer().emitValueToAlignment(2);
getStreamer().emitValueToAlignment(Align(2));
return false;
}
@ -12056,7 +12056,7 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) {
if (Section->useCodeAlign())
getStreamer().emitCodeAlignment(Align(4), &getSTI(), 0);
else
getStreamer().emitValueToAlignment(4, 0, 1, 0);
getStreamer().emitValueToAlignment(Align(4), 0, 1, 0);
return false;
}
return true;

View File

@ -1169,7 +1169,7 @@ inline void ARMELFStreamer::SwitchToEHSection(StringRef Prefix,
// Switch to .ARM.extab or .ARM.exidx section
switchSection(EHSection);
emitValueToAlignment(4, 0, 1, 0);
emitValueToAlignment(Align(4), 0, 1, 0);
}
inline void ARMELFStreamer::SwitchToExTabSection(const MCSymbol &FnStart) {

View File

@ -111,7 +111,7 @@ void HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(MCSymbol *Symbol,
switchSection(&Section);
if (ELFSymbol->isUndefined()) {
emitValueToAlignment(ByteAlignment, 0, 1, 0);
emitValueToAlignment(Align(ByteAlignment), 0, 1, 0);
emitLabel(Symbol);
emitZeros(Size);
}

View File

@ -3470,7 +3470,7 @@ bool MipsAsmParser::expandLoadDoubleImmToGPR(MCInst &Inst, SMLoc IDLoc,
getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitValueToAlignment(8);
getStreamer().emitValueToAlignment(Align(8));
getStreamer().emitIntValue(ImmOp64, 8);
getStreamer().switchSection(CS);
@ -3553,7 +3553,7 @@ bool MipsAsmParser::expandLoadDoubleImmToFPR(MCInst &Inst, bool Is64FPU,
getStreamer().switchSection(ReadOnlySection);
getStreamer().emitLabel(Sym, IDLoc);
getStreamer().emitValueToAlignment(8);
getStreamer().emitValueToAlignment(Align(8));
getStreamer().emitIntValue(ImmOp64, 8);
getStreamer().switchSection(CS);

View File

@ -917,7 +917,7 @@ void MipsTargetELFStreamer::finish() {
if (Section.useCodeAlign())
OS.emitCodeAlignment(Alignment, &STI, Alignment.value());
else
OS.emitValueToAlignment(Alignment.value(), 0, 1, Alignment.value());
OS.emitValueToAlignment(Alignment, 0, 1, Alignment.value());
}
}

View File

@ -1053,7 +1053,7 @@ void MipsAsmPrinter::EmitFPCallStub(
//
// .align 2
//
OutStreamer->emitValueToAlignment(4);
OutStreamer->emitValueToAlignment(Align(4));
MipsTargetStreamer &TS = getTargetStreamer();
//
// .set nomips16

View File

@ -1718,7 +1718,7 @@ bool PPCAsmParser::ParseDirectiveTC(unsigned Size, AsmToken ID) {
return addErrorSuffix(" in '.tc' directive");
// Align to word size.
getParser().getStreamer().emitValueToAlignment(Size);
getParser().getStreamer().emitValueToAlignment(Align(Size));
// Emit expressions.
return ParseDirectiveWord(Size, ID);

View File

@ -196,7 +196,7 @@ public:
void emitTCEntry(const MCSymbol &S,
MCSymbolRefExpr::VariantKind Kind) override {
// Creates a R_PPC64_TOC relocation
Streamer.emitValueToAlignment(8);
Streamer.emitValueToAlignment(Align(8));
Streamer.emitSymbolValue(&S, 8);
}
@ -325,7 +325,7 @@ public:
MCSymbolRefExpr::VariantKind Kind) override {
const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
const unsigned PointerSize = MAI->getCodePointerSize();
Streamer.emitValueToAlignment(PointerSize);
Streamer.emitValueToAlignment(Align(PointerSize));
Streamer.emitValue(MCSymbolRefExpr::create(&S, Kind, Streamer.getContext()),
PointerSize);
}

View File

@ -1661,7 +1661,7 @@ void PPCLinuxAsmPrinter::emitFunctionEntryLabel() {
".opd", ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer->switchSection(Section);
OutStreamer->emitLabel(CurrentFnSym);
OutStreamer->emitValueToAlignment(8);
OutStreamer->emitValueToAlignment(Align(8));
MCSymbol *Symbol1 = CurrentFnSymForSize;
// Generates a R_PPC64_ADDR64 (from FK_DATA_8) relocation for the function
// entry point.
@ -1693,7 +1693,7 @@ void PPCLinuxAsmPrinter::emitEndOfAsmFile(Module &M) {
Name, ELF::SHT_PROGBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
OutStreamer->switchSection(Section);
if (!isPPC64)
OutStreamer->emitValueToAlignment(4);
OutStreamer->emitValueToAlignment(Align(4));
for (const auto &TOCMapPair : TOC) {
const MCSymbol *const TOCEntryTarget = TOCMapPair.first.first;
@ -1974,7 +1974,7 @@ void PPCAIXAsmPrinter::emitFunctionBodyEnd() {
const DataLayout &DL = MMI->getModule()->getDataLayout();
const unsigned PointerSize = DL.getPointerSize();
// Add necessary paddings in 64 bit mode.
OutStreamer->emitValueToAlignment(PointerSize);
OutStreamer->emitValueToAlignment(Align(PointerSize));
OutStreamer->emitIntValue(0, PointerSize);
OutStreamer->emitIntValue(0, PointerSize);
@ -2325,7 +2325,7 @@ void PPCAIXAsmPrinter::emitTracebackTable() {
MCSymbolRefExpr::create(TOCBaseSym, Ctx), Ctx);
const DataLayout &DL = getDataLayout();
OutStreamer->emitValueToAlignment(4);
OutStreamer->emitValueToAlignment(Align(4));
OutStreamer->AddComment("EHInfo Table");
OutStreamer->emitValue(Exp, DL.getPointerSize());
}

View File

@ -4729,7 +4729,7 @@ bool X86AsmParser::parseDirectiveEven(SMLoc L) {
if (Section->useCodeAlign())
getStreamer().emitCodeAlignment(Align(2), &getSTI(), 0);
else
getStreamer().emitValueToAlignment(2, 0, 1, 0);
getStreamer().emitValueToAlignment(Align(2), 0, 1, 0);
return false;
}

View File

@ -438,7 +438,7 @@ bool X86WinCOFFTargetStreamer::emitFPOData(const MCSymbol *ProcSym, SMLoc L) {
FSM.emitFrameDataRecord(OS, Inst.Label);
}
OS.emitValueToAlignment(4, 0);
OS.emitValueToAlignment(Align(4), 0);
OS.emitLabel(FrameEnd);
return false;
}

View File

@ -93,8 +93,7 @@ private:
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override {
return false;
}
void emitValueToAlignment(unsigned ByteAlignment, int64_t Value,
unsigned ValueSize,
void emitValueToAlignment(Align Alignment, int64_t Value, unsigned ValueSize,
unsigned MaxBytesToEmit) override {}
void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment, SMLoc Loc) override {}