diff --git a/bolt/include/bolt/Core/BinarySection.h b/bolt/include/bolt/Core/BinarySection.h --- a/bolt/include/bolt/Core/BinarySection.h +++ b/bolt/include/bolt/Core/BinarySection.h @@ -254,6 +254,7 @@ 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()) diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp --- a/bolt/lib/Core/BinaryEmitter.cpp +++ b/bolt/lib/Core/BinaryEmitter.cpp @@ -795,7 +795,7 @@ 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 @@ 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 @@ 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()); diff --git a/bolt/lib/Core/BinarySection.cpp b/bolt/lib/Core/BinarySection.cpp --- a/bolt/lib/Core/BinarySection.cpp +++ b/bolt/lib/Core/BinarySection.cpp @@ -74,7 +74,7 @@ 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")); diff --git a/llvm/include/llvm/MC/MCELFStreamer.h b/llvm/include/llvm/MC/MCELFStreamer.h --- a/llvm/include/llvm/MC/MCELFStreamer.h +++ b/llvm/include/llvm/MC/MCELFStreamer.h @@ -76,7 +76,7 @@ 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; diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h --- a/llvm/include/llvm/MC/MCObjectStreamer.h +++ b/llvm/include/llvm/MC/MCObjectStreamer.h @@ -152,7 +152,7 @@ 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, diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -854,15 +854,14 @@ /// /// 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); diff --git a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp --- a/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AIXException.cpp @@ -69,7 +69,7 @@ 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), diff --git a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp --- a/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AccelTable.cpp @@ -531,7 +531,7 @@ emitOffsets(EntryPool); emitAbbrevs(); emitData(); - Asm->OutStreamer->emitValueToAlignment(4, 0); + Asm->OutStreamer->emitValueToAlignment(Align(4), 0); Asm->OutStreamer->emitLabel(ContributionEnd); } diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2837,7 +2837,7 @@ STI = TM.getMCSubtargetInfo(); OutStreamer->emitCodeAlignment(Alignment, STI, MaxBytesToEmit); } else - OutStreamer->emitValueToAlignment(Alignment.value(), 0, 1, MaxBytesToEmit); + OutStreamer->emitValueToAlignment(Alignment, 0, 1, MaxBytesToEmit); } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -560,7 +560,7 @@ } 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 @@ // 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 @@ 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 @@ // 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); } diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -736,7 +736,7 @@ // 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 @@ // 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(F.getPersonalityFn()->stripPointerCasts()); diff --git a/llvm/lib/CodeGen/StackMaps.cpp b/llvm/lib/CodeGen/StackMaps.cpp --- a/llvm/lib/CodeGen/StackMaps.cpp +++ b/llvm/lib/CodeGen/StackMaps.cpp @@ -688,7 +688,7 @@ } // 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 @@ OS.emitIntValue(LO.Size, 1); } // Emit alignment to 8 byte. - OS.emitValueToAlignment(8); + OS.emitValueToAlignment(Align(8)); } } diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -434,7 +434,7 @@ 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); diff --git a/llvm/lib/MC/ConstantPools.cpp b/llvm/lib/MC/ConstantPools.cpp --- a/llvm/lib/MC/ConstantPools.cpp +++ b/llvm/lib/MC/ConstantPools.cpp @@ -28,7 +28,7 @@ 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); } diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -252,7 +252,7 @@ void emitAlignmentDirective(unsigned ByteAlignment, Optional 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 @@ 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, diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp --- a/llvm/lib/MC/MCCodeView.cpp +++ b/llvm/lib/MC/MCCodeView.cpp @@ -185,7 +185,7 @@ InsertedStrTabFragment = true; } - OS.emitValueToAlignment(4, 0); + OS.emitValueToAlignment(Align(4), 0); OS.emitLabel(StringEnd); } @@ -233,7 +233,7 @@ OS.emitInt8(static_cast(File.Checksum.size())); OS.emitInt8(File.ChecksumKind); OS.emitBytes(toStringRef(File.Checksum)); - OS.emitValueToAlignment(4); + OS.emitValueToAlignment(Align(4)); } OS.emitLabel(FileEnd); diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -1686,7 +1686,7 @@ 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 @@ // 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 @@ if (Frame.CompactUnwindEncoding == 0) continue; if (!SectionEmitted) { Streamer.switchSection(MOFI->getCompactUnwindSection()); - Streamer.emitValueToAlignment(AsmInfo->getCodePointerSize()); + Streamer.emitValueToAlignment(Align(AsmInfo->getCodePointerSize())); SectionEmitted = true; } NeedsEHFrameSection |= diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -322,7 +322,7 @@ MCSectionSubPair P = getCurrentSection(); switchSection(&Section); - emitValueToAlignment(ByteAlignment, 0, 1, 0); + emitValueToAlignment(Align(ByteAlignment), 0, 1, 0); emitLabel(Symbol); emitZeros(Size); @@ -365,14 +365,13 @@ 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, diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -465,7 +465,7 @@ // 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); } diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -641,25 +641,23 @@ 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(getCurrentFragment())->setEmitNops(true, STI); } diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -3489,7 +3489,7 @@ 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); } diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp --- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp +++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp @@ -472,7 +472,7 @@ } // 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 @@ // 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; } diff --git a/llvm/lib/MC/MCParser/ELFAsmParser.cpp b/llvm/lib/MC/MCParser/ELFAsmParser.cpp --- a/llvm/lib/MC/MCParser/ELFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/ELFAsmParser.cpp @@ -868,7 +868,7 @@ 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; } diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp --- a/llvm/lib/MC/MCParser/MasmParser.cpp +++ b/llvm/lib/MC/MCParser/MasmParser.cpp @@ -4747,7 +4747,7 @@ /*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); } diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -1219,7 +1219,7 @@ 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, diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp --- a/llvm/lib/MC/MCWin64EH.cpp +++ b/llvm/lib/MC/MCWin64EH.cpp @@ -156,7 +156,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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); diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp --- a/llvm/lib/MC/MCWinCOFFStreamer.cpp +++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp @@ -300,7 +300,7 @@ 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); diff --git a/llvm/lib/MC/MCXCOFFStreamer.cpp b/llvm/lib/MC/MCXCOFFStreamer.cpp --- a/llvm/lib/MC/MCXCOFFStreamer.cpp +++ b/llvm/lib/MC/MCXCOFFStreamer.cpp @@ -103,7 +103,7 @@ Align(ByteAlignment)); // Emit the alignment and storage for the variable to the section. - emitValueToAlignment(ByteAlignment); + emitValueToAlignment(Align(ByteAlignment)); emitZeros(Size); } diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp @@ -79,7 +79,7 @@ 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); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -252,7 +252,7 @@ // 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)); diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp --- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp +++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp @@ -543,9 +543,9 @@ 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 @@ 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(); diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -11858,7 +11858,7 @@ if (Section->useCodeAlign()) getStreamer().emitCodeAlignment(Align(2), &getSTI()); else - getStreamer().emitValueToAlignment(2); + getStreamer().emitValueToAlignment(Align(2)); return false; } @@ -12056,7 +12056,7 @@ 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; diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp @@ -1169,7 +1169,7 @@ // 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) { diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp @@ -111,7 +111,7 @@ switchSection(&Section); if (ELFSymbol->isUndefined()) { - emitValueToAlignment(ByteAlignment, 0, 1, 0); + emitValueToAlignment(Align(ByteAlignment), 0, 1, 0); emitLabel(Symbol); emitZeros(Size); } diff --git a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp --- a/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp +++ b/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp @@ -3470,7 +3470,7 @@ 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 @@ getStreamer().switchSection(ReadOnlySection); getStreamer().emitLabel(Sym, IDLoc); - getStreamer().emitValueToAlignment(8); + getStreamer().emitValueToAlignment(Align(8)); getStreamer().emitIntValue(ImmOp64, 8); getStreamer().switchSection(CS); diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -917,7 +917,7 @@ 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()); } } diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -1053,7 +1053,7 @@ // // .align 2 // - OutStreamer->emitValueToAlignment(4); + OutStreamer->emitValueToAlignment(Align(4)); MipsTargetStreamer &TS = getTargetStreamer(); // // .set nomips16 diff --git a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp --- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp +++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp @@ -1718,7 +1718,7 @@ return addErrorSuffix(" in '.tc' directive"); // Align to word size. - getParser().getStreamer().emitValueToAlignment(Size); + getParser().getStreamer().emitValueToAlignment(Align(Size)); // Emit expressions. return ParseDirectiveWord(Size, ID); diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp --- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp +++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp @@ -196,7 +196,7 @@ 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 @@ 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); } diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp --- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -1661,7 +1661,7 @@ ".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 @@ 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 @@ 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 @@ 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()); } diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp --- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -4729,7 +4729,7 @@ 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; } diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp --- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp @@ -438,7 +438,7 @@ FSM.emitFrameDataRecord(OS, Inst.Label); } - OS.emitValueToAlignment(4, 0); + OS.emitValueToAlignment(Align(4), 0); OS.emitLabel(FrameEnd); return false; } diff --git a/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp b/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp --- a/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp +++ b/llvm/tools/llvm-exegesis/lib/SnippetFile.cpp @@ -93,8 +93,7 @@ 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 {}