LLVM 19.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 raw_pwrite_stream;
26
28public:
29 MCWinCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
30 std::unique_ptr<MCCodeEmitter> CE,
31 std::unique_ptr<MCObjectWriter> OW);
32
33 /// state management
34 void reset() override {
35 CurSymbol = nullptr;
37 }
38
39 /// \name MCStreamer interface
40 /// \{
41
42 void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override;
43 void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
44 void emitAssemblerFlag(MCAssemblerFlag Flag) override;
45 void emitThumbFunc(MCSymbol *Func) override;
46 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
47 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
48 void beginCOFFSymbolDef(MCSymbol const *Symbol) override;
50 void emitCOFFSymbolType(int Type) override;
51 void endCOFFSymbolDef() override;
52 void emitCOFFSafeSEH(MCSymbol const *Symbol) override;
53 void emitCOFFSymbolIndex(MCSymbol const *Symbol) override;
54 void emitCOFFSectionIndex(MCSymbol const *Symbol) override;
55 void emitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override;
56 void emitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override;
58 Align ByteAlignment) override;
60 Align ByteAlignment) override;
61 void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
62 void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
63 Align ByteAlignment, SMLoc Loc = SMLoc()) override;
64 void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
65 Align ByteAlignment) override;
66 void emitIdent(StringRef IdentString) override;
67 void emitWinEHHandlerData(SMLoc Loc) override;
69 const MCSymbolRefExpr *To, uint64_t Count) override;
70 void finishImpl() override;
71
72 /// \}
73
74protected:
76
77 void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
78
80 void finalizeCGProfile();
81
82private:
83 void Error(const Twine &Msg) const;
84};
85
86} // end namespace llvm
87
88#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:82
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:35
Generic base class for all target subtargets.
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:40
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 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.
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:456
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