zig/deps/lld/wasm/WriterUtils.h

65 lines
2.0 KiB
C
Raw Normal View History

2018-01-18 06:29:21 +08:00
//===- WriterUtils.h --------------------------------------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_WASM_WRITERUTILS_H
#define LLD_WASM_WRITERUTILS_H
2018-08-05 05:47:16 +08:00
#include "lld/Common/LLVM.h"
2018-01-18 06:29:21 +08:00
#include "llvm/ADT/Twine.h"
#include "llvm/Object/Wasm.h"
#include "llvm/Support/raw_ostream.h"
using llvm::raw_ostream;
namespace lld {
namespace wasm {
2018-08-05 05:47:16 +08:00
void debugWrite(uint64_t Offset, const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeSleb128(raw_ostream &OS, int32_t Number, const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeBytes(raw_ostream &OS, const char *Bytes, size_t count,
const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeStr(raw_ostream &OS, StringRef String, const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeU8(raw_ostream &OS, uint8_t byte, const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeU32(raw_ostream &OS, uint32_t Number, const Twine &Msg);
2018-01-18 06:29:21 +08:00
2018-08-05 05:47:16 +08:00
void writeValueType(raw_ostream &OS, uint8_t Type, const Twine &Msg);
2018-01-18 06:29:21 +08:00
void writeSig(raw_ostream &OS, const llvm::wasm::WasmSignature &Sig);
void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
2018-08-05 05:47:16 +08:00
void writeGlobalType(raw_ostream &OS, const llvm::wasm::WasmGlobalType &Type);
2018-01-18 06:29:21 +08:00
void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
2018-08-05 05:47:16 +08:00
void writeTableType(raw_ostream &OS, const llvm::wasm::WasmTable &Type);
2018-01-18 06:29:21 +08:00
void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
void writeExport(raw_ostream &OS, const llvm::wasm::WasmExport &Export);
} // namespace wasm
2018-08-05 05:47:16 +08:00
std::string toString(llvm::wasm::ValType Type);
2018-01-18 06:29:21 +08:00
std::string toString(const llvm::wasm::WasmSignature &Sig);
2018-08-05 05:47:16 +08:00
std::string toString(const llvm::wasm::WasmGlobalType &Sig);
2018-01-18 06:29:21 +08:00
} // namespace lld
#endif // LLD_WASM_WRITERUTILS_H