LLVM: lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
23using namespace llvm;
24
27
31
35
38
41 bool First = true;
42 for (auto Type : Types) {
45 else
46 OS << ", ";
48 }
49 OS << '\n';
50}
51
53 if (!Types.empty()) {
54 OS << "\t.local \t";
56 }
57}
58
61 OS << "\t.functype\t" << Sym->getName() << " ";
63 OS << "\n";
64}
65
68 OS << "\t.globaltype\t" << Sym->getName() << ", "
72 OS << ", immutable";
73 OS << '\n';
74}
75
79 OS << "\t.tabletype\t" << Sym->getName() << ", "
82 if (Type.Limits.Minimum != 0 || HasMaximum) {
83 OS << ", " << Type.Limits.Minimum;
84 if (HasMaximum)
85 OS << ", " << Type.Limits.Maximum;
86 }
87 OS << '\n';
88}
89
92 OS << "\t.tagtype\t" << Sym->getName() << " ";
94 OS << "\n";
95}
96
99 OS << "\t.import_module\t" << Sym->getName() << ", "
100 << ImportModule << '\n';
101}
102
105 OS << "\t.import_name\t" << Sym->getName() << ", "
106 << ImportName << '\n';
107}
108
111 OS << "\t.export_name\t" << Sym->getName() << ", "
112 << ExportName << '\n';
113}
114
116 OS << "\t.indidx\t";
118 OS << '\n';
119}
120
123 for (auto Type : Types) {
124 if (Grouped.empty() || Grouped.back().first != Type)
126 else
127 ++Grouped.back().second;
128 }
129
130 Streamer.emitULEB128IntValue(Grouped.size());
131 for (auto Pair : Grouped) {
132 Streamer.emitULEB128IntValue(Pair.second);
134 }
135}
136
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the declaration of the WebAssemblyMCAsmInfo class.
This file contains the declaration of the WebAssembly-specific type parsing utility functions.
static void printTypes(formatted_raw_ostream &OS, ArrayRef< wasm::ValType > Types)
Definition WebAssemblyTargetStreamer.cpp:39
This file declares WebAssembly-specific target streamer classes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
void printExpr(raw_ostream &, const MCExpr &) const
const MCAsmInfo * getAsmInfo() const
Base class for the full range of assembler expressions which are needed for parsing.
Streaming machine code generation interface.
const wasm::WasmTableType & getTableType() const
const wasm::WasmSignature * getSignature() const
const wasm::WasmGlobalType & getGlobalType() const
StringRef getName() const
getName - Get the symbol name.
MCTargetStreamer(MCStreamer &S)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
void emitIndIdx(const MCExpr *Value) override
.indidx
Definition WebAssemblyTargetStreamer.cpp:115
WebAssemblyTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS)
Definition WebAssemblyTargetStreamer.cpp:32
void emitFunctionType(const MCSymbolWasm *Sym) override
.functype
Definition WebAssemblyTargetStreamer.cpp:59
void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName) override
.import_name
Definition WebAssemblyTargetStreamer.cpp:103
void emitExportName(const MCSymbolWasm *Sym, StringRef ExportName) override
.export_name
Definition WebAssemblyTargetStreamer.cpp:109
void emitGlobalType(const MCSymbolWasm *Sym) override
.globaltype
Definition WebAssemblyTargetStreamer.cpp:66
void emitTableType(const MCSymbolWasm *Sym) override
.tabletype
Definition WebAssemblyTargetStreamer.cpp:76
void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule) override
.import_module
Definition WebAssemblyTargetStreamer.cpp:97
void emitLocal(ArrayRef< wasm::ValType > Types) override
.local
Definition WebAssemblyTargetStreamer.cpp:52
void emitTagType(const MCSymbolWasm *Sym) override
.tagtype
Definition WebAssemblyTargetStreamer.cpp:90
WebAssemblyTargetStreamer(MCStreamer &S)
Definition WebAssemblyTargetStreamer.cpp:25
void emitValueType(wasm::ValType Type)
Definition WebAssemblyTargetStreamer.cpp:28
void emitIndIdx(const MCExpr *Value) override
.indidx
Definition WebAssemblyTargetStreamer.cpp:137
void emitLocal(ArrayRef< wasm::ValType > Types) override
.local
Definition WebAssemblyTargetStreamer.cpp:121
WebAssemblyTargetWasmStreamer(MCStreamer &S)
Definition WebAssemblyTargetStreamer.cpp:36
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const char * typeToString(wasm::ValType Type)
std::string signatureToString(const wasm::WasmSignature *Sig)
std::string typeListToString(ArrayRef< wasm::ValType > List)
@ WASM_LIMITS_FLAG_HAS_MAX
This is an optimization pass for GlobalISel generic memory operations.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
SmallVector< ValType, 4 > Params