py: Wrap #if's around emitter functions that are used only by emitcpy.
3 emitter functions are needed only for emitcpy, and so we can #if them
out when compiling with emitcpy support.
Also remove unused SETUP_LOOP bytecode.
diff --git a/py/emitbc.c b/py/emitbc.c
index c445d97..f58cec1 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -16,6 +16,8 @@
#include "emit.h"
#include "bc0.h"
+#if !MICROPY_EMIT_CPYTHON
+
struct _emit_t {
pass_kind_t pass;
int stack_size;
@@ -421,11 +423,6 @@
}
}
-STATIC void emit_bc_load_const_verbatim_str(emit_t *emit, const char *str) {
- // not needed/supported for BC
- assert(0);
-}
-
STATIC void emit_bc_load_null(emit_t *emit) {
emit_bc_pre(emit, 1);
emit_write_byte_code_byte(emit, MP_BC_LOAD_NULL);
@@ -447,11 +444,6 @@
emit_write_byte_code_byte_uint(emit, MP_BC_LOAD_DEREF, local_num);
}
-STATIC void emit_bc_load_closure(emit_t *emit, qstr qstr, int local_num) {
- // not needed/supported for BC
- assert(0);
-}
-
STATIC void emit_bc_load_name(emit_t *emit, qstr qstr) {
emit_bc_pre(emit, 1);
emit_write_byte_code_byte_qstr(emit, MP_BC_LOAD_NAME, qstr);
@@ -598,11 +590,6 @@
emit_write_byte_code_byte_signed_label(emit, MP_BC_JUMP_IF_FALSE_OR_POP, label);
}
-STATIC void emit_bc_setup_loop(emit_t *emit, uint label) {
- emit_bc_pre(emit, 0);
- emit_write_byte_code_byte_unsigned_label(emit, MP_BC_SETUP_LOOP, label);
-}
-
STATIC void emit_bc_unwind_jump(emit_t *emit, uint label, int except_depth) {
if (except_depth == 0) {
emit_bc_jump(emit, label);
@@ -855,11 +842,9 @@
emit_bc_load_const_dec,
emit_bc_load_const_id,
emit_bc_load_const_str,
- emit_bc_load_const_verbatim_str,
emit_bc_load_null,
emit_bc_load_fast,
emit_bc_load_deref,
- emit_bc_load_closure,
emit_bc_load_name,
emit_bc_load_global,
emit_bc_load_attr,
@@ -888,7 +873,6 @@
emit_bc_pop_jump_if_false,
emit_bc_jump_if_true_or_pop,
emit_bc_jump_if_false_or_pop,
- emit_bc_setup_loop,
emit_bc_unwind_jump,
emit_bc_unwind_jump,
emit_bc_setup_with,
@@ -923,3 +907,5 @@
emit_bc_yield_value,
emit_bc_yield_from,
};
+
+#endif // !MICROPY_EMIT_CPYTHON