LLVM 20.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;
25class WinCOFFObjectWriter;
26class raw_pwrite_stream;
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 void emitAssemblerFlag(MCAssemblerFlag Flag) override;
49 void emitThumbFunc(MCSymbol *Func) override;
50 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
51 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
52 void beginCOFFSymbolDef(MCSymbol const *Symbol) override;
54 void emitCOFFSymbolType(int Type) override;
55 void endCOFFSymbolDef() override;
56 void emitCOFFSafeSEH(MCSymbol const *Symbol) override;
57 void emitCOFFSymbolIndex(MCSymbol const *Symbol) override;
58 void emitCOFFSectionIndex(MCSymbol const *Symbol) override;
59 void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
60 void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
62 Align ByteAlignment) override;
64 Align ByteAlignment) override;
65 void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
66 void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
67 Align ByteAlignment, SMLoc Loc = SMLoc()) override;
68 void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
69 Align ByteAlignment) override;
70 void emitIdent(StringRef IdentString) override;
71 void emitWinEHHandlerData(SMLoc Loc) override;
73 const MCSymbolRefExpr *To, uint64_t Count) override;
74 void finishImpl() override;
75
76 /// \}
77
78protected:
80
81 void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
82
84
85private:
86 void Error(const Twine &Msg) const;
87};
88
89} // end namespace llvm
90
91#endif // LLVM_MC_MCWINCOFFSTREAMER_H
BlockVerifier::State From
uint64_t Size
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
Context object for machine code objects.
Definition: MCContext.h:83
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
Streaming object file generation interface.
void reset() override
state management
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:36
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:188
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
void emitCOFFSectionIndex(MCSymbol const *Symbol) override
Emits a COFF section index.
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
void finalizeCGProfileEntry(const MCSymbolRefExpr *&S)
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
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 emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment, SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
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 emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a common symbol.
void endCOFFSymbolDef() override
Marks the end of the symbol definition.
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a thread local bss (.tbss) symbol.
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 emitWinEHHandlerData(SMLoc Loc) override
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
const MCSymbol * CurSymbol
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 emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override
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:50
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
StorageClass
Definition: XCOFF.h:170
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
MCAssemblerFlag
Definition: MCDirectives.h:53
MCSymbolAttr
Definition: MCDirectives.h:18
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39