diff options
author | Damien George <damien.p.george@gmail.com> | 2016-11-28 09:24:50 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-11-28 09:24:50 +1100 |
commit | 612599587bef71e1deca9a77a8e2e16e69b045de (patch) | |
tree | ea4dc739dbff37bc65a5e522411c0e472cdc11a4 /py/asmthumb.h | |
parent | 21e1703d37a645548aff6b833a49dfdfb3543c70 (diff) |
py: Factor out common code from assemblers into asmbase.[ch].
All assemblers should "derive" from mp_asm_base_t.
Diffstat (limited to 'py/asmthumb.h')
-rw-r--r-- | py/asmthumb.h | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/py/asmthumb.h b/py/asmthumb.h index 43d6c4286..c03b00da3 100644 --- a/py/asmthumb.h +++ b/py/asmthumb.h @@ -27,9 +27,7 @@ #define __MICROPY_INCLUDED_PY_ASMTHUMB_H__ #include "py/misc.h" - -#define ASM_THUMB_PASS_COMPUTE (1) -#define ASM_THUMB_PASS_EMIT (2) +#include "py/asmbase.h" #define ASM_THUMB_REG_R0 (0) #define ASM_THUMB_REG_R1 (1) @@ -64,24 +62,17 @@ #define ASM_THUMB_CC_GT (0xc) #define ASM_THUMB_CC_LE (0xd) -typedef struct _asm_thumb_t asm_thumb_t; +typedef struct _asm_thumb_t { + mp_asm_base_t base; + uint32_t push_reglist; + uint32_t stack_adjust; +} asm_thumb_t; -asm_thumb_t *asm_thumb_new(uint max_num_labels); -void asm_thumb_free(asm_thumb_t *as, bool free_code); -void asm_thumb_start_pass(asm_thumb_t *as, uint pass); void asm_thumb_end_pass(asm_thumb_t *as); -uint asm_thumb_get_code_pos(asm_thumb_t *as); -uint asm_thumb_get_code_size(asm_thumb_t *as); -void *asm_thumb_get_code(asm_thumb_t *as); void asm_thumb_entry(asm_thumb_t *as, int num_locals); void asm_thumb_exit(asm_thumb_t *as); -void asm_thumb_label_assign(asm_thumb_t *as, uint label); - -void asm_thumb_align(asm_thumb_t* as, uint align); -void asm_thumb_data(asm_thumb_t* as, uint bytesize, uint val); - // argument order follows ARM, in general dest is first // note there is a difference between movw and mov.w, and many others! |