Coverage Report

Created: 2018-03-14 12:09

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/lld/wasm/WriterUtils.h
Line
Count
Source (jump to first uncovered line)
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
// Needed for WasmSignatureDenseMapInfo
21
inline bool operator==(const llvm::wasm::WasmSignature &LHS,
22
0
                       const llvm::wasm::WasmSignature &RHS) {
23
0
  return LHS.ReturnType == RHS.ReturnType && LHS.ParamTypes == RHS.ParamTypes;
24
0
}
25
26
inline bool operator!=(const llvm::wasm::WasmSignature &LHS,
27
0
                       const llvm::wasm::WasmSignature &RHS) {
28
0
  return !(LHS == RHS);
29
0
}
30
31
// Used for general comparison
32
inline bool operator==(const llvm::wasm::WasmGlobalType &LHS,
33
0
                       const llvm::wasm::WasmGlobalType &RHS) {
34
0
  return LHS.Type == RHS.Type && LHS.Mutable == RHS.Mutable;
35
0
}
36
37
inline bool operator!=(const llvm::wasm::WasmGlobalType &LHS,
38
0
                       const llvm::wasm::WasmGlobalType &RHS) {
39
0
  return !(LHS == RHS);
40
0
}
41
42
namespace lld {
43
namespace wasm {
44
45
void debugWrite(uint64_t Offset, const Twine &Msg);
46
47
void writeUleb128(raw_ostream &OS, uint32_t Number, const Twine &Msg);
48
49
void writeSleb128(raw_ostream &OS, int32_t Number, const Twine &Msg);
50
51
void writeBytes(raw_ostream &OS, const char *Bytes, size_t count,
52
                const Twine &Msg);
53
54
void writeStr(raw_ostream &OS, StringRef String, const Twine &Msg);
55
56
void writeU8(raw_ostream &OS, uint8_t byte, const Twine &Msg);
57
58
void writeU32(raw_ostream &OS, uint32_t Number, const Twine &Msg);
59
60
void writeValueType(raw_ostream &OS, uint8_t Type, const Twine &Msg);
61
62
void writeSig(raw_ostream &OS, const llvm::wasm::WasmSignature &Sig);
63
64
void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
65
66
void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
67
68
void writeGlobalType(raw_ostream &OS, const llvm::wasm::WasmGlobalType &Type);
69
70
void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
71
72
void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
73
74
void writeExport(raw_ostream &OS, const llvm::wasm::WasmExport &Export);
75
76
} // namespace wasm
77
78
std::string toString(const llvm::wasm::ValType Type);
79
std::string toString(const llvm::wasm::WasmSignature &Sig);
80
std::string toString(const llvm::wasm::WasmGlobalType &Sig);
81
82
} // namespace lld
83
84
#endif // LLD_WASM_WRITERUTILS_H