LLVM  10.0.0svn
Wasm.cpp
Go to the documentation of this file.
1 //===-- llvm/BinaryFormat/Wasm.cpp -------------------------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 
12  switch (Type) {
14  return "WASM_SYMBOL_TYPE_FUNCTION";
16  return "WASM_SYMBOL_TYPE_GLOBAL";
18  return "WASM_SYMBOL_TYPE_DATA";
20  return "WASM_SYMBOL_TYPE_SECTION";
22  return "WASM_SYMBOL_TYPE_EVENT";
23  }
24  llvm_unreachable("unknown symbol type");
25 }
26 
28  switch (Type) {
29 #define WASM_RELOC(NAME, VALUE) \
30  case VALUE: \
31  return #NAME;
32 #include "llvm/BinaryFormat/WasmRelocs.def"
33 #undef WASM_RELOC
34  default:
35  llvm_unreachable("unknown reloc type");
36  }
37 }
38 
40  switch (Type) {
41  case R_WASM_MEMORY_ADDR_LEB:
42  case R_WASM_MEMORY_ADDR_SLEB:
43  case R_WASM_MEMORY_ADDR_REL_SLEB:
44  case R_WASM_MEMORY_ADDR_I32:
45  case R_WASM_FUNCTION_OFFSET_I32:
46  case R_WASM_SECTION_OFFSET_I32:
47  return true;
48  default:
49  return false;
50  }
51 }
WasmSymbolType
Definition: Wasm.h:310
bool relocTypeHasAddend(uint32_t type)
Definition: Wasm.cpp:39
std::string relocTypetoString(uint32_t type)
Definition: Wasm.cpp:27
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
std::string toString(WasmSymbolType type)
Definition: Wasm.cpp:11