summaryrefslogtreecommitdiffstatshomepage
path: root/py/asmxtensa.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-09 22:50:58 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-09 22:50:58 +1100
commit155fdc74d5864266441887d6c88111159f401a62 (patch)
tree190638448b8cedcdfe43fa703b3bf72e3a38f333 /py/asmxtensa.c
parente920bab9768f71c7e22fcfc5af3e1c40f2db8eeb (diff)
downloadmicropython-155fdc74d5864266441887d6c88111159f401a62.tar.gz
micropython-155fdc74d5864266441887d6c88111159f401a62.zip
py/asm: Remove need for dummy_data when doing initial assembler passes.
For all but the last pass the assembler only needs to count how much space is needed for the machine code, it doesn't actually need to emit anything. The dummy_data just uses unnecessary RAM and without it the code is not any more complex (and code size does not increase for Thumb and Xtensa archs).
Diffstat (limited to 'py/asmxtensa.c')
-rw-r--r--py/asmxtensa.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/py/asmxtensa.c b/py/asmxtensa.c
index 00df432ce7..00448dfc59 100644
--- a/py/asmxtensa.c
+++ b/py/asmxtensa.c
@@ -97,15 +97,19 @@ STATIC uint32_t get_label_dest(asm_xtensa_t *as, uint label) {
void asm_xtensa_op16(asm_xtensa_t *as, uint16_t op) {
uint8_t *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 2);
- c[0] = op;
- c[1] = op >> 8;
+ if (c != NULL) {
+ c[0] = op;
+ c[1] = op >> 8;
+ }
}
void asm_xtensa_op24(asm_xtensa_t *as, uint32_t op) {
uint8_t *c = mp_asm_base_get_cur_to_write_bytes(&as->base, 3);
- c[0] = op;
- c[1] = op >> 8;
- c[2] = op >> 16;
+ if (c != NULL) {
+ c[0] = op;
+ c[1] = op >> 8;
+ c[2] = op >> 16;
+ }
}
void asm_xtensa_j_label(asm_xtensa_t *as, uint label) {
@@ -147,7 +151,7 @@ void asm_xtensa_mov_reg_i32(asm_xtensa_t *as, uint reg_dest, uint32_t i32) {
// load the constant
asm_xtensa_op_l32r(as, reg_dest, as->base.code_offset, 4 + as->cur_const * WORD_SIZE);
// store the constant in the table
- if (as->base.pass == MP_ASM_PASS_EMIT) {
+ if (as->const_table != NULL) {
as->const_table[as->cur_const] = i32;
}
++as->cur_const;