Line data Source code
1 : //===-- llvm/BinaryFormat/Wasm.cpp -------------------------------*- C++-*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 :
10 : #include "llvm/BinaryFormat/Wasm.h"
11 :
12 2 : std::string llvm::wasm::toString(wasm::WasmSymbolType type) {
13 2 : switch (type) {
14 : case wasm::WASM_SYMBOL_TYPE_FUNCTION:
15 1 : return "WASM_SYMBOL_TYPE_FUNCTION";
16 : case wasm::WASM_SYMBOL_TYPE_GLOBAL:
17 0 : return "WASM_SYMBOL_TYPE_GLOBAL";
18 : case wasm::WASM_SYMBOL_TYPE_DATA:
19 1 : return "WASM_SYMBOL_TYPE_DATA";
20 : case wasm::WASM_SYMBOL_TYPE_SECTION:
21 0 : return "WASM_SYMBOL_TYPE_SECTION";
22 : }
23 0 : llvm_unreachable("unknown symbol type");
24 : }
25 :
26 0 : std::string llvm::wasm::relocTypetoString(uint32_t type) {
27 0 : switch (type) {
28 : #define WASM_RELOC(NAME, VALUE) \
29 : case VALUE: \
30 : return #NAME;
31 : #include "llvm/BinaryFormat/WasmRelocs.def"
32 : #undef WASM_RELOC
33 0 : default:
34 0 : llvm_unreachable("unknown reloc type");
35 : }
36 : }
|