LLVM 20.0.0git
MCWasmStreamer.h
Go to the documentation of this file.
1//===- MCWasmStreamer.h - MCStreamer Wasm 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_MCWASMSTREAMER_H
10#define LLVM_MC_MCWASMSTREAMER_H
11
12#include "MCAsmBackend.h"
13#include "MCCodeEmitter.h"
18
19namespace llvm {
20class MCExpr;
21class MCInst;
22
24public:
25 MCWasmStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> TAB,
26 std::unique_ptr<MCObjectWriter> OW,
27 std::unique_ptr<MCCodeEmitter> Emitter)
28 : MCObjectStreamer(Context, std::move(TAB), std::move(OW),
29 std::move(Emitter)),
30 SeenIdent(false) {}
31
32 ~MCWasmStreamer() override;
33
34 /// state management
35 void reset() override {
36 SeenIdent = false;
38 }
39
40 /// \name MCStreamer Interface
41 /// @{
42
43 void changeSection(MCSection *Section, uint32_t Subsection) override;
44 void emitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override;
45 void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F,
46 uint64_t Offset) override;
47 void emitAssemblerFlag(MCAssemblerFlag Flag) override;
48 void emitThumbFunc(MCSymbol *Func) override;
49 void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override;
50 bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override;
51 void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override;
53 Align ByteAlignment) override;
54
55 void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override;
56
58 Align ByteAlignment) override;
59
60 void emitZerofill(MCSection *Section, MCSymbol *Symbol = nullptr,
61 uint64_t Size = 0, Align ByteAlignment = Align(1),
62 SMLoc Loc = SMLoc()) override;
63 void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size,
64 Align ByteAlignment = Align(1)) override;
65
66 void emitIdent(StringRef IdentString) override;
67
68 void finishImpl() override;
69
70private:
71 void emitInstToFragment(const MCInst &Inst, const MCSubtargetInfo &) override;
72 void emitInstToData(const MCInst &Inst, const MCSubtargetInfo &) override;
73
74 void fixSymbolsInTLSFixups(const MCExpr *expr);
75
76 bool SeenIdent;
77};
78
79} // end namespace llvm
80
81#endif
dxil DXContainer Global Emitter
uint64_t Size
#define F(x, y, z)
Definition: MD5.cpp:55
Context object for machine code objects.
Definition: MCContext.h:83
Fragment for data and encoded instructions.
Definition: MCFragment.h:219
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
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.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
void emitLabelAtPos(MCSymbol *Symbol, SMLoc Loc, MCDataFragment &F, uint64_t Offset) override
void emitCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a common symbol.
void emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) override
Emit a local common (.lcomm) symbol.
MCWasmStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > TAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
void emitIdent(StringRef IdentString) override
Emit the "identifiers" directive.
void emitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) override
Set the DescValue for the Symbol.
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
void emitThumbFunc(MCSymbol *Func) override
Note in the output that the specified Func is a Thumb mode function (ARM target only).
~MCWasmStreamer() override
void changeSection(MCSection *Section, uint32_t Subsection) override
This is called by popSection and switchSection, if the current section changes.
void finishImpl() override
Streamer specific finalization.
void emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment=Align(1)) override
Emit a thread local bss (.tbss) symbol.
void reset() override
state management
void emitELFSize(MCSymbol *Symbol, const MCExpr *Value) override
Emit an ELF .size directive.
void emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) override
Emit an weak reference from Alias to Symbol.
bool emitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) override
Add the given Attribute to Symbol.
void emitZerofill(MCSection *Section, MCSymbol *Symbol=nullptr, uint64_t Size=0, Align ByteAlignment=Align(1), SMLoc Loc=SMLoc()) override
Emit the zerofill section and an optional symbol.
void emitAssemblerFlag(MCAssemblerFlag Flag) override
Note in the output the specified Flag.
Represents a location in source code.
Definition: SMLoc.h:23
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
MCAssemblerFlag
Definition: MCDirectives.h:53
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1856
MCSymbolAttr
Definition: MCDirectives.h:18
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39