summaryrefslogtreecommitdiff
path: root/Include/opcode.h
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-07-01 15:33:35 +0100
committerGitHub <noreply@github.com>2022-07-01 15:33:35 +0100
commitc57aad777afc6c0b382981ee9e4bc94c03bf5f68 (patch)
tree39128a485e3372715a4b2fe4e03d7117e0fba9fc /Include/opcode.h
parentbe80db14c432c621e44920f8fd95a3f3191aca9b (diff)
downloadcpython-git-c57aad777afc6c0b382981ee9e4bc94c03bf5f68.tar.gz
gh-94216: add pseudo instructions to the dis/opcodes modules (GH-94241)
Diffstat (limited to 'Include/opcode.h')
-rw-r--r--Include/opcode.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/Include/opcode.h b/Include/opcode.h
index 66e8c9e8cf..f90ebb1d6e 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -120,6 +120,19 @@ extern "C" {
#define POP_JUMP_BACKWARD_IF_NONE 174
#define POP_JUMP_BACKWARD_IF_FALSE 175
#define POP_JUMP_BACKWARD_IF_TRUE 176
+#define MIN_PSEUDO_OPCODE 256
+#define SETUP_FINALLY 256
+#define SETUP_CLEANUP 257
+#define SETUP_WITH 258
+#define POP_BLOCK 259
+#define JUMP 260
+#define JUMP_NO_INTERRUPT 261
+#define POP_JUMP_IF_FALSE 262
+#define POP_JUMP_IF_TRUE 263
+#define POP_JUMP_IF_NONE 264
+#define POP_JUMP_IF_NOT_NONE 265
+#define LOAD_METHOD 266
+#define MAX_PSEUDO_OPCODE 266
#define BINARY_OP_ADAPTIVE 3
#define BINARY_OP_ADD_FLOAT 4
#define BINARY_OP_ADD_INT 5
@@ -194,9 +207,19 @@ extern "C" {
#define UNPACK_SEQUENCE_TWO_TUPLE 182
#define DO_TRACING 255
+#define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\
+ || ((op) == JUMP) \
+ || ((op) == JUMP_NO_INTERRUPT) \
+ || ((op) == POP_JUMP_IF_FALSE) \
+ || ((op) == POP_JUMP_IF_TRUE) \
+ || ((op) == POP_JUMP_IF_NONE) \
+ || ((op) == POP_JUMP_IF_NOT_NONE) \
+ || ((op) == LOAD_METHOD) \
+ )
+
#define HAS_CONST(op) (false\
- || ((op) == 100) \
- || ((op) == 172) \
+ || ((op) == LOAD_CONST) \
+ || ((op) == KW_NAMES) \
)
#define NB_ADD 0
@@ -226,11 +249,8 @@ extern "C" {
#define NB_INPLACE_TRUE_DIVIDE 24
#define NB_INPLACE_XOR 25
-#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT)
-/* Reserve some bytecodes for internal use in the compiler.
- * The value of 240 is arbitrary. */
-#define IS_ARTIFICIAL(op) ((op) > 240)
+#define IS_PSEUDO_OPCODE(op) (((op) >= MIN_PSEUDO_OPCODE) && ((op) <= MAX_PSEUDO_OPCODE))
#ifdef __cplusplus
}