Coverage Report

Created: 2018-01-17 21:32

/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 "llvm/ADT/Twine.h"
14
#include "llvm/Object/Wasm.h"
15
#include "llvm/Support/raw_ostream.h"
16
17
using llvm::raw_ostream;
18
19
// Needed for WasmSignatureDenseMapInfo
20
inline bool operator==(const llvm::wasm::WasmSignature &LHS,
21
0
                       const llvm::wasm::WasmSignature &RHS) {
22
0
  return LHS.ReturnType == RHS.ReturnType && LHS.ParamTypes == RHS.ParamTypes;
23
0
}
24
25
inline bool operator!=(const llvm::wasm::WasmSignature &LHS,
26
0
                       const llvm::wasm::WasmSignature &RHS) {
27
0
  return !(LHS == RHS);
28
0
}
29
30
namespace lld {
31
namespace wasm {
32
33
struct OutputRelocation {
34
  llvm::wasm::WasmRelocation Reloc;
35
  uint32_t NewIndex;
36
  uint32_t Value;
37
};
38
39
void debugWrite(uint64_t offset, llvm::Twine msg);
40
41
void writeUleb128(raw_ostream &OS, uint32_t Number, const char *msg);
42
43
void writeSleb128(raw_ostream &OS, int32_t Number, const char *msg);
44
45
void writeBytes(raw_ostream &OS, const char *bytes, size_t count,
46
                const char *msg = nullptr);
47
48
void writeStr(raw_ostream &OS, const llvm::StringRef String,
49
              const char *msg = nullptr);
50
51
void writeU8(raw_ostream &OS, uint8_t byte, const char *msg);
52
53
void writeU32(raw_ostream &OS, uint32_t Number, const char *msg);
54
55
void writeValueType(raw_ostream &OS, int32_t Type, const char *msg);
56
57
void writeSig(raw_ostream &OS, const llvm::wasm::WasmSignature &Sig);
58
59
void writeInitExpr(raw_ostream &OS, const llvm::wasm::WasmInitExpr &InitExpr);
60
61
void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
62
63
void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
64
65
void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
66
67
void writeExport(raw_ostream &OS, const llvm::wasm::WasmExport &Export);
68
69
void writeReloc(raw_ostream &OS, const OutputRelocation &Reloc);
70
71
} // namespace wasm
72
73
std::string toString(const llvm::wasm::ValType Type);
74
std::string toString(const llvm::wasm::WasmSignature &Sig);
75
76
} // namespace lld
77
78
#endif // LLD_WASM_WRITERUTILS_H