LLVM: lib/Target/WebAssembly/Utils/WebAssemblyTypeUtilities.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
16
17
18#define GET_REGINFO_ENUM
19#include "WebAssemblyGenRegisterInfo.inc"
20
21using namespace llvm;
22
25 .Case("i32", MVT::i32)
26 .Case("i64", MVT::i64)
27 .Case("f32", MVT::f32)
28 .Case("f64", MVT::f64)
29 .Case("i64", MVT::i64)
30 .Case("v16i8", MVT::v16i8)
31 .Case("v8i16", MVT::v8i16)
32 .Case("v4i32", MVT::v4i32)
33 .Case("v2i64", MVT::v2i64)
34 .Case("funcref", MVT::funcref)
35 .Case("externref", MVT::externref)
36 .Case("exnref", MVT::exnref)
38}
39
41 switch (Type.SimpleTy) {
42 case MVT::i32:
44 case MVT::i64:
46 case MVT::f32:
48 case MVT::f64:
50 case MVT::v16i8:
51 case MVT::v8i16:
52 case MVT::v4i32:
53 case MVT::v2i64:
54 case MVT::v8f16:
55 case MVT::v4f32:
56 case MVT::v2f64:
58 case MVT::funcref:
60 case MVT::externref:
62 case MVT::exnref:
64 default:
66 }
67}
68
72
73
74
75
77 bool IsTable = false;
79 IsTable = true;
85 else
87 } else if (VTs.size() == 1) {
89 } else
91
92 if (IsTable) {
95 } else {
98 }
99}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This file contains the declaration of the WebAssembly-specific type parsing utility functions.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
void setTableType(wasm::WasmTableType TT)
void setType(wasm::WasmSymbolType type)
void setGlobalType(wasm::WasmGlobalType GT)
std::optional< wasm::WasmSymbolType > getType() const
@ INVALID_SIMPLE_VALUE_TYPE
StringRef - Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
The instances of the Type class are immutable: once they are created, they are never changed.
Type * getArrayElementType() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isWebAssemblyExternrefType(const Type *Ty)
Return true if this is a WebAssembly Externref Type.
bool isWebAssemblyFuncrefType(const Type *Ty)
Return true if this is a WebAssembly Funcref Type.
wasm::ValType toValType(MVT Type)
Definition WebAssemblyTypeUtilities.cpp:40
bool isWebAssemblyTableType(const Type *Ty)
Return true if the table represents a WebAssembly table type.
void wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT, ArrayRef< MVT > VTs)
Sets a Wasm Symbol Type.
Definition WebAssemblyTypeUtilities.cpp:69
MVT parseMVT(StringRef Type)
Definition WebAssemblyTypeUtilities.cpp:23
@ WASM_SYMBOL_TYPE_GLOBAL
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)