LLVM  10.0.0svn
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 
12 #include "llvm/MC/MCDirectives.h"
14 
15 namespace llvm {
16 
17 class MCAsmBackend;
18 class MCContext;
19 class MCCodeEmitter;
20 class MCInst;
21 class MCSection;
22 class MCSubtargetInfo;
23 class MCSymbol;
24 class StringRef;
25 class raw_pwrite_stream;
26 
28 public:
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) 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;
49  void EmitCOFFSymbolStorageClass(int StorageClass) 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;
57  void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
58  unsigned ByteAlignment) override;
59  void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
60  unsigned ByteAlignment) override;
61  void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
62  unsigned ByteAlignment, SMLoc Loc = SMLoc()) override;
63  void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
64  unsigned ByteAlignment) override;
65  void EmitIdent(StringRef IdentString) override;
66  void EmitWinEHHandlerData(SMLoc Loc) override;
67  void FinishImpl() override;
68 
69  /// \}
70 
71 protected:
73 
74  void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
75 
76 private:
77  void Error(const Twine &Msg) const;
78 };
79 
80 } // end namespace llvm
81 
82 #endif // LLVM_MC_MCWINCOFFSTREAMER_H
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
void FinishImpl() override
Streamer specific finalization.
LLVMContext & Context
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCWinCOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCCodeEmitter > CE, std::unique_ptr< MCObjectWriter > OW)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
const MCSymbol * CurSymbol
void InitSections(bool NoExecStack) override
Create the default sections and set the initial one.
void EmitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
COFF::SymbolStorageClass StorageClass
Definition: COFFYAML.cpp:356
void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override
Emits a COFF section relative relocation.
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a common symbol.
void EmitCOFFSymbolType(int Type) override
Emit the type of the symbol.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:80
void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override
void EmitWinEHHandlerData(SMLoc Loc) override
void BeginCOFFSymbolDef(MCSymbol const *Symbol) override
Start emitting COFF symbol definition.
Context object for machine code objects.
Definition: MCContext.h:65
Streaming object file generation interface.
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:158
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:131
void EndCOFFSymbolDef() override
Marks the end of the symbol definition.
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a local common (.lcomm) symbol.
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
void EmitCOFFSymbolStorageClass(int StorageClass) override
Emit the storage class of the symbol.
void EmitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override
Emits a COFF image relative relocation.
void reset() override
state management
void EmitCOFFSectionIndex(MCSymbol const *Symbol) override
Emits a COFF section index.
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void EmitCOFFSafeSEH(MCSymbol const *Symbol) override
MCSymbolAttr
Definition: MCDirectives.h:18
void EmitCOFFSymbolIndex(MCSymbol const *Symbol) override
Emits the symbol table index of a Symbol into the current section.
MCAssemblerFlag
Definition: MCDirectives.h:49
void reset() override
state management
Generic base class for all target subtargets.
void EmitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a thread local bss (.tbss) symbol.
uint32_t Size
Definition: Profile.cpp:46
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
Represents a location in source code.
Definition: SMLoc.h:23
void EmitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).