summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-09-15 12:17:14 +1000
committerDamien George <damien.p.george@gmail.com>2018-09-15 12:17:14 +1000
commit1d7c221b3023d784ba96cb501b9becae794dac1f (patch)
treeb757b513f868816e621c06e62986c17a3df95867 /py
parent3751512e9db7ebda9ff06a710038c742ac91126c (diff)
downloadmicropython-1d7c221b3023d784ba96cb501b9becae794dac1f.tar.gz
micropython-1d7c221b3023d784ba96cb501b9becae794dac1f.zip
py/emit: Remove need to call set_native_type to set native/viper mode.
The native emitter can easily determine the mode via scope->emit_options.
Diffstat (limited to 'py')
-rw-r--r--py/compile.c1
-rw-r--r--py/emit.h1
-rw-r--r--py/emitnative.c10
3 files changed, 2 insertions, 10 deletions
diff --git a/py/compile.c b/py/compile.c
index d8e175bb6e..adf76fb974 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -3456,7 +3456,6 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
}
comp->emit_method_table = &NATIVE_EMITTER(method_table);
comp->emit = emit_native;
- EMIT_ARG(set_native_type, MP_EMIT_NATIVE_TYPE_ENABLE, s->emit_options == MP_EMIT_OPT_VIPER, 0);
break;
#endif // MICROPY_EMIT_NATIVE
diff --git a/py/emit.h b/py/emit.h
index e9980b5852..f63bb1d7a5 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -51,7 +51,6 @@ typedef enum {
#define MP_EMIT_BREAK_FROM_FOR (0x8000)
-#define MP_EMIT_NATIVE_TYPE_ENABLE (0)
#define MP_EMIT_NATIVE_TYPE_RETURN (1)
#define MP_EMIT_NATIVE_TYPE_ARG (2)
diff --git a/py/emitnative.c b/py/emitnative.c
index eb402c06b0..0794b9d502 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -224,12 +224,7 @@ void EXPORT_FUN(free)(emit_t *emit) {
}
STATIC void emit_native_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t arg1, qstr arg2) {
- switch (op) {
- case MP_EMIT_NATIVE_TYPE_ENABLE:
- emit->do_viper_types = arg1;
- break;
-
- default: {
+ {
vtype_kind_t type;
switch (arg2) {
case MP_QSTR_object: type = VTYPE_PYOBJ; break;
@@ -248,8 +243,6 @@ STATIC void emit_native_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t ar
assert(arg1 < emit->local_vtype_alloc);
emit->local_vtype[arg1] = type;
}
- break;
- }
}
}
@@ -262,6 +255,7 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
DEBUG_printf("start_pass(pass=%u, scope=%p)\n", pass, scope);
emit->pass = pass;
+ emit->do_viper_types = scope->emit_options == MP_EMIT_OPT_VIPER;
emit->stack_start = 0;
emit->stack_size = 0;
emit->last_emit_was_return_value = false;