LLVM API Documentation
#include <MCELFStreamer.h>
Classes | |
struct | LocalCommon |
Public Member Functions | |
MCELFStreamer (MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *Emitter) | |
MCELFStreamer (MCContext &Context, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *Emitter, MCAssembler *Assembler) | |
virtual | ~MCELFStreamer () |
void | reset () override |
state management | |
MCStreamer Interface | |
void | InitSections () override |
Create the default sections and set the initial one. | |
void | ChangeSection (const MCSection *Section, const MCExpr *Subsection) override |
void | EmitLabel (MCSymbol *Symbol) override |
void | EmitAssemblerFlag (MCAssemblerFlag Flag) override |
EmitAssemblerFlag - Note in the output the specified Flag . | |
void | EmitThumbFunc (MCSymbol *Func) override |
void | EmitWeakReference (MCSymbol *Alias, const MCSymbol *Symbol) override |
bool | EmitSymbolAttribute (MCSymbol *Symbol, MCSymbolAttr Attribute) override |
EmitSymbolAttribute - Add the given Attribute to Symbol . | |
void | EmitSymbolDesc (MCSymbol *Symbol, unsigned DescValue) override |
void | EmitCommonSymbol (MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override |
void | BeginCOFFSymbolDef (const MCSymbol *Symbol) override |
void | EmitCOFFSymbolStorageClass (int StorageClass) override |
void | EmitCOFFSymbolType (int Type) override |
void | EndCOFFSymbolDef () override |
EndCOFFSymbolDef - Marks the end of the symbol definition. | |
void | EmitELFSize (MCSymbol *Symbol, const MCExpr *Value) override |
void | EmitLocalCommonSymbol (MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override |
void | EmitZerofill (const MCSection *Section, MCSymbol *Symbol=nullptr, uint64_t Size=0, unsigned ByteAlignment=0) override |
void | EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment=0) override |
void | EmitValueImpl (const MCExpr *Value, unsigned Size, const SMLoc &Loc=SMLoc()) override |
void | EmitFileDirective (StringRef Filename) override |
void | EmitIdent (StringRef IdentString) override |
void | EmitValueToAlignment (unsigned, int64_t, unsigned, unsigned) override |
void | Flush () override |
Flush - Causes any cached state to be written out. | |
void | FinishImpl () override |
FinishImpl - Streamer specific finalization. | |
void | EmitBundleAlignMode (unsigned AlignPow2) override |
Set the bundle alignment mode from now on in the section. The argument is the power of 2 to which the alignment is set. The value 0 means turn the bundle alignment off. | |
void | EmitBundleLock (bool AlignToEnd) override |
The following instructions are a bundle-locked group. | |
void | EmitBundleUnlock () override |
Ends a bundle-locked group. |
Definition at line 30 of file MCELFStreamer.h.
llvm::MCELFStreamer::MCELFStreamer | ( | MCContext & | Context, |
MCAsmBackend & | TAB, | ||
raw_ostream & | OS, | ||
MCCodeEmitter * | Emitter | ||
) | [inline] |
Definition at line 32 of file MCELFStreamer.h.
llvm::MCELFStreamer::MCELFStreamer | ( | MCContext & | Context, |
MCAsmBackend & | TAB, | ||
raw_ostream & | OS, | ||
MCCodeEmitter * | Emitter, | ||
MCAssembler * | Assembler | ||
) | [inline] |
Definition at line 37 of file MCELFStreamer.h.
MCELFStreamer::~MCELFStreamer | ( | ) | [virtual] |
Definition at line 38 of file MCELFStreamer.cpp.
void MCELFStreamer::BeginCOFFSymbolDef | ( | const MCSymbol * | Symbol | ) | [override, virtual] |
BeginCOFFSymbolDef - Start emitting COFF symbol definition
Symbol | - The symbol to have its External & Type fields set. |
Reimplemented from llvm::MCStreamer.
Definition at line 563 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::ChangeSection | ( | const MCSection * | , |
const MCExpr * | |||
) | [override, virtual] |
ChangeSection - Update streamer for a new active section.
This is called by PopSection and SwitchSection, if the current section changes.
Reimplemented from llvm::MCObjectStreamer.
Definition at line 85 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getAssembler(), llvm::MCObjectStreamer::getCurrentSectionData(), llvm::MCAssembler::getOrCreateSymbolData(), llvm::MCSectionData::isBundleLocked(), llvm::report_fatal_error(), and llvm::ARMBuildAttrs::Section.
void MCELFStreamer::EmitAssemblerFlag | ( | MCAssemblerFlag | Flag | ) | [override, virtual] |
EmitAssemblerFlag - Note in the output the specified Flag
.
Reimplemented from llvm::MCStreamer.
Definition at line 68 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getAssembler(), llvm::MCAssembler::getBackend(), llvm::MCAsmBackend::handleAssemblerFlag(), llvm_unreachable, llvm::MCAF_Code16, llvm::MCAF_Code32, llvm::MCAF_Code64, llvm::MCAF_SubsectionsViaSymbols, llvm::MCAF_SyntaxUnified, and llvm::MCAssembler::setSubsectionsViaSymbols().
void MCELFStreamer::EmitBundleAlignMode | ( | unsigned | AlignPow2 | ) | [override, virtual] |
Set the bundle alignment mode from now on in the section. The argument is the power of 2 to which the alignment is set. The value 0 means turn the bundle alignment off.
Reimplemented from llvm::MCObjectStreamer.
Definition at line 474 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getAssembler(), llvm::MCAssembler::getBundleAlignSize(), llvm::report_fatal_error(), and llvm::MCAssembler::setBundleAlignSize().
void MCELFStreamer::EmitBundleLock | ( | bool | AlignToEnd | ) | [override, virtual] |
The following instructions are a bundle-locked group.
AlignToEnd | - If true, the bundle-locked group will be aligned to the end of a bundle. |
Reimplemented from llvm::MCObjectStreamer.
Definition at line 483 of file MCELFStreamer.cpp.
References llvm::MCSectionData::BundleLocked, llvm::MCSectionData::BundleLockedAlignToEnd, llvm::MCObjectStreamer::getAssembler(), llvm::MCObjectStreamer::getCurrentSectionData(), llvm::MCSectionData::isBundleLocked(), llvm::report_fatal_error(), llvm::MCSectionData::setBundleGroupBeforeFirstInst(), and llvm::MCSectionData::setBundleLockState().
void MCELFStreamer::EmitBundleUnlock | ( | ) | [override, virtual] |
Ends a bundle-locked group.
Reimplemented from llvm::MCObjectStreamer.
Definition at line 498 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getAssembler(), llvm::MCObjectStreamer::getCurrentSectionData(), llvm::MCSectionData::isBundleGroupBeforeFirstInst(), llvm::MCSectionData::isBundleLocked(), llvm::MCSectionData::NotBundleLocked, llvm::report_fatal_error(), and llvm::MCSectionData::setBundleLockState().
void MCELFStreamer::EmitCOFFSymbolStorageClass | ( | int | StorageClass | ) | [override, virtual] |
EmitCOFFSymbolStorageClass - Emit the storage class of the symbol.
StorageClass | - The storage class the symbol should have. |
Reimplemented from llvm::MCStreamer.
Definition at line 567 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::EmitCOFFSymbolType | ( | int | Type | ) | [override, virtual] |
EmitCOFFSymbolType - Emit the type of the symbol.
Reimplemented from llvm::MCStreamer.
Definition at line 571 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::EmitCommonSymbol | ( | MCSymbol * | Symbol, |
uint64_t | Size, | ||
unsigned | ByteAlignment | ||
) | [override, virtual] |
EmitCommonSymbol - Emit a common symbol.
Symbol | - The common symbol to emit. |
Size | - The size of the common symbol. |
ByteAlignment | - The alignment of the symbol if non-zero. This must be a power of 2. |
Implements llvm::MCStreamer.
Definition at line 230 of file MCELFStreamer.cpp.
References llvm::MCStreamer::AssignSection(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::MCConstantExpr::Create(), llvm::ELF_STB_Local, llvm::MCObjectStreamer::getAssembler(), llvm::MCELF::GetBinding(), llvm::SectionKind::getBSS(), llvm::MCStreamer::getContext(), llvm::MCAssembler::getContext(), llvm::MCContext::getELFSection(), llvm::MCAssembler::getOrCreateSymbolData(), llvm::ARMBuildAttrs::Section, llvm::MCELF::SetBinding(), llvm::MCSymbolData::setCommon(), llvm::MCSymbolData::setExternal(), llvm::MCSymbolData::setSize(), llvm::MCELF::SetType(), llvm::ELF::SHF_ALLOC, llvm::ELF::SHF_WRITE, llvm::ELF::SHT_NOBITS, llvm::ELF::STB_GLOBAL, and llvm::ELF::STT_OBJECT.
Referenced by EmitLocalCommonSymbol().
void MCELFStreamer::EmitELFSize | ( | MCSymbol * | Symbol, |
const MCExpr * | Value | ||
) | [override, virtual] |
EmitELFSize - Emit an ELF .size directive.
This corresponds to an assembler statement such as: .size symbol, expression
Reimplemented from llvm::MCStreamer.
Definition at line 259 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getAssembler(), llvm::MCAssembler::getOrCreateSymbolData(), and llvm::MCSymbolData::setSize().
void MCELFStreamer::EmitFileDirective | ( | StringRef | Filename | ) | [override, virtual] |
EmitFileDirective - Switch to a new logical file. This is used to implement the '.file "foo.c"' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 295 of file MCELFStreamer.cpp.
References llvm::MCAssembler::addFileName(), and llvm::MCObjectStreamer::getAssembler().
void MCELFStreamer::EmitIdent | ( | StringRef | IdentString | ) | [override, virtual] |
Emit the "identifiers" directive. This implements the '.ident "version foo"' assembler directive.
Reimplemented from llvm::MCStreamer.
Definition at line 299 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::EmitBytes(), llvm::MCStreamer::EmitIntValue(), llvm::MCObjectStreamer::getAssembler(), llvm::MCAssembler::getContext(), llvm::MCContext::getELFSection(), llvm::SectionKind::getReadOnly(), llvm::MCStreamer::PopSection(), llvm::MCStreamer::PushSection(), llvm::ELF::SHF_MERGE, llvm::ELF::SHF_STRINGS, llvm::ELF::SHT_PROGBITS, and llvm::MCStreamer::SwitchSection().
void MCELFStreamer::EmitLabel | ( | MCSymbol * | Symbol | ) | [override, virtual] |
EmitLabel - Emit a label for Symbol
into the current section.
This corresponds to an assembler statement such as: foo:
Symbol | - The symbol to emit. A given symbol should only be emitted as a label once, and symbols emitted as a label should never be used in an assignment. |
Reimplemented from llvm::MCObjectStreamer.
Definition at line 56 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getAssembler(), llvm::MCSectionELF::getFlags(), llvm::MCSymbol::getSection(), llvm::MCAssembler::getSymbolData(), llvm::MCSymbol::isUndefined(), llvm::ARMBuildAttrs::Section, llvm::MCELF::SetType(), llvm::ELF::SHF_TLS, and llvm::ELF::STT_TLS.
void MCELFStreamer::EmitLocalCommonSymbol | ( | MCSymbol * | Symbol, |
uint64_t | Size, | ||
unsigned | ByteAlignment | ||
) | [override, virtual] |
EmitLocalCommonSymbol - Emit a local common (.lcomm) symbol.
Symbol | - The common symbol to emit. |
Size | - The size of the common symbol. |
ByteAlignment | - The alignment of the common symbol in bytes. |
Reimplemented from llvm::MCStreamer.
Definition at line 264 of file MCELFStreamer.cpp.
References EmitCommonSymbol(), llvm::MCObjectStreamer::getAssembler(), llvm::MCAssembler::getOrCreateSymbolData(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MCELF::SetBinding(), llvm::MCSymbolData::setExternal(), and llvm::ELF::STB_LOCAL.
bool MCELFStreamer::EmitSymbolAttribute | ( | MCSymbol * | Symbol, |
MCSymbolAttr | Attribute | ||
) | [override, virtual] |
EmitSymbolAttribute - Add the given Attribute
to Symbol
.
Implements llvm::MCStreamer.
Definition at line 123 of file MCELFStreamer.cpp.
References CombineSymbolTypes(), llvm::MCObjectStreamer::getAssembler(), llvm::MCObjectStreamer::getCurrentSectionData(), llvm::MCAssembler::getIndirectSymbols(), llvm::MCAssembler::getOrCreateSymbolData(), llvm::MCELF::GetType(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::MCSA_ELF_TypeCommon, llvm::MCSA_ELF_TypeFunction, llvm::MCSA_ELF_TypeGnuUniqueObject, llvm::MCSA_ELF_TypeIndFunction, llvm::MCSA_ELF_TypeNoType, llvm::MCSA_ELF_TypeObject, llvm::MCSA_ELF_TypeTLS, llvm::MCSA_Global, llvm::MCSA_Hidden, llvm::MCSA_IndirectSymbol, llvm::MCSA_Internal, llvm::MCSA_Invalid, llvm::MCSA_LazyReference, llvm::MCSA_Local, llvm::MCSA_NoDeadStrip, llvm::MCSA_PrivateExtern, llvm::MCSA_Protected, llvm::MCSA_Reference, llvm::MCSA_SymbolResolver, llvm::MCSA_Weak, llvm::MCSA_WeakDefAutoPrivate, llvm::MCSA_WeakDefinition, llvm::MCSA_WeakReference, llvm::IndirectSymbolData::SectionData, llvm::MCELF::SetBinding(), llvm::MCSymbolData::setExternal(), llvm::MCELF::SetType(), llvm::MCELF::SetVisibility(), llvm::ELF::STB_GLOBAL, llvm::ELF::STB_LOCAL, llvm::ELF::STB_WEAK, llvm::ELF::STT_FUNC, llvm::ELF::STT_GNU_IFUNC, llvm::ELF::STT_NOTYPE, llvm::ELF::STT_OBJECT, llvm::ELF::STT_TLS, llvm::ELF::STV_HIDDEN, llvm::ELF::STV_INTERNAL, llvm::ELF::STV_PROTECTED, llvm::ARMBuildAttrs::Symbol, and llvm::IndirectSymbolData::Symbol.
void MCELFStreamer::EmitSymbolDesc | ( | MCSymbol * | Symbol, |
unsigned | DescValue | ||
) | [override, virtual] |
EmitSymbolDesc - Set the DescValue
for the Symbol
.
Symbol | - The symbol to have its n_desc field set. |
DescValue | - The value to set into the n_desc field. |
Reimplemented from llvm::MCStreamer.
Definition at line 559 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::EmitTBSSSymbol | ( | const MCSection * | Section, |
MCSymbol * | Symbol, | ||
uint64_t | Size, | ||
unsigned | ByteAlignment = 0 |
||
) | [override, virtual] |
EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
Section | - The thread local common section. |
Symbol | - The thread local common symbol to emit. |
Size | - The size of the symbol. |
ByteAlignment | - The alignment of the thread local common symbol if non-zero. This must be a power of 2 on some targets. |
Reimplemented from llvm::MCStreamer.
Definition at line 584 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::EmitThumbFunc | ( | MCSymbol * | Func | ) | [override, virtual] |
EmitThumbFunc - Note in the output that the specified Func
is a Thumb mode function (ARM target only).
Reimplemented from llvm::MCStreamer.
Definition at line 555 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::EmitValueImpl | ( | const MCExpr * | Value, |
unsigned | Size, | ||
const SMLoc & | Loc = SMLoc() |
||
) | [override, virtual] |
EmitValue - Emit the expression Value
into the output as a native integer of the given Size
bytes.
This is used to implement assembler directives such as .word, .quad, etc.
Value | - The value to emit. |
Size | - The size of the integer (in bytes) to emit. This must match a native machine width. |
Loc | - The location of the expression for error reporting. |
Reimplemented from llvm::MCObjectStreamer.
Definition at line 274 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getCurrentSectionData(), and llvm::report_fatal_error().
void MCELFStreamer::EmitValueToAlignment | ( | unsigned | ByteAlignment, |
int64_t | Value, | ||
unsigned | ValueSize, | ||
unsigned | MaxBytesToEmit | ||
) | [override, virtual] |
EmitValueToAlignment - Emit some number of copies of Value
until the byte alignment ByteAlignment
is reached.
If the number of bytes need to emit for the alignment is not a multiple of ValueSize
, then the contents of the emitted fill bytes is undefined.
This used to implement the .align assembler directive.
ByteAlignment | - The alignment to reach. This must be a power of two on some targets. |
Value | - The value to use when filling bytes. |
ValueSize | - The size of the integer (in bytes) to emit for Value . This must match a native machine width. |
MaxBytesToEmit | - The maximum numbers of bytes to emit, or 0. If the alignment cannot be reached in this many bytes, no bytes are emitted. |
Reimplemented from llvm::MCObjectStreamer.
Definition at line 282 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::getCurrentSectionData(), and llvm::report_fatal_error().
void MCELFStreamer::EmitWeakReference | ( | MCSymbol * | Alias, |
const MCSymbol * | Symbol | ||
) | [override, virtual] |
EmitWeakReference - Emit an weak reference from Alias
to Symbol
.
This corresponds to an assembler statement such as: .weakref alias, symbol
Alias | - The alias that is being created. |
Symbol | - The symbol being aliased. |
Reimplemented from llvm::MCObjectStreamer.
Definition at line 96 of file MCELFStreamer.cpp.
References llvm::MCSymbolRefExpr::Create(), llvm::MCObjectStreamer::getAssembler(), llvm::MCStreamer::getContext(), llvm::MCAssembler::getOrCreateSymbolData(), llvm::MCSymbol::setVariableValue(), and llvm::MCSymbolRefExpr::VK_WEAKREF.
void MCELFStreamer::EmitZerofill | ( | const MCSection * | Section, |
MCSymbol * | Symbol = nullptr , |
||
uint64_t | Size = 0 , |
||
unsigned | ByteAlignment = 0 |
||
) | [override, virtual] |
EmitZerofill - Emit the zerofill section and an optional symbol.
Section | - The zerofill section to create and or to put the symbol |
Symbol | - The zerofill symbol to emit, if non-NULL. |
Size | - The size of the zerofill symbol. |
ByteAlignment | - The alignment of the zerofill symbol if non-zero. This must be a power of 2 on some targets. |
Implements llvm::MCStreamer.
Definition at line 579 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::EndCOFFSymbolDef | ( | ) | [override, virtual] |
EndCOFFSymbolDef - Marks the end of the symbol definition.
Reimplemented from llvm::MCStreamer.
Definition at line 575 of file MCELFStreamer.cpp.
References llvm_unreachable.
void MCELFStreamer::FinishImpl | ( | ) | [override, virtual] |
FinishImpl - Streamer specific finalization.
Reimplemented from llvm::MCObjectStreamer.
Definition at line 536 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::EmitFrames(), and Flush().
void MCELFStreamer::Flush | ( | ) | [override, virtual] |
Flush - Causes any cached state to be written out.
Reimplemented from llvm::MCStreamer.
Definition at line 512 of file MCELFStreamer.cpp.
References llvm::LCOMM::ByteAlignment, llvm::MCSectionData::getAlignment(), llvm::MCObjectStreamer::getAssembler(), llvm::MCAssembler::getOrCreateSectionData(), llvm::MCSymbol::getSection(), llvm::MCSymbolData::getSymbol(), llvm::ARMBuildAttrs::Section, llvm::MCSectionData::setAlignment(), llvm::MCSymbolData::setFragment(), and llvm::ARMBuildAttrs::Symbol.
Referenced by FinishImpl().
void MCELFStreamer::InitSections | ( | ) | [override, virtual] |
Create the default sections and set the initial one.
Reimplemented from llvm::MCStreamer.
Definition at line 41 of file MCELFStreamer.cpp.
References llvm::MCObjectStreamer::EmitCodeAlignment(), llvm::MCStreamer::getContext(), and llvm::MCStreamer::SwitchSection().
void llvm::MCELFStreamer::reset | ( | ) | [inline, override, virtual] |
state management
Reimplemented from llvm::MCObjectStreamer.
Definition at line 45 of file MCELFStreamer.h.
References llvm::SmallPtrSetImplBase::clear().