aboutsummaryrefslogtreecommitdiff
path: root/py/asmthumb.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/asmthumb.c
parente920bab9768f71c7e22fcfc5af3e1c40f2db8eeb (diff)
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/asmthumb.c')
-rw-r--r--py/asmthumb.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/py/asmthumb.c b/py/asmthumb.c
index 82a226b62..749c1e405 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -162,18 +162,22 @@ STATIC mp_uint_t get_label_dest(asm_thumb_t *as, uint label) {
void asm_thumb_op16(asm_thumb_t *as, uint op) {
byte *c = asm_thumb_get_cur_to_write_bytes(as, 2);
- // little endian
- c[0] = op;
- c[1] = op >> 8;
+ if (c != NULL) {
+ // little endian
+ c[0] = op;
+ c[1] = op >> 8;
+ }
}
void asm_thumb_op32(asm_thumb_t *as, uint op1, uint op2) {
byte *c = asm_thumb_get_cur_to_write_bytes(as, 4);
- // little endian, op1 then op2
- c[0] = op1;
- c[1] = op1 >> 8;
- c[2] = op2;
- c[3] = op2 >> 8;
+ if (c != NULL) {
+ // little endian, op1 then op2
+ c[0] = op1;
+ c[1] = op1 >> 8;
+ c[2] = op2;
+ c[3] = op2 >> 8;
+ }
}
#define OP_FORMAT_4(op, rlo_dest, rlo_src) ((op) | ((rlo_src) << 3) | (rlo_dest))