LLDB mainline
WasmVirtualRegisters.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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#ifndef LLDB_SOURCE_UTILITY_WASM_VIRTUAL_REGISTERS_H
10#define LLDB_SOURCE_UTILITY_WASM_VIRTUAL_REGISTERS_H
11
12#include "lldb/lldb-private.h"
13
14namespace lldb_private {
15
16// LLDB doesn't have an address space to represents WebAssembly locals,
17// globals and operand stacks. We encode these elements into virtual
18// registers:
19//
20// | tag: 2 bits | index: 30 bits |
21//
22// Where tag is:
23// 0: Not a Wasm location
24// 1: Local
25// 2: Global
26// 3: Operand stack value
33
34static const uint32_t kWasmVirtualRegisterTagMask = 0x03;
35static const uint32_t kWasmVirtualRegisterIndexMask = 0x3fffffff;
36static const uint32_t kWasmVirtualRegisterTagShift = 30;
37
38inline uint32_t GetWasmVirtualRegisterTag(size_t reg) {
40}
41
42inline uint32_t GetWasmVirtualRegisterIndex(size_t reg) {
44}
45
46inline uint32_t GetWasmRegister(uint8_t tag, uint32_t index) {
49}
50
51} // namespace lldb_private
52
53#endif
A class that represents a running process on the host machine.
static const uint32_t kWasmVirtualRegisterTagShift
static const uint32_t kWasmVirtualRegisterIndexMask
uint32_t GetWasmRegister(uint8_t tag, uint32_t index)
uint32_t GetWasmVirtualRegisterTag(size_t reg)
uint32_t GetWasmVirtualRegisterIndex(size_t reg)
static const uint32_t kWasmVirtualRegisterTagMask