LLVM  5.0.0
MCWasmStreamer.h
Go to the documentation of this file.
1 //===- MCWasmStreamer.h - MCStreamer Wasm Object File Interface -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_MC_MCWASMSTREAMER_H
11 #define LLVM_MC_MCWASMSTREAMER_H
12 
13 #include "llvm/ADT/SmallPtrSet.h"
14 #include "llvm/MC/MCDirectives.h"
16 #include "llvm/MC/SectionKind.h"
17 #include "llvm/Support/DataTypes.h"
18 
19 namespace llvm {
20 class MCAsmBackend;
21 class MCAssembler;
22 class MCCodeEmitter;
23 class MCExpr;
24 class MCInst;
25 class raw_ostream;
26 
28 public:
30  MCCodeEmitter *Emitter)
31  : MCObjectStreamer(Context, TAB, OS, Emitter), SeenIdent(false) {}
32 
33  ~MCWasmStreamer() override;
34 
35  /// state management
36  void reset() override {
37  SeenIdent = false;
39  }
40 
41  /// \name MCStreamer Interface
42  /// @{
43 
44  void ChangeSection(MCSection *Section, const MCExpr *Subsection) override;
45  void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
46  void EmitThumbFunc(MCSymbol *Func) override;
47  void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
49  void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
50  void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
51  unsigned ByteAlignment) override;
52 
53  void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
54 
55  void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
56  unsigned ByteAlignment) override;
57 
58  void EmitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
59  uint64_t Size = 0, unsigned ByteAlignment = 0) override;
61  unsigned ByteAlignment = 0) override;
62  void EmitValueImpl(const MCExpr *Value, unsigned Size,
63  SMLoc Loc = SMLoc()) override;
64 
65  void EmitIdent(StringRef IdentString) override;
66 
67  void EmitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override;
68 
69  void FinishImpl() override;
70 
71 private:
72  void EmitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &) override;
73  void EmitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override;
74 
75  /// \brief Merge the content of the fragment \p EF into the fragment \p DF.
76  void mergeFragment(MCDataFragment *, MCDataFragment *);
77 
78  bool SeenIdent;
79 };
80 
81 } // end namespace llvm
82 
83 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:42
void EmitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
Context object for machine code objects.
Definition: MCContext.h:59
MCWasmStreamer(MCContext &Context, MCAsmBackend &TAB, raw_pwrite_stream &OS, MCCodeEmitter *Emitter)
bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void ChangeSection(MCSection *Section, const MCExpr *Subsection) override
Update streamer for a new active section.
Streaming object file generation interface.
void EmitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment=0) override
Emit a thread local bss (.tbss) symbol.
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:121
void EmitZerofill(MCSection *Section, MCSymbol *Symbol=nullptr, uint64_t Size=0, unsigned ByteAlignment=0) override
Emit the zerofill section and an optional symbol.
Function Alias Analysis false
MCCodeEmitter - Generic instruction encoding interface.
Definition: MCCodeEmitter.h:22
void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
void EmitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
void reset() override
state management
void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a local common (.lcomm) symbol.
void EmitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
void FinishImpl() override
Streamer specific finalization.
MCSymbolAttr
Definition: MCDirectives.h:19
void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment) override
Emit a common symbol.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
MCAssemblerFlag
Definition: MCDirectives.h:48
void reset() override
state management
MCSubtargetInfo - Generic base class for all target subtargets.
void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc=SMLoc()) override
Emit the expression Value into the output as a native integer of the given Size bytes.
void EmitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
An abstract base class for streams implementations that also support a pwrite operation.
Definition: raw_ostream.h:333
Fragment for data and encoded instructions.
Definition: MCFragment.h:224
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override
Emit an ELF .size directive.
LLVM Value Representation.
Definition: Value.h:73
Generic interface to target specific assembler backends.
Definition: MCAsmBackend.h:35
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Represents a location in source code.
Definition: SMLoc.h:24