LLVM 20.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->isPointerTy() &&
34}
35
36/// Return true if this is a WebAssembly Funcref Type.
37inline bool isWebAssemblyFuncrefType(const Type *Ty) {
38 return Ty->isPointerTy() &&
41}
42
43/// Return true if this is a WebAssembly Reference Type.
44inline bool isWebAssemblyReferenceType(const Type *Ty) {
46}
47
48/// Return true if the table represents a WebAssembly table type.
49inline bool isWebAssemblyTableType(const Type *Ty) {
50 return Ty->isArrayTy() &&
52}
53
54// Convert StringRef to ValType / HealType / BlockType
55
57
58// Convert a MVT into its corresponding wasm ValType.
60
61/// Sets a Wasm Symbol Type.
62void wasmSymbolSetType(MCSymbolWasm *Sym, const Type *GlobalVT,
63 ArrayRef<MVT> VTs);
64
65} // end namespace WebAssembly
66} // end namespace llvm
67
68#endif
Symbol * Sym
Definition: ELF_riscv.cpp:479
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
bool isArrayTy() const
True if this is an instance of ArrayType.
Definition: Type.h:248
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:251
Type * getArrayElementType() const
Definition: Type.h:399
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.
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.
MVT parseMVT(StringRef Type)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18