LLVM  14.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 
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, 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;
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;
58  unsigned ByteAlignment) override;
60  unsigned ByteAlignment) override;
61  void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
63  unsigned ByteAlignment, SMLoc Loc = SMLoc()) override;
65  unsigned 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 
74 protected:
76 
77  void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override;
78 
80  void finalizeCGProfile();
81 
82 private:
83  void Error(const Twine &Msg) const;
84 };
85 
86 } // end namespace llvm
87 
88 #endif // LLVM_MC_MCWINCOFFSTREAMER_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::MCWinCOFFStreamer
Definition: MCWinCOFFStreamer.h:27
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
llvm::MCWinCOFFStreamer::emitLocalCommonSymbol
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a local common (.lcomm) symbol.
Definition: MCWinCOFFStreamer.cpp:297
llvm::MCWinCOFFStreamer::emitCommonSymbol
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a common symbol.
Definition: MCWinCOFFStreamer.cpp:265
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::Attribute
Definition: Attributes.h:51
MCDirectives.h
llvm::MCWinCOFFStreamer::emitIdent
void emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
Definition: MCWinCOFFStreamer.cpp:333
llvm::MCWinCOFFStreamer::emitCGProfileEntry
void emitCGProfileEntry(const MCSymbolRefExpr *From, const MCSymbolRefExpr *To, uint64_t Count) override
Definition: MCWinCOFFStreamer.cpp:341
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::MCWinCOFFStreamer::EmitCOFFSymbolType
void EmitCOFFSymbolType(int Type) override
Emit the type of the symbol.
Definition: MCWinCOFFStreamer.cpp:161
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::MCWinCOFFStreamer::emitAssemblerFlag
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
Definition: MCWinCOFFStreamer.cpp:91
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:184
llvm::MCAssemblerFlag
MCAssemblerFlag
Definition: MCDirectives.h:50
llvm::MCObjectStreamer::reset
void reset() override
state management
Definition: MCObjectStreamer.cpp:157
llvm::MCSymbolAttr
MCSymbolAttr
Definition: MCDirectives.h:18
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::MCWinCOFFStreamer::emitThumbFunc
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
Definition: MCWinCOFFStreamer.cpp:107
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:82
MCObjectStreamer.h
llvm::MCWinCOFFStreamer::BeginCOFFSymbolDef
void BeginCOFFSymbolDef(MCSymbol const *Symbol) override
Start emitting COFF symbol definition.
Definition: MCWinCOFFStreamer.cpp:137
llvm::MCWinCOFFStreamer::emitLabel
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Definition: MCWinCOFFStreamer.cpp:86
llvm::SMLoc
Represents a location in source code.
Definition: SMLoc.h:23
llvm::MCWinCOFFStreamer::EmitCOFFSafeSEH
void EmitCOFFSafeSEH(MCSymbol const *Symbol) override
Definition: MCWinCOFFStreamer.cpp:182
llvm::MCObjectStreamer
Streaming object file generation interface.
Definition: MCObjectStreamer.h:36
llvm::MCWinCOFFStreamer::emitSymbolAttribute
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
Definition: MCWinCOFFStreamer.cpp:111
llvm::MCID::Flag
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:146
llvm::MCWinCOFFStreamer::EmitCOFFSymbolStorageClass
void EmitCOFFSymbolStorageClass(int StorageClass) override
Emit the storage class of the symbol.
Definition: MCWinCOFFStreamer.cpp:145
llvm::MCWinCOFFStreamer::emitZerofill
void emitZerofill(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment, SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
Definition: MCWinCOFFStreamer.cpp:321
llvm::MCWinCOFFStreamer::emitSymbolDesc
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
Definition: MCWinCOFFStreamer.cpp:133
llvm::MCWinCOFFStreamer::initSections
void initSections(bool NoExecStack, const MCSubtargetInfo &STI) override
Create the default sections and set the initial one.
Definition: MCWinCOFFStreamer.cpp:69
llvm::XCOFF::StorageClass
StorageClass
Definition: XCOFF.h:126
llvm::MCWinCOFFStreamer::EmitCOFFImgRel32
void EmitCOFFImgRel32(MCSymbol const *Symbol, int64_t Offset) override
Emits a COFF image relative relocation.
Definition: MCWinCOFFStreamer.cpp:246
uint64_t
llvm::MCWinCOFFStreamer::finalizeCGProfile
void finalizeCGProfile()
Definition: MCWinCOFFStreamer.cpp:357
llvm::MCWinCOFFStreamer::EndCOFFSymbolDef
void EndCOFFSymbolDef() override
Marks the end of the symbol definition.
Definition: MCWinCOFFStreamer.cpp:176
llvm::MCWinCOFFStreamer::reset
void reset() override
state management
Definition: MCWinCOFFStreamer.h:34
llvm::MCSymbolRefExpr
Represent a reference to a symbol from inside an expression.
Definition: MCExpr.h:192
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::MCWinCOFFStreamer::finishImpl
void finishImpl() override
Streamer specific finalization.
Definition: MCWinCOFFStreamer.cpp:364
llvm::MCSection
Instances of this class represent a uniqued identifier for a section in the current translation unit.
Definition: MCSection.h:39
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::MCWinCOFFStreamer::EmitCOFFSecRel32
void EmitCOFFSecRel32(MCSymbol const *Symbol, uint64_t Offset) override
Emits a COFF section relative relocation.
Definition: MCWinCOFFStreamer.cpp:228
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::MCWinCOFFStreamer::emitWeakReference
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
Definition: MCWinCOFFStreamer.cpp:311
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::MCWinCOFFStreamer::EmitCOFFSectionIndex
void EmitCOFFSectionIndex(MCSymbol const *Symbol) override
Emits a COFF section index.
Definition: MCWinCOFFStreamer.cpp:219
llvm::MCWinCOFFStreamer::emitInstToData
void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &STI) override
Definition: MCWinCOFFStreamer.cpp:51
llvm::MCWinCOFFStreamer::EmitCOFFSymbolIndex
void EmitCOFFSymbolIndex(MCSymbol const *Symbol) override
Emits the symbol table index of a Symbol into the current section.
Definition: MCWinCOFFStreamer.cpp:208
llvm::LCOMM::ByteAlignment
@ ByteAlignment
Definition: MCAsmInfo.h:50
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:83
llvm::MCWinCOFFStreamer::emitTBSSSymbol
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a thread local bss (.tbss) symbol.
Definition: MCWinCOFFStreamer.cpp:327
llvm::MCWinCOFFStreamer::CurSymbol
const MCSymbol * CurSymbol
Definition: MCWinCOFFStreamer.h:75
llvm::MCWinCOFFStreamer::MCWinCOFFStreamer
MCWinCOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCCodeEmitter > CE, std::unique_ptr< MCObjectWriter > OW)
Definition: MCWinCOFFStreamer.cpp:44
llvm::MCWinCOFFStreamer::EmitWinEHHandlerData
void EmitWinEHHandlerData(SMLoc Loc) override
Definition: MCWinCOFFStreamer.cpp:337
From
BlockVerifier::State From
Definition: BlockVerifier.cpp:55
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition: MCSubtargetInfo.h:75
llvm::ISD::MCSymbol
@ MCSymbol
Definition: ISDOpcodes.h:172
llvm::MCWinCOFFStreamer::finalizeCGProfileEntry
void finalizeCGProfileEntry(const MCSymbolRefExpr *&S)
Definition: MCWinCOFFStreamer.cpp:349