1 //===-- FormatterBytecode.def
-----------------------------------*- C
++ -*-===//
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
7 //===----------------------------------------------------------------------===//
10 #define
DEFINE_OPCODE(OP
, MNEMONIC
, NAME
)
12 #ifndef DEFINE_SELECTOR
13 #define
DEFINE_SELECTOR(ID
, NAME
)
15 #ifndef DEFINE_SIGNATURE
16 #define
DEFINE_SIGNATURE(ID
, NAME
)
20 DEFINE_OPCODE(0x01, "dup", dup
)
21 DEFINE_OPCODE(0x02, "drop", drop
)
22 DEFINE_OPCODE(0x03, "pick", pick
)
23 DEFINE_OPCODE(0x04, "over", over
)
24 DEFINE_OPCODE(0x05, "swap", swap
)
25 DEFINE_OPCODE(0x06, "rot", rot
)
27 DEFINE_OPCODE(0x10, "{", begin
)
28 DEFINE_OPCODE(0x11, "if", if
)
29 DEFINE_OPCODE(0x12, "ifelse", ifelse
)
30 DEFINE_OPCODE(0x13, "return", return
)
32 DEFINE_OPCODE(0x20, nullptr
, lit_uint
)
33 DEFINE_OPCODE(0x21, nullptr
, lit_int
)
34 DEFINE_OPCODE(0x22, nullptr
, lit_string
)
35 DEFINE_OPCODE(0x23, nullptr
, lit_selector
)
37 DEFINE_OPCODE(0x2a, "as_int", as_int
)
38 DEFINE_OPCODE(0x2b, "as_uint", as_uint
)
39 DEFINE_OPCODE(0x2c, "is_null", is_null
)
41 DEFINE_OPCODE(0x30, "+", plus
)
42 DEFINE_OPCODE(0x31, "-", minus
)
43 DEFINE_OPCODE(0x32, "*", mul
)
44 DEFINE_OPCODE(0x33, "/", div
)
45 DEFINE_OPCODE(0x34, "%", mod
)
46 DEFINE_OPCODE(0x35, "<<", shl
)
47 DEFINE_OPCODE(0x36, ">>", shr
)
49 DEFINE_OPCODE(0x40, "&", and
)
50 DEFINE_OPCODE(0x41, "|", or
)
51 DEFINE_OPCODE(0x42, "^", xor
)
52 DEFINE_OPCODE(0x43, "~", not
)
54 DEFINE_OPCODE(0x50, "=", eq
)
55 DEFINE_OPCODE(0x51, "!=", neq
)
56 DEFINE_OPCODE(0x52, "<", lt
)
57 DEFINE_OPCODE(0x53, ">", gt
)
58 DEFINE_OPCODE(0x54, "=<", le
)
59 DEFINE_OPCODE(0x55, ">=", ge
)
61 DEFINE_OPCODE(0x60, "call", call
)
64 DEFINE_SELECTOR(0x00, summary
)
65 DEFINE_SELECTOR(0x01, type_summary
)
67 DEFINE_SELECTOR(0x10, get_num_children
)
68 DEFINE_SELECTOR(0x11, get_child_at_index
)
69 DEFINE_SELECTOR(0x12, get_child_with_name
)
70 DEFINE_SELECTOR(0x13, get_child_index
)
71 DEFINE_SELECTOR(0x15, get_type
)
72 DEFINE_SELECTOR(0x16, get_template_argument_type
)
73 DEFINE_SELECTOR(0x17, cast
)
75 DEFINE_SELECTOR(0x20, get_value
)
76 DEFINE_SELECTOR(0x21, get_value_as_unsigned
)
77 DEFINE_SELECTOR(0x22, get_value_as_signed
)
78 DEFINE_SELECTOR(0x23, get_value_as_address
)
80 DEFINE_SELECTOR(0x40, read_memory_byte
)
81 DEFINE_SELECTOR(0x41, read_memory_uint32
)
82 DEFINE_SELECTOR(0x42, read_memory_int32
)
83 DEFINE_SELECTOR(0x43, read_memory_unsigned
)
84 DEFINE_SELECTOR(0x44, read_memory_signed
)
85 DEFINE_SELECTOR(0x45, read_memory_address
)
86 DEFINE_SELECTOR(0x46, read_memory
)
88 DEFINE_SELECTOR(0x50, fmt
)
89 DEFINE_SELECTOR(0x51, sprintf
)
90 DEFINE_SELECTOR(0x52, strlen
)
92 // Formatter signatures.
93 DEFINE_SIGNATURE(0, summary
)
94 DEFINE_SIGNATURE(1, init
)
95 DEFINE_SIGNATURE(2, get_num_children
)
96 DEFINE_SIGNATURE(3, get_child_index
)
97 DEFINE_SIGNATURE(4, get_child_at_index
)
98 DEFINE_SIGNATURE(5, get_value
)
101 #undef DEFINE_SELECTOR
102 #undef DEFINE_SIGNATURE