summaryrefslogtreecommitdiffstatshomepage
path: root/py/asmthumb.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/asmthumb.c')
-rw-r--r--py/asmthumb.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/py/asmthumb.c b/py/asmthumb.c
index 14ba5a6fcd..7182d52fad 100644
--- a/py/asmthumb.c
+++ b/py/asmthumb.c
@@ -73,32 +73,21 @@ void asm_thumb_free(asm_thumb_t *as, bool free_code) {
}
void asm_thumb_start_pass(asm_thumb_t *as, uint pass) {
- as->pass = pass;
- as->code_offset = 0;
if (pass == ASM_THUMB_PASS_COMPUTE) {
memset(as->label_offsets, -1, as->max_num_labels * sizeof(mp_uint_t));
- }
-}
-
-void asm_thumb_end_pass(asm_thumb_t *as) {
- if (as->pass == ASM_THUMB_PASS_COMPUTE) {
- MP_PLAT_ALLOC_EXEC(as->code_offset, (void**) &as->code_base, &as->code_size);
- if(as->code_base == NULL) {
+ } else if (pass == ASM_THUMB_PASS_EMIT) {
+ MP_PLAT_ALLOC_EXEC(as->code_offset, (void**)&as->code_base, &as->code_size);
+ if (as->code_base == NULL) {
assert(0);
}
//printf("code_size: %u\n", as->code_size);
}
+ as->pass = pass;
+ as->code_offset = 0;
+}
- /*
- // check labels are resolved
- if (as->label != NULL)
- {
- int i;
- for (i = 0; i < as->label->len; ++i)
- if (g_array_index(as->label, Label, i).unresolved != NULL)
- return false;
- }
- */
+void asm_thumb_end_pass(asm_thumb_t *as) {
+ // could check labels are resolved...
}
// all functions must go through this one to emit bytes