LLVM 22.0.0git
MCWinCOFFStreamer.h
Go to the documentation of this file.
1//===- MCWinCOFFStreamer.h - COFF Object File Interface ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_MC_MCWINCOFFSTREAMER_H
10#define LLVM_MC_MCWINCOFFSTREAMER_H
11
14
15namespace llvm {
16
17class MCAsmBackend;
18class MCContext;
19class MCCodeEmitter;
20class MCInst;
21class MCSection;
22class MCSubtargetInfo;
23class MCSymbol;
24class StringRef;
27
29public:
30 MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
31 std::unique_ptr<MCCodeEmitter> CE,
32 std::unique_ptr<MCObjectWriter> OW);
33
34 /// state management
35 void reset() override {
36 CurSymbol = nullptr;
38 }
39
41
42 /// \name MCStreamer interface
43 /// \{
44
45 void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override;
46 void changeSection(MCSection *Section, uint32_t Subsection = 0) override;
47 void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
48 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
49 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
50 void beginCOFFSymbolDef(MCSymbol const *Symbol) override;
52 void emitCOFFSymbolType(int Type) override;
53 void endCOFFSymbolDef() override;
54 void emitCOFFSafeSEH(MCSymbol const *Symbol) override;
55 void emitCOFFSymbolIndex(MCSymbol const *Symbol) override;
56 void emitCOFFSectionIndex(MCSymbol const *Symbol) override;
57 void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
58 void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
59 void emitCOFFSecNumber(MCSymbol const *Symbol) override;
60 void emitCOFFSecOffset(MCSymbol const *Symbol) override;
62 Align ByteAlignment) override;
64 Align ByteAlignment) override;
65 void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
66 void emitIdent(StringRef IdentString) override;
67 void emitWinEHHandlerData(SMLoc Loc) override;
68 void emitCGProfileEntry(const MCSymbolRefExpr *From,
69 const MCSymbolRefExpr *To, uint64_t Count) override;
70 void finishImpl() override;
71
72 /// \}
73
74protected:
76
78
79private:
80 void Error(const Twine &Msg) const;
81};
82
83} // end namespace llvm
84
85#endif // LLVM_MC_MCWINCOFFSTREAMER_H
Functions, function parameters, and return types can have attributes to indicate how they should be t...
Definition Attributes.h:69
Generic interface to target specific assembler backends.
MCCodeEmitter - Generic instruction encoding interface.
Context object for machine code objects.
Definition MCContext.h:83
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
void reset() override
state management
MCObjectStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition MCSection.h:496
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
Definition MCExpr.h:190
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
void emitCOFFSectionIndex(MCSymbol const *Symbol) override
Emits a COFF section index.
void finalizeCGProfileEntry(const MCSymbolRefExpr *&S)
void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override
Emits a COFF image relative relocation.
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override
Create the default sections and set the initial one.
void emitCOFFSafeSEH(MCSymbol const *Symbol) override
void emitCOFFSecOffset(MCSymbol const *Symbol) override
Emits the offset of the symbol from the beginning of the section during object writing (i....
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a common symbol.
void endCOFFSymbolDef() override
Marks the end of the symbol definition.
MCWinCOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCCodeEmitter > CE, std::unique_ptr< MCObjectWriter > OW)
void changeSection(MCSection *Section, uint32_t Subsection=0) override
This is called by popSection and switchSection, if the current section changes.
void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override
Emits a COFF section relative relocation.
void finishImpl() override
Streamer specific finalization.
void emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
void reset() override
state management
void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count) override
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a local common (.lcomm) symbol.
WinCOFFObjectWriter & getWriter()
void emitCOFFSymbolType(int Type) override
Emit the type of the symbol.
void emitCOFFSecNumber(MCSymbol const *Symbol) override
Emits the physical number of the section containing the given symbol as assigned during object writin...
void emitWinEHHandlerData(SMLoc Loc) override
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void emitCOFFSymbolIndex(MCSymbol const *Symbol) override
Emits the symbol table index of a Symbol into the current section.
void beginCOFFSymbolDef(MCSymbol const *Symbol) override
Start emitting COFF symbol definition.
void emitCOFFSymbolStorageClass(int StorageClass) override
Emit the storage class of the symbol.
Represents a location in source code.
Definition SMLoc.h:23
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
An abstract base class for streams implementations that also support a pwrite operation.
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
FunctionAddr VTableAddr Count
Definition InstrProf.h:139
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39