LLVM 18.0.0git
WebAssemblyTypeUtilities.h
Go to the documentation of this file.
1//===-- WebAssemblyTypeUtilities - WebAssembly Type Utilities---*- 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///
9/// \file
10/// This file contains the declaration of the WebAssembly-specific type parsing
11/// utility functions.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_UTILS_WEBASSEMBLYTYPEUTILITIES_H
16#define LLVM_LIB_TARGET_WEBASSEMBLY_UTILS_WEBASSEMBLYTYPEUTILITIES_H
17
19#include "WasmAddressSpaces.h"
24
25namespace llvm {
26
27namespace WebAssembly {
28
29/// Return true if this is a WebAssembly Externref Type.
30inline bool isWebAssemblyExternrefType(const Type *Ty) {
31 return Ty->getPointerAddressSpace() ==
33}
34
35/// Return true if this is a WebAssembly Funcref Type.
36inline bool isWebAssemblyFuncrefType(const Type *Ty) {
37 return Ty->getPointerAddressSpace() ==
39}
40
41/// Return true if this is a WebAssembly Reference Type.
42inline bool isWebAssemblyReferenceType(const Type *Ty) {
44}
45
46// Convert StringRef to ValType / HealType / BlockType
47
49
50// Convert a MVT into its corresponding wasm ValType.
52
53/// Sets a Wasm Symbol Type.
54void wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT,
55 const ArrayRef<MVT> &VTs);
56
57} // end namespace WebAssembly
58} // end namespace llvm
59
60#endif
Symbol * Sym
Definition: ELF_riscv.cpp:468
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),...
Definition: ArrayRef.h:41
Machine Value Type.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
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)
bool isWebAssemblyReferenceType(const Type *Ty)
Return true if this is a WebAssembly Reference Type.
void wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT, const ArrayRef< MVT > &VTs)
Sets a Wasm Symbol Type.
MVT parseMVT(StringRef Type)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18