2017-11-18 02:14:09 +08:00
|
|
|
//===- WriterUtils.h --------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2017-11-18 02:14:09 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_WASM_WRITERUTILS_H
|
|
|
|
#define LLD_WASM_WRITERUTILS_H
|
|
|
|
|
2018-02-17 04:38:00 +08:00
|
|
|
#include "lld/Common/LLVM.h"
|
2017-11-18 02:14:09 +08:00
|
|
|
#include "llvm/ADT/Twine.h"
|
|
|
|
#include "llvm/Object/Wasm.h"
|
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace wasm {
|
|
|
|
|
2018-02-17 04:38:00 +08:00
|
|
|
void debugWrite(uint64_t offset, const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-01 08:42:57 +08:00
|
|
|
void writeUleb128(raw_ostream &os, uint32_t number, const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-01 08:42:57 +08:00
|
|
|
void writeSleb128(raw_ostream &os, int32_t number, const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-01 08:42:57 +08:00
|
|
|
void writeBytes(raw_ostream &os, const char *bytes, size_t count,
|
|
|
|
const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-01 08:42:57 +08:00
|
|
|
void writeStr(raw_ostream &os, StringRef string, const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-01 08:42:57 +08:00
|
|
|
void writeU8(raw_ostream &os, uint8_t byte, const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-03-01 08:42:57 +08:00
|
|
|
void writeU32(raw_ostream &os, uint32_t number, const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
2018-10-04 06:25:32 +08:00
|
|
|
void writeValueType(raw_ostream &os, llvm::wasm::ValType type,
|
|
|
|
const Twine &msg);
|
2017-11-18 02:14:09 +08:00
|
|
|
|
|
|
|
void writeSig(raw_ostream &os, const llvm::wasm::WasmSignature &sig);
|
|
|
|
|
2019-09-05 03:50:39 +08:00
|
|
|
void writeI32Const(raw_ostream &os, int32_t number, const Twine &msg);
|
|
|
|
|
|
|
|
void writeI64Const(raw_ostream &os, int32_t number, const Twine &msg);
|
|
|
|
|
|
|
|
void writeMemArg(raw_ostream &os, uint32_t alignment, uint32_t offset);
|
|
|
|
|
2017-11-18 02:14:09 +08:00
|
|
|
void writeInitExpr(raw_ostream &os, const llvm::wasm::WasmInitExpr &initExpr);
|
|
|
|
|
|
|
|
void writeLimits(raw_ostream &os, const llvm::wasm::WasmLimits &limits);
|
|
|
|
|
2018-02-01 03:54:34 +08:00
|
|
|
void writeGlobalType(raw_ostream &os, const llvm::wasm::WasmGlobalType &type);
|
|
|
|
|
2017-11-18 02:14:09 +08:00
|
|
|
void writeGlobal(raw_ostream &os, const llvm::wasm::WasmGlobal &global);
|
|
|
|
|
2018-12-08 14:17:43 +08:00
|
|
|
void writeEventType(raw_ostream &os, const llvm::wasm::WasmEventType &type);
|
|
|
|
|
|
|
|
void writeEvent(raw_ostream &os, const llvm::wasm::WasmEvent &event);
|
|
|
|
|
2018-03-28 01:38:51 +08:00
|
|
|
void writeTableType(raw_ostream &os, const llvm::wasm::WasmTable &type);
|
|
|
|
|
2017-11-18 02:14:09 +08:00
|
|
|
void writeImport(raw_ostream &os, const llvm::wasm::WasmImport &import);
|
|
|
|
|
|
|
|
void writeExport(raw_ostream &os, const llvm::wasm::WasmExport &export_);
|
|
|
|
|
|
|
|
} // namespace wasm
|
2017-11-30 09:40:08 +08:00
|
|
|
|
2018-03-14 23:58:16 +08:00
|
|
|
std::string toString(llvm::wasm::ValType type);
|
2017-11-30 09:40:08 +08:00
|
|
|
std::string toString(const llvm::wasm::WasmSignature &sig);
|
2018-12-08 14:17:43 +08:00
|
|
|
std::string toString(const llvm::wasm::WasmGlobalType &type);
|
|
|
|
std::string toString(const llvm::wasm::WasmEventType &type);
|
2017-11-30 09:40:08 +08:00
|
|
|
|
2017-11-18 02:14:09 +08:00
|
|
|
} // namespace lld
|
|
|
|
|
|
|
|
#endif // LLD_WASM_WRITERUTILS_H
|