diff options
author | Damien George <damien.p.george@gmail.com> | 2018-09-16 00:43:24 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-09-16 00:43:24 +1000 |
commit | 30a45360e73481cce312dd7cb2e344504c889a28 (patch) | |
tree | 5b658a28e7cd823c46cca263e37d4a5ba5a5d9bf /py/emitnative.c | |
parent | 93d71c5436488d52d47d165dd020217415e79a64 (diff) |
py/asmxtensa: Make indirect calls using func table, not raw pointers.
Loading a pointer by indexing into the native function table mp_fun_table,
rather than loading an immediate value (via a PC-relative load), uses less
code space.
Diffstat (limited to 'py/emitnative.c')
-rw-r--r-- | py/emitnative.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index 4445aeaab..c8ddbc8ef 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -329,6 +329,8 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop 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); + #elif N_XTENSA + ASM_MOV_REG_IMM(emit->as, ASM_XTENSA_REG_A15, (uint32_t)mp_fun_table); #endif // Store function object (passed as first arg) to stack if needed @@ -396,6 +398,8 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop 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); + #elif N_XTENSA + ASM_MOV_REG_IMM(emit->as, ASM_XTENSA_REG_A15, (uint32_t)mp_fun_table); #endif // prepare incoming arguments for call to mp_setup_code_state |