[Alignment] Use Align in MCStreamer::emitTBSSSymbol
In the same vein as D139439, the patch is not NFC as there is no way to check all downstream implementations but the patch seems pretty safe. Differential Revision: https://reviews.llvm.org/D139548
This commit is contained in:
parent
c9cb4fc761
commit
b94bd9c20a
@ -70,7 +70,7 @@ public:
|
|||||||
uint64_t Size = 0, Align ByteAlignment = Align(1),
|
uint64_t Size = 0, Align ByteAlignment = Align(1),
|
||||||
SMLoc L = SMLoc()) override;
|
SMLoc L = SMLoc()) override;
|
||||||
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment = 0) override;
|
Align ByteAlignment = Align(1)) override;
|
||||||
void emitValueImpl(const MCExpr *Value, unsigned Size,
|
void emitValueImpl(const MCExpr *Value, unsigned Size,
|
||||||
SMLoc Loc = SMLoc()) override;
|
SMLoc Loc = SMLoc()) override;
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ public:
|
|||||||
/// \param ByteAlignment - The alignment of the thread local common symbol
|
/// \param ByteAlignment - The alignment of the thread local common symbol
|
||||||
/// if non-zero. This must be a power of 2 on some targets.
|
/// if non-zero. This must be a power of 2 on some targets.
|
||||||
virtual void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
virtual void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment = 0);
|
uint64_t Size, Align ByteAlignment = Align(1));
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// \name Generating Data
|
/// \name Generating Data
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
uint64_t Size = 0, Align ByteAlignment = Align(1),
|
uint64_t Size = 0, Align ByteAlignment = Align(1),
|
||||||
SMLoc Loc = SMLoc()) override;
|
SMLoc Loc = SMLoc()) override;
|
||||||
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment = 0) override;
|
Align ByteAlignment = Align(1)) override;
|
||||||
|
|
||||||
void emitIdent(StringRef IdentString) override;
|
void emitIdent(StringRef IdentString) override;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public:
|
|||||||
void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
Align ByteAlignment, SMLoc Loc = SMLoc()) override;
|
Align ByteAlignment, SMLoc Loc = SMLoc()) override;
|
||||||
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment) override;
|
Align ByteAlignment) override;
|
||||||
void emitIdent(StringRef IdentString) override;
|
void emitIdent(StringRef IdentString) override;
|
||||||
void emitWinEHHandlerData(SMLoc Loc) override;
|
void emitWinEHHandlerData(SMLoc Loc) override;
|
||||||
void emitCGProfileEntry(const MCSymbolRefExpr *From,
|
void emitCGProfileEntry(const MCSymbolRefExpr *From,
|
||||||
|
@ -816,7 +816,7 @@ void AsmPrinter::emitGlobalVariable(const GlobalVariable *GV) {
|
|||||||
|
|
||||||
if (GVKind.isThreadBSS()) {
|
if (GVKind.isThreadBSS()) {
|
||||||
TheSection = getObjFileLowering().getTLSBSSSection();
|
TheSection = getObjFileLowering().getTLSBSSSection();
|
||||||
OutStreamer->emitTBSSSymbol(TheSection, MangSym, Size, Alignment.value());
|
OutStreamer->emitTBSSSymbol(TheSection, MangSym, Size, Alignment);
|
||||||
} else if (GVKind.isThreadData()) {
|
} else if (GVKind.isThreadData()) {
|
||||||
OutStreamer->switchSection(TheSection);
|
OutStreamer->switchSection(TheSection);
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ public:
|
|||||||
SMLoc Loc = SMLoc()) override;
|
SMLoc Loc = SMLoc()) override;
|
||||||
|
|
||||||
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment = 0) override;
|
Align ByteAlignment = Align(1)) override;
|
||||||
|
|
||||||
void emitBinaryData(StringRef Data) override;
|
void emitBinaryData(StringRef Data) override;
|
||||||
|
|
||||||
@ -1039,7 +1039,7 @@ void MCAsmStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
// This depends that the symbol has already been mangled from the original,
|
// This depends that the symbol has already been mangled from the original,
|
||||||
// e.g. _a.
|
// e.g. _a.
|
||||||
void MCAsmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
void MCAsmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, Align ByteAlignment) {
|
||||||
assignFragment(Symbol, &Section->getDummyFragment());
|
assignFragment(Symbol, &Section->getDummyFragment());
|
||||||
|
|
||||||
assert(Symbol && "Symbol shouldn't be NULL!");
|
assert(Symbol && "Symbol shouldn't be NULL!");
|
||||||
@ -1055,7 +1055,8 @@ void MCAsmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
|||||||
|
|
||||||
// Output align if we have it. We default to 1 so don't bother printing
|
// Output align if we have it. We default to 1 so don't bother printing
|
||||||
// that.
|
// that.
|
||||||
if (ByteAlignment > 1) OS << ", " << Log2_32(ByteAlignment);
|
if (ByteAlignment > 1)
|
||||||
|
OS << ", " << Log2(ByteAlignment);
|
||||||
|
|
||||||
EmitEOL();
|
EmitEOL();
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ void MCELFStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
void MCELFStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, Align ByteAlignment) {
|
||||||
llvm_unreachable("ELF doesn't support this directive");
|
llvm_unreachable("ELF doesn't support this directive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public:
|
|||||||
uint64_t Size = 0, Align ByteAlignment = Align(1),
|
uint64_t Size = 0, Align ByteAlignment = Align(1),
|
||||||
SMLoc Loc = SMLoc()) override;
|
SMLoc Loc = SMLoc()) override;
|
||||||
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
|
||||||
unsigned ByteAlignment = 0) override;
|
Align ByteAlignment = Align(1)) override;
|
||||||
|
|
||||||
void emitIdent(StringRef IdentString) override {
|
void emitIdent(StringRef IdentString) override {
|
||||||
llvm_unreachable("macho doesn't support this directive");
|
llvm_unreachable("macho doesn't support this directive");
|
||||||
@ -476,8 +476,8 @@ void MCMachOStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
// This should always be called with the thread local bss section. Like the
|
// This should always be called with the thread local bss section. Like the
|
||||||
// .zerofill directive this doesn't actually switch sections on us.
|
// .zerofill directive this doesn't actually switch sections on us.
|
||||||
void MCMachOStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
void MCMachOStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, Align ByteAlignment) {
|
||||||
emitZerofill(Section, Symbol, Size, Align(ByteAlignment));
|
emitZerofill(Section, Symbol, Size, ByteAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCMachOStreamer::emitInstToData(const MCInst &Inst,
|
void MCMachOStreamer::emitInstToData(const MCInst &Inst,
|
||||||
|
@ -872,7 +872,7 @@ bool DarwinAsmParser::parseDirectiveTBSS(StringRef, SMLoc) {
|
|||||||
getContext().getMachOSection("__DATA", "__thread_bss",
|
getContext().getMachOSection("__DATA", "__thread_bss",
|
||||||
MachO::S_THREAD_LOCAL_ZEROFILL, 0,
|
MachO::S_THREAD_LOCAL_ZEROFILL, 0,
|
||||||
SectionKind::getThreadBSS()),
|
SectionKind::getThreadBSS()),
|
||||||
Sym, Size, 1 << Pow2Alignment);
|
Sym, Size, Align(1ULL << Pow2Alignment));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1204,7 +1204,7 @@ void MCStreamer::emitELFSymverDirective(const MCSymbol *OriginalSym,
|
|||||||
void MCStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void MCStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
Align ByteAlignment) {}
|
Align ByteAlignment) {}
|
||||||
void MCStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
void MCStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {}
|
uint64_t Size, Align ByteAlignment) {}
|
||||||
void MCStreamer::changeSection(MCSection *, const MCExpr *) {}
|
void MCStreamer::changeSection(MCSection *, const MCExpr *) {}
|
||||||
void MCStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
|
void MCStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {}
|
||||||
void MCStreamer::emitBytes(StringRef Data) {}
|
void MCStreamer::emitBytes(StringRef Data) {}
|
||||||
|
@ -269,7 +269,7 @@ void MCWasmStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCWasmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
void MCWasmStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, Align ByteAlignment) {
|
||||||
llvm_unreachable("Wasm doesn't support this directive");
|
llvm_unreachable("Wasm doesn't support this directive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ void MCWinCOFFStreamer::emitZerofill(MCSection *Section, MCSymbol *Symbol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MCWinCOFFStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
void MCWinCOFFStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol,
|
||||||
uint64_t Size, unsigned ByteAlignment) {
|
uint64_t Size, Align ByteAlignment) {
|
||||||
llvm_unreachable("not implemented");
|
llvm_unreachable("not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user