LLVM 19.0.0git
WebAssemblyMCTypeUtilities.h
Go to the documentation of this file.
1//===-- WebAssemblyMCTypeUtilities - 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_MCTARGETDESC_WEBASSEMBLYMCTYPEUTILITIES_H
16#define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTYPEUTILITIES_H
17
19
20namespace llvm {
21
22namespace WebAssembly {
23
24/// Used as immediate MachineOperands for block signatures
25enum class BlockType : unsigned {
26 Invalid = 0x00,
27 Void = 0x40,
36 // Multivalue blocks (and other non-void blocks) are only emitted when the
37 // blocks will never be exited and are at the ends of functions (see
38 // WebAssemblyCFGStackify::fixEndsAtEndOfFunction). They also are never made
39 // to pop values off the stack, so the exact multivalue signature can always
40 // be inferred from the return type of the parent function in MCInstLower.
41 Multivalue = 0xffff,
42};
43
47}
48
49// Convert ValType or a list/signature of ValTypes to a string.
50
51// Convert an unsigned integer, which can be among wasm::ValType enum, to its
52// type name string. If the input is not within wasm::ValType, returns
53// "invalid_type".
54const char *anyTypeToString(unsigned Type);
56// Convert a list of ValTypes into a string in the format of
57// "type0, type1, ... typeN"
59// Convert a wasm signature into a string in the format of
60// "(params) -> (results)", where params and results are a string of ValType
61// lists.
62std::string signatureToString(const wasm::WasmSignature *Sig);
63
64// Convert a register class ID to a wasm ValType.
66
67// Convert StringRef to ValType / HealType / BlockType
68
69std::optional<wasm::ValType> parseType(StringRef Type);
71
72} // end namespace WebAssembly
73} // end namespace llvm
74
75#endif
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
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
const char * typeToString(wasm::ValType Type)
BlockType parseBlockType(StringRef Type)
wasm::ValType regClassToValType(unsigned RC)
bool isRefType(wasm::ValType Type)
BlockType
Used as immediate MachineOperands for block signatures.
std::string signatureToString(const wasm::WasmSignature *Sig)
const char * anyTypeToString(unsigned Type)
std::string typeListToString(ArrayRef< wasm::ValType > List)
std::optional< wasm::ValType > parseType(StringRef Type)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18