LLVM 20.0.0git
WebAssemblyTargetStreamer.h
Go to the documentation of this file.
1//==-- WebAssemblyTargetStreamer.h - WebAssembly Target Streamer -*- 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/// \file
10/// This file declares WebAssembly-specific target streamer classes.
11/// These are for implementing support for target-specific assembly directives.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYTARGETSTREAMER_H
16#define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYTARGETSTREAMER_H
17
20#include "llvm/MC/MCStreamer.h"
21
22namespace llvm {
23
24class MCSymbolWasm;
25class formatted_raw_ostream;
26
27/// WebAssembly-specific streamer interface, to implement support
28/// WebAssembly-specific assembly directives.
30public:
32
33 /// .local
34 virtual void emitLocal(ArrayRef<wasm::ValType> Types) = 0;
35 /// .functype
36 virtual void emitFunctionType(const MCSymbolWasm *Sym) = 0;
37 /// .indidx
38 virtual void emitIndIdx(const MCExpr *Value) = 0;
39 /// .globaltype
40 virtual void emitGlobalType(const MCSymbolWasm *Sym) = 0;
41 /// .tabletype
42 virtual void emitTableType(const MCSymbolWasm *Sym) = 0;
43 /// .tagtype
44 virtual void emitTagType(const MCSymbolWasm *Sym) = 0;
45 /// .import_module
46 virtual void emitImportModule(const MCSymbolWasm *Sym,
47 StringRef ImportModule) = 0;
48 /// .import_name
49 virtual void emitImportName(const MCSymbolWasm *Sym,
50 StringRef ImportName) = 0;
51 /// .export_name
52 virtual void emitExportName(const MCSymbolWasm *Sym,
53 StringRef ExportName) = 0;
54
55protected:
57};
58
59/// This part is for ascii assembly output
62
63public:
65
66 void emitLocal(ArrayRef<wasm::ValType> Types) override;
67 void emitFunctionType(const MCSymbolWasm *Sym) override;
68 void emitIndIdx(const MCExpr *Value) override;
69 void emitGlobalType(const MCSymbolWasm *Sym) override;
70 void emitTableType(const MCSymbolWasm *Sym) override;
71 void emitTagType(const MCSymbolWasm *Sym) override;
72 void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule) override;
73 void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName) override;
74 void emitExportName(const MCSymbolWasm *Sym, StringRef ExportName) override;
75};
76
77/// This part is for Wasm object output
79public:
81
82 void emitLocal(ArrayRef<wasm::ValType> Types) override;
83 void emitFunctionType(const MCSymbolWasm *Sym) override {}
84 void emitIndIdx(const MCExpr *Value) override;
85 void emitGlobalType(const MCSymbolWasm *Sym) override {}
86 void emitTableType(const MCSymbolWasm *Sym) override {}
87 void emitTagType(const MCSymbolWasm *Sym) override {}
89 StringRef ImportModule) override {}
91 StringRef ImportName) override {}
93 StringRef ExportName) override {}
94};
95
96/// This part is for null output
98public:
101
103 void emitFunctionType(const MCSymbolWasm *) override {}
104 void emitIndIdx(const MCExpr *) override {}
105 void emitGlobalType(const MCSymbolWasm *) override {}
106 void emitTableType(const MCSymbolWasm *) override {}
107 void emitTagType(const MCSymbolWasm *) override {}
108 void emitImportModule(const MCSymbolWasm *, StringRef) override {}
109 void emitImportName(const MCSymbolWasm *, StringRef) override {}
110 void emitExportName(const MCSymbolWasm *, StringRef) override {}
111};
112
113} // end namespace llvm
114
115#endif
Symbol * Sym
Definition: ELF_riscv.cpp:479
raw_pwrite_stream & OS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
Streaming machine code generation interface.
Definition: MCStreamer.h:213
Target specific streamer interface.
Definition: MCStreamer.h:94
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
This part is for ascii assembly output.
void emitIndIdx(const MCExpr *Value) override
.indidx
void emitFunctionType(const MCSymbolWasm *Sym) override
.functype
void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName) override
.import_name
void emitExportName(const MCSymbolWasm *Sym, StringRef ExportName) override
.export_name
void emitGlobalType(const MCSymbolWasm *Sym) override
.globaltype
void emitTableType(const MCSymbolWasm *Sym) override
.tabletype
void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule) override
.import_module
void emitLocal(ArrayRef< wasm::ValType > Types) override
.local
void emitTagType(const MCSymbolWasm *Sym) override
.tagtype
void emitFunctionType(const MCSymbolWasm *) override
.functype
void emitTagType(const MCSymbolWasm *) override
.tagtype
void emitExportName(const MCSymbolWasm *, StringRef) override
.export_name
void emitIndIdx(const MCExpr *) override
.indidx
void emitGlobalType(const MCSymbolWasm *) override
.globaltype
void emitImportModule(const MCSymbolWasm *, StringRef) override
.import_module
void emitLocal(ArrayRef< wasm::ValType >) override
.local
void emitImportName(const MCSymbolWasm *, StringRef) override
.import_name
void emitTableType(const MCSymbolWasm *) override
.tabletype
WebAssembly-specific streamer interface, to implement support WebAssembly-specific assembly directive...
virtual void emitFunctionType(const MCSymbolWasm *Sym)=0
.functype
virtual void emitLocal(ArrayRef< wasm::ValType > Types)=0
.local
virtual void emitTagType(const MCSymbolWasm *Sym)=0
.tagtype
virtual void emitExportName(const MCSymbolWasm *Sym, StringRef ExportName)=0
.export_name
virtual void emitGlobalType(const MCSymbolWasm *Sym)=0
.globaltype
virtual void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule)=0
.import_module
virtual void emitTableType(const MCSymbolWasm *Sym)=0
.tabletype
virtual void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName)=0
.import_name
virtual void emitIndIdx(const MCExpr *Value)=0
.indidx
This part is for Wasm object output.
void emitExportName(const MCSymbolWasm *Sym, StringRef ExportName) override
.export_name
void emitTagType(const MCSymbolWasm *Sym) override
.tagtype
void emitImportName(const MCSymbolWasm *Sym, StringRef ImportName) override
.import_name
void emitIndIdx(const MCExpr *Value) override
.indidx
void emitFunctionType(const MCSymbolWasm *Sym) override
.functype
void emitGlobalType(const MCSymbolWasm *Sym) override
.globaltype
void emitTableType(const MCSymbolWasm *Sym) override
.tabletype
void emitLocal(ArrayRef< wasm::ValType > Types) override
.local
void emitImportModule(const MCSymbolWasm *Sym, StringRef ImportModule) override
.import_module
formatted_raw_ostream - A raw_ostream that wraps another one and keeps track of line and column posit...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18