diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-05-07 23:08:09 +0300 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-05-08 22:35:34 +0100 |
commit | 351424e71900d8d03d1a98a3fe8d2fa6561c0da8 (patch) | |
tree | 141365708268da7a3c68ff62176d1e095cbdfcda /py/asmarm.c | |
parent | d792d9e49ea89aa8a742f57d70e5b59c9d68939e (diff) |
emitnative: Revamp ARM codegen compile after full-arg support refactors.
The code was apparently broken after 9988618e0e0f5c319e31b135d993e22efb593093
"py: Implement full func arg passing for native emitter.". This attempts to
propagate those changes to ARM emitter.
Diffstat (limited to 'py/asmarm.c')
-rw-r--r-- | py/asmarm.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/py/asmarm.c b/py/asmarm.c index 441e04c1b..2f7556f16 100644 --- a/py/asmarm.c +++ b/py/asmarm.c @@ -111,6 +111,10 @@ STATIC byte *asm_arm_get_cur_to_write_bytes(asm_arm_t *as, int num_bytes_to_writ } } +uint asm_arm_get_code_pos(asm_arm_t *as) { + return as->code_offset; +} + uint asm_arm_get_code_size(asm_arm_t *as) { return as->code_size; } @@ -245,6 +249,14 @@ void asm_arm_exit(asm_arm_t *as) { emit_al(as, asm_arm_op_pop(as->push_reglist | (1 << ASM_ARM_REG_PC))); } +void asm_arm_push(asm_arm_t *as, uint reglist) { + emit_al(as, asm_arm_op_push(reglist)); +} + +void asm_arm_pop(asm_arm_t *as, uint reglist) { + emit_al(as, asm_arm_op_pop(reglist)); +} + void asm_arm_label_assign(asm_arm_t *as, uint label) { assert(label < as->max_num_labels); if (as->pass < ASM_ARM_PASS_EMIT) { @@ -358,9 +370,9 @@ void asm_arm_asr_reg_reg(asm_arm_t *as, uint rd, uint rs) { emit_al(as, 0x1a00050 | (rd << 12) | (rs << 8) | rd); } -void asm_arm_ldr_reg_reg(asm_arm_t *as, uint rd, uint rn) { - // ldr rd, [rn] - emit_al(as, 0x5900000 | (rn << 16) | (rd << 12)); +void asm_arm_ldr_reg_reg(asm_arm_t *as, uint rd, uint rn, uint byte_offset) { + // ldr rd, [rn, #off] + emit_al(as, 0x5900000 | (rn << 16) | (rd << 12) | byte_offset); } void asm_arm_ldrh_reg_reg(asm_arm_t *as, uint rd, uint rn) { @@ -373,9 +385,9 @@ void asm_arm_ldrb_reg_reg(asm_arm_t *as, uint rd, uint rn) { emit_al(as, 0x5d00000 | (rn << 16) | (rd << 12)); } -void asm_arm_str_reg_reg(asm_arm_t *as, uint rd, uint rm) { - // str rd, [rm] - emit_al(as, 0x5800000 | (rm << 16) | (rd << 12)); +void asm_arm_str_reg_reg(asm_arm_t *as, uint rd, uint rm, uint byte_offset) { + // str rd, [rm, #off] + emit_al(as, 0x5800000 | (rm << 16) | (rd << 12) | byte_offset); } void asm_arm_strh_reg_reg(asm_arm_t *as, uint rd, uint rm) { |