]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - wasm/WriterUtils.h
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / wasm / WriterUtils.h
1 //===- WriterUtils.h --------------------------------------------*- C++ -*-===//
2 //
3 //                             The LLVM Linker
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 LLD_WASM_WRITERUTILS_H
11 #define LLD_WASM_WRITERUTILS_H
12
13 #include "lld/Common/LLVM.h"
14 #include "llvm/ADT/Twine.h"
15 #include "llvm/Object/Wasm.h"
16 #include "llvm/Support/raw_ostream.h"
17
18 using llvm::raw_ostream;
19
20 namespace lld {
21 namespace wasm {
22
23 void debugWrite(uint64_t Offset, const Twine &Msg);
24
25 void writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg);
26
27 void writeSleb128(raw_ostream &OS, int32_t Number, const Twine &Msg);
28
29 void writeBytes(raw_ostream &OS, const char *Bytes, size_t count,
30                 const Twine &Msg);
31
32 void writeStr(raw_ostream &OS, StringRef String, const Twine &Msg);
33
34 void writeU8(raw_ostream &OS, uint8_t byte, const Twine &Msg);
35
36 void writeU32(raw_ostream &OS, uint32_t Number, const Twine &Msg);
37
38 void writeValueType(raw_ostream &OS, uint8_t Type, const Twine &Msg);
39
40 void writeSig(raw_ostream &OS, const llvm::wasm::WasmSignature &Sig);
41
42 void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
43
44 void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
45
46 void writeGlobalType(raw_ostream &OS, const llvm::wasm::WasmGlobalType &Type);
47
48 void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
49
50 void writeTableType(raw_ostream &OS, const llvm::wasm::WasmTable &Type);
51
52 void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
53
54 void writeExport(raw_ostream &OS, const llvm::wasm::WasmExport &Export);
55
56 } // namespace wasm
57
58 std::string toString(llvm::wasm::ValType Type);
59 std::string toString(const llvm::wasm::WasmSignature &Sig);
60 std::string toString(const llvm::wasm::WasmGlobalType &Sig);
61
62 } // namespace lld
63
64 #endif // LLD_WASM_WRITERUTILS_H