summaryrefslogtreecommitdiff
path: root/py/emitnative.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-06-17 23:06:24 +1000
committerDamien George <damien@micropython.org>2022-06-20 22:28:18 +1000
commite85a096302e8b186b82c74e7da4e1a29ef62d9c6 (patch)
treeba0c03f2dd7b57b9d22c4cb28912e9f4585ec6ef /py/emitnative.c
parent0db046b67b8ed171f4898e851c3da39aab297ce9 (diff)
py/emit: Remove logic to detect last-emit-was-return-value.
This optimisation to remove dead code is not as good as it could be. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/emitnative.c')
-rw-r--r--py/emitnative.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index 6683ea420..5b695a22a 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -276,8 +276,6 @@ struct _emit_t {
uint16_t n_info;
uint16_t n_cell;
- bool last_emit_was_return_value;
-
scope_t *scope;
ASM_T *as;
@@ -370,7 +368,6 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
emit->pass = pass;
emit->do_viper_types = scope->emit_options == MP_EMIT_OPT_VIPER;
emit->stack_size = 0;
- emit->last_emit_was_return_value = false;
emit->scope = scope;
// allocate memory for keeping track of the types of locals
@@ -733,10 +730,6 @@ STATIC bool emit_native_end_pass(emit_t *emit) {
return true;
}
-STATIC bool emit_native_last_emit_was_return_value(emit_t *emit) {
- return emit->last_emit_was_return_value;
-}
-
STATIC void ensure_extra_stack(emit_t *emit, size_t delta) {
if (emit->stack_size + delta > emit->stack_info_alloc) {
size_t new_alloc = (emit->stack_size + delta + 8) & ~3;
@@ -793,7 +786,7 @@ STATIC void emit_native_set_source_line(emit_t *emit, mp_uint_t source_line) {
// this must be called at start of emit functions
STATIC void emit_native_pre(emit_t *emit) {
- emit->last_emit_was_return_value = false;
+ (void)emit;
}
// depth==0 is top, depth==1 is before top, etc
@@ -917,7 +910,6 @@ STATIC void emit_fold_stack_top(emit_t *emit, int reg_dest) {
// If stacked value is in a register and the register is not r1 or r2, then
// *reg_dest is set to that register. Otherwise the value is put in *reg_dest.
STATIC void emit_pre_pop_reg_flexible(emit_t *emit, vtype_kind_t *vtype, int *reg_dest, int not_r1, int not_r2) {
- emit->last_emit_was_return_value = false;
stack_info_t *si = peek_stack(emit, 0);
if (si->kind == STACK_REG && si->data.u_reg != not_r1 && si->data.u_reg != not_r2) {
*vtype = si->vtype;
@@ -930,12 +922,10 @@ STATIC void emit_pre_pop_reg_flexible(emit_t *emit, vtype_kind_t *vtype, int *re
}
STATIC void emit_pre_pop_discard(emit_t *emit) {
- emit->last_emit_was_return_value = false;
adjust_stack(emit, -1);
}
STATIC void emit_pre_pop_reg(emit_t *emit, vtype_kind_t *vtype, int reg_dest) {
- emit->last_emit_was_return_value = false;
emit_access_stack(emit, 1, vtype, reg_dest);
adjust_stack(emit, -1);
}
@@ -2771,7 +2761,6 @@ STATIC void emit_native_return_value(emit_t *emit) {
// Do the unwinding jump to get to the return handler
emit_native_unwind_jump(emit, emit->exit_label, emit->exc_stack_size);
- emit->last_emit_was_return_value = true;
return;
}
@@ -2809,7 +2798,6 @@ STATIC void emit_native_return_value(emit_t *emit) {
ASM_MOV_LOCAL_REG(emit->as, LOCAL_IDX_RET_VAL(emit), REG_PARENT_RET);
}
emit_native_unwind_jump(emit, emit->exit_label, emit->exc_stack_size);
- emit->last_emit_was_return_value = true;
}
STATIC void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
@@ -2928,7 +2916,6 @@ const emit_method_table_t EXPORT_FUN(method_table) = {
emit_native_start_pass,
emit_native_end_pass,
- emit_native_last_emit_was_return_value,
emit_native_adjust_stack_size,
emit_native_set_source_line,