summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-08-12 23:31:19 +0100
committerDamien George <damien.p.george@gmail.com>2015-08-12 23:31:19 +0100
commitc39093d801b8fb50c9af48902e9bb5faa9ab1e8b (patch)
tree633a1b3157f5742a1447a01a469eda3ba8cc5441 /py
parent94ef8879cd28e7531ab214f093e184d74490f639 (diff)
downloadmicropython-c39093d801b8fb50c9af48902e9bb5faa9ab1e8b.tar.gz
micropython-c39093d801b8fb50c9af48902e9bb5faa9ab1e8b.zip
py: In native ARM emitter, load r7 with table earlier in func prelude.
r7 may be needed to set up code state, so it must be loaded before the set-up function is called.
Diffstat (limited to 'py')
-rw-r--r--py/emitnative.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/py/emitnative.c b/py/emitnative.c
index 2a521c229c..af7fbc5510 100644
--- a/py/emitnative.c
+++ b/py/emitnative.c
@@ -693,6 +693,13 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
}
ASM_ENTRY(emit->as, num_locals);
+ // TODO don't load r7 if we don't need it
+ #if N_THUMB
+ asm_thumb_mov_reg_i32(emit->as, ASM_THUMB_REG_R7, (mp_uint_t)mp_fun_table);
+ #elif N_ARM
+ asm_arm_mov_reg_i32(emit->as, ASM_ARM_REG_R7, (mp_uint_t)mp_fun_table);
+ #endif
+
#if N_X86
for (int i = 0; i < scope->num_pos_args; i++) {
if (i == 0) {
@@ -730,6 +737,13 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
// allocate space on C-stack for code_state structure, which includes state
ASM_ENTRY(emit->as, STATE_START + emit->n_state);
+ // TODO don't load r7 if we don't need it
+ #if N_THUMB
+ asm_thumb_mov_reg_i32(emit->as, ASM_THUMB_REG_R7, (mp_uint_t)mp_fun_table);
+ #elif N_ARM
+ asm_arm_mov_reg_i32(emit->as, ASM_ARM_REG_R7, (mp_uint_t)mp_fun_table);
+ #endif
+
// prepare incoming arguments for call to mp_setup_code_state
#if N_X86
asm_x86_mov_arg_to_r32(emit->as, 0, REG_ARG_2);
@@ -796,15 +810,6 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
}
}
- #if N_THUMB
- // TODO don't load r7 if we don't need it
- asm_thumb_mov_reg_i32(emit->as, ASM_THUMB_REG_R7, (mp_uint_t)mp_fun_table);
- #endif
-
- #if N_ARM
- // TODO don't load r7 if we don't need it
- asm_arm_mov_reg_i32(emit->as, ASM_ARM_REG_R7, (mp_uint_t)mp_fun_table);
- #endif
}
STATIC void emit_native_end_pass(emit_t *emit) {