summaryrefslogtreecommitdiff
path: root/py/asmthumb.h
diff options
context:
space:
mode:
Diffstat (limited to 'py/asmthumb.h')
-rw-r--r--py/asmthumb.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/py/asmthumb.h b/py/asmthumb.h
index 320861999..86b816657 100644
--- a/py/asmthumb.h
+++ b/py/asmthumb.h
@@ -29,6 +29,7 @@
#include <assert.h>
#include "py/misc.h"
#include "py/asmbase.h"
+#include "py/persistentcode.h"
#define ASM_THUMB_REG_R0 (0)
#define ASM_THUMB_REG_R1 (1)
@@ -70,6 +71,21 @@ typedef struct _asm_thumb_t {
uint32_t stack_adjust;
} asm_thumb_t;
+#if MICROPY_DYNAMIC_COMPILER
+
+static inline bool asm_thumb_allow_armv7m(asm_thumb_t *as) {
+ return MP_NATIVE_ARCH_ARMV7M <= mp_dynamic_compiler.native_arch
+ && mp_dynamic_compiler.native_arch <= MP_NATIVE_ARCH_ARMV7EMDP;
+}
+
+#else
+
+static inline bool asm_thumb_allow_armv7m(asm_thumb_t *as) {
+ return MICROPY_EMIT_THUMB_ARMV7M;
+}
+
+#endif
+
static inline void asm_thumb_end_pass(asm_thumb_t *as) {
(void)as;
}
@@ -308,12 +324,7 @@ static inline void asm_thumb_sxth_rlo_rlo(asm_thumb_t *as, uint rlo_dest, uint r
#define ASM_THUMB_OP_MOVT (0xf2c0)
void asm_thumb_mov_reg_reg(asm_thumb_t *as, uint reg_dest, uint reg_src);
-
-#if MICROPY_EMIT_THUMB_ARMV7M
-size_t asm_thumb_mov_reg_i16(asm_thumb_t *as, uint mov_op, uint reg_dest, int i16_src);
-#else
-void asm_thumb_mov_rlo_i16(asm_thumb_t *as, uint rlo_dest, int i16_src);
-#endif
+void asm_thumb_mov_reg_i16(asm_thumb_t *as, uint mov_op, uint reg_dest, int i16_src);
// these return true if the destination is in range, false otherwise
bool asm_thumb_b_n_label(asm_thumb_t *as, uint label);
@@ -390,11 +401,6 @@ void asm_thumb_b_rel12(asm_thumb_t *as, int rel);
#define ASM_MOV_LOCAL_REG(as, local_num, reg) asm_thumb_mov_local_reg((as), (local_num), (reg))
#define ASM_MOV_REG_IMM(as, reg_dest, imm) asm_thumb_mov_reg_i32_optimised((as), (reg_dest), (imm))
-#if MICROPY_EMIT_THUMB_ARMV7M
-#define ASM_MOV_REG_IMM_FIX_U16(as, reg_dest, imm) asm_thumb_mov_reg_i16((as), ASM_THUMB_OP_MOVW, (reg_dest), (imm))
-#else
-#define ASM_MOV_REG_IMM_FIX_U16(as, reg_dest, imm) asm_thumb_mov_rlo_i16((as), (reg_dest), (imm))
-#endif
#define ASM_MOV_REG_IMM_FIX_WORD(as, reg_dest, imm) asm_thumb_mov_reg_i32((as), (reg_dest), (imm))
#define ASM_MOV_REG_LOCAL(as, reg_dest, local_num) asm_thumb_mov_reg_local((as), (reg_dest), (local_num))
#define ASM_MOV_REG_REG(as, reg_dest, reg_src) asm_thumb_mov_reg_reg((as), (reg_dest), (reg_src))