1+ /* Auto-generated by Tools/scripts/generate_opcode_h.py */
12#ifndef Py_OPCODE_H
23#define Py_OPCODE_H
34#ifdef __cplusplus
45extern "C" {
56#endif
67
78
8- /* Instruction opcodes for compiled code */
9-
10- #define POP_TOP 1
11- #define ROT_TWO 2
12- #define ROT_THREE 3
13- #define DUP_TOP 4
14- #define DUP_TOP_TWO 5
15- #define NOP 9
16-
17- #define UNARY_POSITIVE 10
18- #define UNARY_NEGATIVE 11
19- #define UNARY_NOT 12
20-
21- #define UNARY_INVERT 15
22-
23- #define BINARY_MATRIX_MULTIPLY 16
24- #define INPLACE_MATRIX_MULTIPLY 17
25-
26- #define BINARY_POWER 19
27-
28- #define BINARY_MULTIPLY 20
29-
30- #define BINARY_MODULO 22
31- #define BINARY_ADD 23
32- #define BINARY_SUBTRACT 24
33- #define BINARY_SUBSCR 25
34- #define BINARY_FLOOR_DIVIDE 26
35- #define BINARY_TRUE_DIVIDE 27
36- #define INPLACE_FLOOR_DIVIDE 28
37- #define INPLACE_TRUE_DIVIDE 29
38-
39- #define STORE_MAP 54
40- #define INPLACE_ADD 55
41- #define INPLACE_SUBTRACT 56
42- #define INPLACE_MULTIPLY 57
43-
44- #define INPLACE_MODULO 59
45- #define STORE_SUBSCR 60
46- #define DELETE_SUBSCR 61
47-
48- #define BINARY_LSHIFT 62
49- #define BINARY_RSHIFT 63
50- #define BINARY_AND 64
51- #define BINARY_XOR 65
52- #define BINARY_OR 66
53- #define INPLACE_POWER 67
54- #define GET_ITER 68
55- #define PRINT_EXPR 70
56- #define LOAD_BUILD_CLASS 71
57- #define YIELD_FROM 72
58-
59- #define INPLACE_LSHIFT 75
60- #define INPLACE_RSHIFT 76
61- #define INPLACE_AND 77
62- #define INPLACE_XOR 78
63- #define INPLACE_OR 79
64- #define BREAK_LOOP 80
65- #define WITH_CLEANUP 81
66-
67- #define RETURN_VALUE 83
68- #define IMPORT_STAR 84
69-
70- #define YIELD_VALUE 86
71- #define POP_BLOCK 87
72- #define END_FINALLY 88
73- #define POP_EXCEPT 89
74-
75- #define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */
76-
77- #define STORE_NAME 90 /* Index in name list */
78- #define DELETE_NAME 91 /* "" */
79- #define UNPACK_SEQUENCE 92 /* Number of sequence items */
80- #define FOR_ITER 93
81- #define UNPACK_EX 94 /* Num items before variable part +
82- (Num items after variable part << 8) */
83-
84- #define STORE_ATTR 95 /* Index in name list */
85- #define DELETE_ATTR 96 /* "" */
86- #define STORE_GLOBAL 97 /* "" */
87- #define DELETE_GLOBAL 98 /* "" */
88-
89- #define LOAD_CONST 100 /* Index in const list */
90- #define LOAD_NAME 101 /* Index in name list */
91- #define BUILD_TUPLE 102 /* Number of tuple items */
92- #define BUILD_LIST 103 /* Number of list items */
93- #define BUILD_SET 104 /* Number of set items */
94- #define BUILD_MAP 105 /* Always zero for now */
95- #define LOAD_ATTR 106 /* Index in name list */
96- #define COMPARE_OP 107 /* Comparison operator */
97- #define IMPORT_NAME 108 /* Index in name list */
98- #define IMPORT_FROM 109 /* Index in name list */
99-
100- #define JUMP_FORWARD 110 /* Number of bytes to skip */
101- #define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning of code */
102- #define JUMP_IF_TRUE_OR_POP 112 /* "" */
103- #define JUMP_ABSOLUTE 113 /* "" */
104- #define POP_JUMP_IF_FALSE 114 /* "" */
105- #define POP_JUMP_IF_TRUE 115 /* "" */
106-
107- #define LOAD_GLOBAL 116 /* Index in name list */
108-
109- #define CONTINUE_LOOP 119 /* Start of loop (absolute) */
110- #define SETUP_LOOP 120 /* Target address (relative) */
111- #define SETUP_EXCEPT 121 /* "" */
112- #define SETUP_FINALLY 122 /* "" */
113-
114- #define LOAD_FAST 124 /* Local variable number */
115- #define STORE_FAST 125 /* Local variable number */
116- #define DELETE_FAST 126 /* Local variable number */
117-
118- #define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */
119- /* CALL_FUNCTION_XXX opcodes defined below depend on this definition */
120- #define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */
121- #define MAKE_FUNCTION 132 /* #defaults + #kwdefaults<<8 + #annotations<<16 */
122- #define BUILD_SLICE 133 /* Number of items */
123-
124- #define MAKE_CLOSURE 134 /* same as MAKE_FUNCTION */
125- #define LOAD_CLOSURE 135 /* Load free variable from closure */
126- #define LOAD_DEREF 136 /* Load and dereference from closure cell */
127- #define STORE_DEREF 137 /* Store into cell */
128- #define DELETE_DEREF 138 /* Delete closure cell */
129-
130- /* The next 3 opcodes must be contiguous and satisfy
131- (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */
132- #define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */
133- #define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */
134- #define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */
135-
136- #define SETUP_WITH 143
137-
138- /* Support for opargs more than 16 bits long */
139- #define EXTENDED_ARG 144
140-
141- #define LIST_APPEND 145
142- #define SET_ADD 146
143- #define MAP_ADD 147
144-
145- #define LOAD_CLASSDEREF 148
9+ /* Instruction opcodes for compiled code */
10+ #define POP_TOP 1
11+ #define ROT_TWO 2
12+ #define ROT_THREE 3
13+ #define DUP_TOP 4
14+ #define DUP_TOP_TWO 5
15+ #define NOP 9
16+ #define UNARY_POSITIVE 10
17+ #define UNARY_NEGATIVE 11
18+ #define UNARY_NOT 12
19+ #define UNARY_INVERT 15
20+ #define BINARY_MATRIX_MULTIPLY 16
21+ #define INPLACE_MATRIX_MULTIPLY 17
22+ #define BINARY_POWER 19
23+ #define BINARY_MULTIPLY 20
24+ #define BINARY_MODULO 22
25+ #define BINARY_ADD 23
26+ #define BINARY_SUBTRACT 24
27+ #define BINARY_SUBSCR 25
28+ #define BINARY_FLOOR_DIVIDE 26
29+ #define BINARY_TRUE_DIVIDE 27
30+ #define INPLACE_FLOOR_DIVIDE 28
31+ #define INPLACE_TRUE_DIVIDE 29
32+ #define STORE_MAP 54
33+ #define INPLACE_ADD 55
34+ #define INPLACE_SUBTRACT 56
35+ #define INPLACE_MULTIPLY 57
36+ #define INPLACE_MODULO 59
37+ #define STORE_SUBSCR 60
38+ #define DELETE_SUBSCR 61
39+ #define BINARY_LSHIFT 62
40+ #define BINARY_RSHIFT 63
41+ #define BINARY_AND 64
42+ #define BINARY_XOR 65
43+ #define BINARY_OR 66
44+ #define INPLACE_POWER 67
45+ #define GET_ITER 68
46+ #define PRINT_EXPR 70
47+ #define LOAD_BUILD_CLASS 71
48+ #define YIELD_FROM 72
49+ #define INPLACE_LSHIFT 75
50+ #define INPLACE_RSHIFT 76
51+ #define INPLACE_AND 77
52+ #define INPLACE_XOR 78
53+ #define INPLACE_OR 79
54+ #define BREAK_LOOP 80
55+ #define WITH_CLEANUP 81
56+ #define RETURN_VALUE 83
57+ #define IMPORT_STAR 84
58+ #define YIELD_VALUE 86
59+ #define POP_BLOCK 87
60+ #define END_FINALLY 88
61+ #define POP_EXCEPT 89
62+ #define HAVE_ARGUMENT 90
63+ #define STORE_NAME 90
64+ #define DELETE_NAME 91
65+ #define UNPACK_SEQUENCE 92
66+ #define FOR_ITER 93
67+ #define UNPACK_EX 94
68+ #define STORE_ATTR 95
69+ #define DELETE_ATTR 96
70+ #define STORE_GLOBAL 97
71+ #define DELETE_GLOBAL 98
72+ #define LOAD_CONST 100
73+ #define LOAD_NAME 101
74+ #define BUILD_TUPLE 102
75+ #define BUILD_LIST 103
76+ #define BUILD_SET 104
77+ #define BUILD_MAP 105
78+ #define LOAD_ATTR 106
79+ #define COMPARE_OP 107
80+ #define IMPORT_NAME 108
81+ #define IMPORT_FROM 109
82+ #define JUMP_FORWARD 110
83+ #define JUMP_IF_FALSE_OR_POP 111
84+ #define JUMP_IF_TRUE_OR_POP 112
85+ #define JUMP_ABSOLUTE 113
86+ #define POP_JUMP_IF_FALSE 114
87+ #define POP_JUMP_IF_TRUE 115
88+ #define LOAD_GLOBAL 116
89+ #define CONTINUE_LOOP 119
90+ #define SETUP_LOOP 120
91+ #define SETUP_EXCEPT 121
92+ #define SETUP_FINALLY 122
93+ #define LOAD_FAST 124
94+ #define STORE_FAST 125
95+ #define DELETE_FAST 126
96+ #define RAISE_VARARGS 130
97+ #define CALL_FUNCTION 131
98+ #define MAKE_FUNCTION 132
99+ #define BUILD_SLICE 133
100+ #define MAKE_CLOSURE 134
101+ #define LOAD_CLOSURE 135
102+ #define LOAD_DEREF 136
103+ #define STORE_DEREF 137
104+ #define DELETE_DEREF 138
105+ #define CALL_FUNCTION_VAR 140
106+ #define CALL_FUNCTION_KW 141
107+ #define CALL_FUNCTION_VAR_KW 142
108+ #define SETUP_WITH 143
109+ #define EXTENDED_ARG 144
110+ #define LIST_APPEND 145
111+ #define SET_ADD 146
112+ #define MAP_ADD 147
113+ #define LOAD_CLASSDEREF 148
146114
147115/* EXCEPT_HANDLER is a special, implicit block type which is created when
148116 entering an except handler. It is not an opcode but we define it here
@@ -151,8 +119,9 @@ extern "C" {
151119#define EXCEPT_HANDLER 257
152120
153121
154- enum cmp_op {PyCmp_LT = Py_LT , PyCmp_LE = Py_LE , PyCmp_EQ = Py_EQ , PyCmp_NE = Py_NE , PyCmp_GT = Py_GT , PyCmp_GE = Py_GE ,
155- PyCmp_IN , PyCmp_NOT_IN , PyCmp_IS , PyCmp_IS_NOT , PyCmp_EXC_MATCH , PyCmp_BAD };
122+ enum cmp_op {PyCmp_LT = Py_LT , PyCmp_LE = Py_LE , PyCmp_EQ = Py_EQ , PyCmp_NE = Py_NE ,
123+ PyCmp_GT = Py_GT , PyCmp_GE = Py_GE , PyCmp_IN , PyCmp_NOT_IN ,
124+ PyCmp_IS , PyCmp_IS_NOT , PyCmp_EXC_MATCH , PyCmp_BAD };
156125
157126#define HAS_ARG (op ) ((op) >= HAVE_ARGUMENT)
158127
0 commit comments