Commit 5bfb7599 authored by Damien's avatar Damien
Browse files

Incorporate emit_thumb into new emit framework.

parent 6cdd3af6
CC = gcc
CFLAGS = -Wall -ansi -std=gnu99 -Os -DEMIT_ENABLE_CPY -DEMIT_ENABLE_X64 #-DNDEBUG
CFLAGS = -Wall -ansi -std=gnu99 -Os -DEMIT_ENABLE_CPY -DEMIT_ENABLE_X64 -DEMIT_ENABLE_THUMB #-DNDEBUG
LDFLAGS =
SRC = \
......
......@@ -28,7 +28,7 @@ struct _asm_thumb_t {
uint stack_adjust;
};
asm_thumb_t *asm_thumb_new() {
asm_thumb_t *asm_thumb_new(uint max_num_labels) {
asm_thumb_t *as;
as = m_new(asm_thumb_t, 1);
......@@ -36,7 +36,8 @@ asm_thumb_t *asm_thumb_new() {
as->code_offset = 0;
as->code_size = 0;
as->code_base = NULL;
as->label_offsets = NULL;
as->max_num_labels = max_num_labels;
as->label_offsets = m_new(int, max_num_labels);
as->num_locals = 0;
return as;
......@@ -65,23 +66,13 @@ void asm_thumb_start_pass(asm_thumb_t *as, int pass) {
as->pass = pass;
as->code_offset = 0;
as->next_label = 1;
if (pass == ASM_THUMB_PASS_1) {
as->max_num_labels = 0;
} else {
if (pass == ASM_THUMB_PASS_2) {
memset(as->label_offsets, -1, as->max_num_labels * sizeof(int));
}
if (pass == ASM_THUMB_PASS_2) {
memset(as->label_offsets, -1, as->max_num_labels * sizeof(int));
}
}
void asm_thumb_end_pass(asm_thumb_t *as) {
if (as->pass == ASM_THUMB_PASS_1) {
// calculate number of labels need
if (as->next_label > as->max_num_labels) {
as->max_num_labels = as->next_label;
}
as->label_offsets = m_new(int, as->max_num_labels);
} else if (as->pass == ASM_THUMB_PASS_2) {
if (as->pass == ASM_THUMB_PASS_2) {
// calculate size of code in bytes
as->code_size = as->code_offset;
as->code_base = m_new(byte, as->code_size);
......@@ -226,20 +217,23 @@ int asm_thumb_label_new(asm_thumb_t *as) {
}
void asm_thumb_label_assign(asm_thumb_t *as, int label) {
if (as->pass > ASM_THUMB_PASS_1) {
assert(label < as->max_num_labels);
if (as->pass == ASM_THUMB_PASS_2) {
// assign label offset
assert(as->label_offsets[label] == -1);
as->label_offsets[label] = as->code_offset;
} else if (as->pass == ASM_THUMB_PASS_3) {
// ensure label offset has not changed from PASS_2 to PASS_3
//printf("l%d: (at %d=%ld)\n", label, as->label_offsets[label], as->code_offset);
assert(as->label_offsets[label] == as->code_offset);
}
assert(label < as->max_num_labels);
if (as->pass == ASM_THUMB_PASS_2) {
// assign label offset
assert(as->label_offsets[label] == -1);
as->label_offsets[label] = as->code_offset;
} else if (as->pass == ASM_THUMB_PASS_3) {
// ensure label offset has not changed from PASS_2 to PASS_3
//printf("l%d: (at %d=%ld)\n", label, as->label_offsets[label], as->code_offset);
assert(as->label_offsets[label] == as->code_offset);
}
}
static int get_label_dest(asm_thumb_t *as, int label) {
assert(label < as->max_num_labels);
return as->label_offsets[label];
}
// the i8 value will be zero extended into the r32 register!
void asm_thumb_mov_reg_i8(asm_thumb_t *as, uint rlo_dest, int i8) {
assert(rlo_dest < REG_R8);
......@@ -339,23 +333,21 @@ void asm_thumb_ite_ge(asm_thumb_t *as) {
#define OP_BW_LO(byte_offset) (0xb800 | (((byte_offset) >> 1) & 0x07ff))
void asm_thumb_b_label(asm_thumb_t *as, int label) {
if (as->pass > ASM_THUMB_PASS_1) {
int dest = as->label_offsets[label];
int rel = dest - as->code_offset;
rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
if (dest >= 0 && rel <= -4) {
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 12 bit relative jump
if (SIGNED_FIT12(rel)) {
asm_thumb_write_op16(as, OP_B(rel));
} else {
goto large_jump;
}
int dest = get_label_dest(as, label);
int rel = dest - as->code_offset;
rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
if (dest >= 0 && rel <= -4) {
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 12 bit relative jump
if (SIGNED_FIT12(rel)) {
asm_thumb_write_op16(as, OP_B(rel));
} else {
// is a forwards jump, so need to assume it's large
large_jump:
asm_thumb_write_op32(as, OP_BW_HI(rel), OP_BW_LO(rel));
goto large_jump;
}
} else {
// is a forwards jump, so need to assume it's large
large_jump:
asm_thumb_write_op32(as, OP_BW_HI(rel), OP_BW_LO(rel));
}
}
......@@ -372,23 +364,21 @@ void asm_thumb_cmp_reg_bz_label(asm_thumb_t *as, uint rlo, int label) {
asm_thumb_write_op16(as, OP_CMP_REG_IMM(rlo, 0));
// branch if equal
if (as->pass > ASM_THUMB_PASS_1) {
int dest = as->label_offsets[label];
int rel = dest - as->code_offset;
rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
if (dest >= 0 && rel <= -4) {
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 12 bit relative jump
if (SIGNED_FIT9(rel)) {
asm_thumb_write_op16(as, OP_BEQ(rel));
} else {
goto large_jump;
}
int dest = get_label_dest(as, label);
int rel = dest - as->code_offset;
rel -= 4; // account for instruction prefetch, PC is 4 bytes ahead of this instruction
if (dest >= 0 && rel <= -4) {
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 12 bit relative jump
if (SIGNED_FIT9(rel)) {
asm_thumb_write_op16(as, OP_BEQ(rel));
} else {
// is a forwards jump, so need to assume it's large
large_jump:
asm_thumb_write_op32(as, OP_BEQW_HI(rel), OP_BEQW_LO(rel));
goto large_jump;
}
} else {
// is a forwards jump, so need to assume it's large
large_jump:
asm_thumb_write_op32(as, OP_BEQW_HI(rel), OP_BEQW_LO(rel));
}
}
......
......@@ -28,7 +28,7 @@
typedef struct _asm_thumb_t asm_thumb_t;
asm_thumb_t *asm_thumb_new();
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, int pass);
void asm_thumb_end_pass(asm_thumb_t *as);
......
......@@ -30,6 +30,7 @@ typedef enum {
#define EMIT_OPT_NONE (0)
#define EMIT_OPT_BYTE_CODE (1)
#define EMIT_OPT_NATIVE_PYTHON (2)
#define EMIT_OPT_ASM_THUMB (3)
typedef struct _compiler_t {
qstr qstr___class__;
......@@ -41,6 +42,7 @@ typedef struct _compiler_t {
qstr qstr_assertion_error;
qstr qstr_micropython;
qstr qstr_native;
qstr qstr_asm_thumb;
pass_kind_t pass;
......@@ -759,6 +761,8 @@ static bool compile_built_in_decorator(compiler_t *comp, int name_len, py_parse_
qstr attr = PY_PARSE_NODE_LEAF_ARG(name_nodes[1]);
if (attr == comp->qstr_native) {
*emit_options = EMIT_OPT_NATIVE_PYTHON;
} else if (attr == comp->qstr_asm_thumb) {
*emit_options = EMIT_OPT_ASM_THUMB;
} else {
printf("SyntaxError: invalid micropython decorator\n");
}
......@@ -2551,6 +2555,7 @@ void py_compile(py_parse_node_t pn) {
comp->qstr_assertion_error = qstr_from_str_static("AssertionError");
comp->qstr_micropython = qstr_from_str_static("micropython");
comp->qstr_native = qstr_from_str_static("native");
comp->qstr_asm_thumb = qstr_from_str_static("asm_thumb");
comp->max_num_labels = 0;
comp->break_label = 0;
......@@ -2588,6 +2593,9 @@ void py_compile(py_parse_node_t pn) {
comp->emit_method_table = &emit_x64_method_table;
break;
//case EMIT_OPT_ASM_THUMB:
//if (em
default:
if (emit_bc == NULL) {
emit_bc = emit_bc_new(comp->max_num_labels);
......
......@@ -14,7 +14,7 @@
#include "emit.h"
#include "asmthumb.h"
#ifdef EMIT_DO_THUMB
#ifdef EMIT_ENABLE_THUMB
#define REG_LOCAL_1 (REG_R4)
#define REG_LOCAL_2 (REG_R5)
......@@ -28,7 +28,7 @@ typedef enum {
NEED_TO_PUSH_I32,
} need_to_push_t;
struct _emitter_t {
struct _emit_t {
int pass;
int stack_start;
int stack_size;
......@@ -43,14 +43,18 @@ struct _emitter_t {
bool do_native_types;
};
emitter_t *emit_new() {
emitter_t *emit = m_new(emitter_t, 1);
emit->as = asm_thumb_new();
emit->do_native_types = true;
emit_t *emit_thumb_new(uint max_num_labels) {
emit_t *emit = m_new(emit_t, 1);
emit->as = asm_thumb_new(max_num_labels);
emit->do_native_types = false;
return emit;
}
void emit_start_pass(emitter_t *emit, pass_kind_t pass, scope_t *scope) {
static void emit_thumb_set_native_types(emit_t *emit, bool do_native_types) {
emit->do_native_types = do_native_types;
}
static void emit_thumb_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
emit->pass = pass;
emit->stack_start = 0;
emit->stack_size = 0;
......@@ -91,7 +95,7 @@ void emit_start_pass(emitter_t *emit, pass_kind_t pass, scope_t *scope) {
asm_thumb_mov_reg_i32(emit->as, REG_R7, (machine_uint_t)rt_fun_table);
}
void emit_end_pass(emitter_t *emit) {
static void emit_thumb_end_pass(emit_t *emit) {
if (!emit->last_emit_was_return_value) {
asm_thumb_exit(emit->as);
}
......@@ -108,19 +112,19 @@ void emit_end_pass(emitter_t *emit) {
}
}
bool emit_last_emit_was_return_value(emitter_t *emit) {
static bool emit_thumb_last_emit_was_return_value(emit_t *emit) {
return emit->last_emit_was_return_value;
}
int emit_get_stack_size(emitter_t *emit) {
static int emit_thumb_get_stack_size(emit_t *emit) {
return emit->stack_size;
}
void emit_set_stack_size(emitter_t *emit, int size) {
static void emit_thumb_set_stack_size(emit_t *emit, int size) {
emit->stack_size = size;
}
static void adjust_stack(emitter_t *emit, int stack_size_delta) {
static void adjust_stack(emit_t *emit, int stack_size_delta) {
emit->stack_size += stack_size_delta;
assert(emit->stack_size >= 0);
if (emit->pass > PASS_1 && emit->stack_size > emit->scope->stack_size) {
......@@ -128,7 +132,7 @@ static void adjust_stack(emitter_t *emit, int stack_size_delta) {
}
}
static void stack_settle(emitter_t *emit) {
static void stack_settle(emit_t *emit) {
switch (emit->need_to_push) {
case NEED_TO_PUSH_NOTHING:
break;
......@@ -147,17 +151,17 @@ static void stack_settle(emitter_t *emit) {
emit->need_to_push = NEED_TO_PUSH_NOTHING;
}
static void emit_pre_raw(emitter_t *emit, int stack_size_delta) {
static void emit_pre_raw(emit_t *emit, int stack_size_delta) {
adjust_stack(emit, stack_size_delta);
emit->last_emit_was_return_value = false;
}
static void emit_pre(emitter_t *emit) {
static void emit_pre(emit_t *emit) {
stack_settle(emit);
emit_pre_raw(emit, 0);
}
static void emit_pre_pop_reg(emitter_t *emit, int reg_dest) {
static void emit_pre_pop_reg(emit_t *emit, int reg_dest) {
switch (emit->need_to_push) {
case NEED_TO_PUSH_NOTHING:
asm_thumb_mov_reg_local(emit->as, reg_dest, emit->stack_start + emit->stack_size - 1);
......@@ -179,47 +183,47 @@ static void emit_pre_pop_reg(emitter_t *emit, int reg_dest) {
emit->need_to_push = NEED_TO_PUSH_NOTHING;
}
static void emit_pre_pop_reg_reg(emitter_t *emit, int rega, int regb) {
static void emit_pre_pop_reg_reg(emit_t *emit, int rega, int regb) {
emit_pre_pop_reg(emit, rega);
asm_thumb_mov_reg_local(emit->as, regb, emit->stack_start + emit->stack_size - 1);
adjust_stack(emit, -1);
}
static void emit_pre_pop_reg_reg_reg(emitter_t *emit, int rega, int regb, int regc) {
static void emit_pre_pop_reg_reg_reg(emit_t *emit, int rega, int regb, int regc) {
emit_pre_pop_reg(emit, rega);
asm_thumb_mov_reg_local(emit->as, regb, emit->stack_start + emit->stack_size - 1);
asm_thumb_mov_reg_local(emit->as, regc, emit->stack_start + emit->stack_size - 2);
adjust_stack(emit, -2);
}
static void emit_post(emitter_t *emit) {
static void emit_post(emit_t *emit) {
}
static void emit_post_push_reg(emitter_t *emit, int reg) {
static void emit_post_push_reg(emit_t *emit, int reg) {
emit->need_to_push = NEED_TO_PUSH_REG;
emit->last_reg = reg;
}
static void emit_post_push_i32(emitter_t *emit, int32_t i32) {
static void emit_post_push_i32(emit_t *emit, int32_t i32) {
emit->need_to_push = NEED_TO_PUSH_I32;
emit->last_i32 = i32;
}
static void emit_post_push_reg_reg(emitter_t *emit, int rega, int regb) {
static void emit_post_push_reg_reg(emit_t *emit, int rega, int regb) {
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size, rega);
emit->need_to_push = NEED_TO_PUSH_REG;
emit->last_reg = regb;
adjust_stack(emit, 1);
}
static void emit_post_push_reg_reg_reg(emitter_t *emit, int rega, int regb, int regc) {
static void emit_post_push_reg_reg_reg(emit_t *emit, int rega, int regb, int regc) {
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size, rega);
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size + 1, regb);
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size + 2, regc);
adjust_stack(emit, 3);
}
static void emit_post_push_reg_reg_reg_reg(emitter_t *emit, int rega, int regb, int regc, int regd) {
static void emit_post_push_reg_reg_reg_reg(emit_t *emit, int rega, int regb, int regc, int regd) {
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size, rega);
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size + 1, regb);
asm_thumb_mov_local_reg(emit->as, emit->stack_start + emit->stack_size + 2, regc);
......@@ -227,44 +231,52 @@ static void emit_post_push_reg_reg_reg_reg(emitter_t *emit, int rega, int regb,
adjust_stack(emit, 4);
}
static void emit_get_stack_pointer_to_reg_for_pop(emitter_t *emit, int reg_dest, int n_pop) {
static void emit_get_stack_pointer_to_reg_for_pop(emit_t *emit, int reg_dest, int n_pop) {
asm_thumb_mov_reg_local_addr(emit->as, reg_dest, emit->stack_start + emit->stack_size - 1);
adjust_stack(emit, -n_pop);
}
static void emit_get_stack_pointer_to_reg_for_push(emitter_t *emit, int reg_dest, int n_push) {
static void emit_get_stack_pointer_to_reg_for_push(emit_t *emit, int reg_dest, int n_push) {
asm_thumb_mov_reg_local_addr(emit->as, reg_dest, emit->stack_start + emit->stack_size + n_push - 1);
adjust_stack(emit, n_push);
}
static void emit_call(emitter_t *emit, rt_fun_kind_t fun_kind) {
static void emit_call(emit_t *emit, rt_fun_kind_t fun_kind) {
asm_thumb_bl_ind(emit->as, rt_fun_table[fun_kind], fun_kind, REG_R3);
}
static void emit_call_with_i32_arg(emitter_t *emit, rt_fun_kind_t fun_kind, int32_t arg_val, int arg_reg) {
static void emit_call_with_i32_arg(emit_t *emit, rt_fun_kind_t fun_kind, int32_t arg_val, int arg_reg) {
asm_thumb_mov_reg_i32_optimised(emit->as, arg_reg, arg_val);
asm_thumb_bl_ind(emit->as, rt_fun_table[fun_kind], fun_kind, REG_R3);
}
int emit_label_new(emitter_t *emit) {
return asm_thumb_label_new(emit->as);
static void emit_thumb_load_id(emit_t *emit, qstr qstr) {
emit_common_load_id(emit, &emit_thumb_method_table, emit->scope, qstr);
}
static void emit_thumb_store_id(emit_t *emit, qstr qstr) {
emit_common_store_id(emit, &emit_thumb_method_table, emit->scope, qstr);
}
void emit_label_assign(emitter_t *emit, int l) {
static void emit_thumb_delete_id(emit_t *emit, qstr qstr) {
emit_common_delete_id(emit, &emit_thumb_method_table, emit->scope, qstr);
}
static void emit_thumb_label_assign(emit_t *emit, int l) {
asm_thumb_label_assign(emit->as, l);
}
void emit_import_name(emitter_t *emit, qstr qstr) {
static void emit_thumb_import_name(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_import_from(emitter_t *emit, qstr qstr) {
static void emit_thumb_import_from(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_import_star(emitter_t *emit) {
static void emit_thumb_import_star(emit_t *emit) {
assert(0);
}
void emit_load_const_tok(emitter_t *emit, py_token_kind_t tok) {
static void emit_thumb_load_const_tok(emit_t *emit, py_token_kind_t tok) {
emit_pre(emit);
py_obj_t o;
switch (tok) {
......@@ -276,7 +288,7 @@ void emit_load_const_tok(emitter_t *emit, py_token_kind_t tok) {
emit_post_push_i32(emit, (machine_uint_t)o);
}
void emit_load_const_small_int(emitter_t *emit, int arg) {
static void emit_thumb_load_const_small_int(emit_t *emit, int arg) {
emit_pre(emit);
if (emit->do_native_types) {
emit_post_push_i32(emit, arg);
......@@ -285,42 +297,42 @@ void emit_load_const_small_int(emitter_t *emit, int arg) {
}
}
void emit_load_const_int(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_const_int(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_load_const_dec(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_const_dec(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_load_const_id(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_const_id(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_load_const_str(emitter_t *emit, qstr qstr, bool bytes) {
static void emit_thumb_load_const_str(emit_t *emit, qstr qstr, bool bytes) {
emit_pre(emit);
emit_call_with_i32_arg(emit, RT_F_LOAD_CONST_STR, qstr, REG_ARG_1);
emit_post_push_reg(emit, REG_RET);
}
void emit_load_const_verbatim_start(emitter_t *emit) {
static void emit_thumb_load_const_verbatim_start(emit_t *emit) {
assert(0);
}
void emit_load_const_verbatim_int(emitter_t *emit, int val) {
static void emit_thumb_load_const_verbatim_int(emit_t *emit, int val) {
assert(0);
}
void emit_load_const_verbatim_str(emitter_t *emit, const char *str) {
static void emit_thumb_load_const_verbatim_str(emit_t *emit, const char *str) {
assert(0);
}
void emit_load_const_verbatim_strn(emitter_t *emit, const char *str, int len) {
static void emit_thumb_load_const_verbatim_strn(emit_t *emit, const char *str, int len) {
assert(0);
}
void emit_load_const_verbatim_quoted_str(emitter_t *emit, qstr qstr, bool bytes) {
static void emit_thumb_load_const_verbatim_quoted_str(emit_t *emit, qstr qstr, bool bytes) {
assert(0);
}
void emit_load_const_verbatim_end(emitter_t *emit) {
static void emit_thumb_load_const_verbatim_end(emit_t *emit) {
assert(0);
}
void emit_load_fast(emitter_t *emit, qstr qstr, int local_num) {
static void emit_thumb_load_fast(emit_t *emit, qstr qstr, int local_num) {
emit_pre(emit);
if (local_num == 0) {
emit_post_push_reg(emit, REG_LOCAL_1);
......@@ -334,42 +346,42 @@ void emit_load_fast(emitter_t *emit, qstr qstr, int local_num) {
}
}
void emit_load_name(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_name(emit_t *emit, qstr qstr) {
emit_pre(emit);
emit_call_with_i32_arg(emit, RT_F_LOAD_NAME, qstr, REG_ARG_1);
emit_post_push_reg(emit, REG_RET);
}
void emit_load_global(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_global(emit_t *emit, qstr qstr) {
emit_pre(emit);
emit_call_with_i32_arg(emit, RT_F_LOAD_GLOBAL, qstr, REG_ARG_1);
emit_post_push_reg(emit, REG_RET);
}
void emit_load_deref(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_deref(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_load_closure(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_closure(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_load_attr(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_attr(emit_t *emit, qstr qstr) {
emit_pre_pop_reg(emit, REG_ARG_1); // arg1 = base
emit_call_with_i32_arg(emit, RT_F_LOAD_ATTR, qstr, REG_ARG_2); // arg2 = attribute name
emit_post_push_reg(emit, REG_RET);
}
void emit_load_method(emitter_t *emit, qstr qstr) {
static void emit_thumb_load_method(emit_t *emit, qstr qstr) {
emit_pre_pop_reg(emit, REG_ARG_1); // arg1 = base
emit_get_stack_pointer_to_reg_for_push(emit, REG_ARG_3, 2); // arg3 = dest ptr
emit_call_with_i32_arg(emit, RT_F_LOAD_METHOD, qstr, REG_ARG_2); // arg2 = method name
}
void emit_load_build_class(emitter_t *emit) {
static void emit_thumb_load_build_class(emit_t *emit) {
assert(0);
} // basically load __build_class__ from builtins
void emit_store_fast(emitter_t *emit, qstr qstr, int local_num) {
static void emit_thumb_store_fast(emit_t *emit, qstr qstr, int local_num) {
if (local_num == 0) {
emit_pre_pop_reg(emit, REG_LOCAL_1);
} else if (local_num == 1) {
......@@ -383,81 +395,81 @@ void emit_store_fast(emitter_t *emit, qstr qstr, int local_num) {
emit_post(emit);
}
void emit_store_name(emitter_t *emit, qstr qstr) {
static void emit_thumb_store_name(emit_t *emit, qstr qstr) {
emit_pre_pop_reg(emit, REG_ARG_2);
emit_call_with_i32_arg(emit, RT_F_STORE_NAME, qstr, REG_ARG_1); // arg1 = name
emit_post(emit);
}
void emit_store_global(emitter_t *emit, qstr qstr) {
static void emit_thumb_store_global(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_store_deref(emitter_t *emit, qstr qstr) {
static void emit_thumb_store_deref(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_store_attr(emitter_t *emit, qstr qstr) {
static void emit_thumb_store_attr(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_store_locals(emitter_t *emit) {
static void emit_thumb_store_locals(emit_t *emit) {
assert(0);
}
void emit_store_subscr(emitter_t *emit) {
static void emit_thumb_store_subscr(emit_t *emit) {
emit_pre_pop_reg_reg_reg(emit, REG_ARG_2, REG_ARG_1, REG_ARG_3); // index, base, value to store
emit_call(emit, RT_F_STORE_SUBSCR);
}
void emit_delete_fast(emitter_t *emit, qstr qstr, int local_num) {
static void emit_thumb_delete_fast(emit_t *emit, qstr qstr, int local_num) {
assert(0);
}
void emit_delete_name(emitter_t *emit, qstr qstr) {
static void emit_thumb_delete_name(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_delete_global(emitter_t *emit, qstr qstr) {
static void emit_thumb_delete_global(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_delete_deref(emitter_t *emit, qstr qstr) {
static void emit_thumb_delete_deref(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_delete_attr(emitter_t *emit, qstr qstr) {
static void emit_thumb_delete_attr(emit_t *emit, qstr qstr) {
assert(0);
}
void emit_delete_subscr(emitter_t *emit) {
static void emit_thumb_delete_subscr(emit_t *emit) {
assert(0);
}
void emit_dup_top(emitter_t *emit) {
static void emit_thumb_dup_top(emit_t *emit) {
emit_pre_pop_reg(emit, REG_R0);
emit_post_push_reg_reg(emit, REG_R0, REG_R0);
}
void emit_dup_top_two(emitter_t *emit) {
static void emit_thumb_dup_top_two(emit_t *</