kopia lustrzana https://github.com/micropython/micropython
py/emitinline: Move inline-asm align and data methods to compiler.
These are generic methods that don't depend on the architecture and so can be handled directly by the compiler.pull/2675/head
rodzic
a7fd786a1f
commit
dd53b12193
|
@ -34,6 +34,7 @@
|
|||
#include "py/emit.h"
|
||||
#include "py/compile.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/asmbase.h"
|
||||
|
||||
#if MICROPY_ENABLE_COMPILER
|
||||
|
||||
|
@ -3224,7 +3225,8 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
|
|||
return;
|
||||
}
|
||||
if (pass > MP_PASS_SCOPE) {
|
||||
EMIT_INLINE_ASM_ARG(align, MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[0]));
|
||||
mp_asm_base_align((mp_asm_base_t*)comp->emit_inline_asm,
|
||||
MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[0]));
|
||||
}
|
||||
} else if (op == MP_QSTR_data) {
|
||||
if (!(n_args >= 2 && MP_PARSE_NODE_IS_SMALL_INT(pn_arg[0]))) {
|
||||
|
@ -3238,7 +3240,8 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
|
|||
compile_syntax_error(comp, nodes[i], "'data' requires integer arguments");
|
||||
return;
|
||||
}
|
||||
EMIT_INLINE_ASM_ARG(data, bytesize, MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[j]));
|
||||
mp_asm_base_data((mp_asm_base_t*)comp->emit_inline_asm,
|
||||
bytesize, MP_PARSE_NODE_LEAF_SMALL_INT(pn_arg[j]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -266,8 +266,6 @@ typedef struct _emit_inline_asm_method_table_t {
|
|||
void (*end_pass)(emit_inline_asm_t *emit, mp_uint_t type_sig);
|
||||
mp_uint_t (*count_params)(emit_inline_asm_t *emit, mp_uint_t n_params, mp_parse_node_t *pn_params);
|
||||
bool (*label)(emit_inline_asm_t *emit, mp_uint_t label_num, qstr label_id);
|
||||
void (*align)(emit_inline_asm_t *emit, mp_uint_t align);
|
||||
void (*data)(emit_inline_asm_t *emit, mp_uint_t bytesize, mp_uint_t val);
|
||||
void (*op)(emit_inline_asm_t *emit, qstr op, mp_uint_t n_args, mp_parse_node_t *pn_args);
|
||||
} emit_inline_asm_method_table_t;
|
||||
|
||||
|
|
|
@ -130,14 +130,6 @@ STATIC bool emit_inline_thumb_label(emit_inline_asm_t *emit, mp_uint_t label_num
|
|||
return true;
|
||||
}
|
||||
|
||||
STATIC void emit_inline_thumb_align(emit_inline_asm_t *emit, mp_uint_t align) {
|
||||
mp_asm_base_align(&emit->as.base, align);
|
||||
}
|
||||
|
||||
STATIC void emit_inline_thumb_data(emit_inline_asm_t *emit, mp_uint_t bytesize, mp_uint_t val) {
|
||||
mp_asm_base_data(&emit->as.base, bytesize, val);
|
||||
}
|
||||
|
||||
typedef struct _reg_name_t { byte reg; byte name[3]; } reg_name_t;
|
||||
STATIC const reg_name_t reg_name_table[] = {
|
||||
{0, "r0\0"},
|
||||
|
@ -823,8 +815,6 @@ const emit_inline_asm_method_table_t emit_inline_thumb_method_table = {
|
|||
emit_inline_thumb_end_pass,
|
||||
emit_inline_thumb_count_params,
|
||||
emit_inline_thumb_label,
|
||||
emit_inline_thumb_align,
|
||||
emit_inline_thumb_data,
|
||||
emit_inline_thumb_op,
|
||||
};
|
||||
|
||||
|
|
|
@ -123,14 +123,6 @@ STATIC bool emit_inline_xtensa_label(emit_inline_asm_t *emit, mp_uint_t label_nu
|
|||
return true;
|
||||
}
|
||||
|
||||
STATIC void emit_inline_xtensa_align(emit_inline_asm_t *emit, mp_uint_t align) {
|
||||
mp_asm_base_align(&emit->as.base, align);
|
||||
}
|
||||
|
||||
STATIC void emit_inline_xtensa_data(emit_inline_asm_t *emit, mp_uint_t bytesize, mp_uint_t val) {
|
||||
mp_asm_base_data(&emit->as.base, bytesize, val);
|
||||
}
|
||||
|
||||
typedef struct _reg_name_t { byte reg; byte name[3]; } reg_name_t;
|
||||
STATIC const reg_name_t reg_name_table[] = {
|
||||
{0, "a0\0"},
|
||||
|
@ -355,8 +347,6 @@ const emit_inline_asm_method_table_t emit_inline_xtensa_method_table = {
|
|||
emit_inline_xtensa_end_pass,
|
||||
emit_inline_xtensa_count_params,
|
||||
emit_inline_xtensa_label,
|
||||
emit_inline_xtensa_align,
|
||||
emit_inline_xtensa_data,
|
||||
emit_inline_xtensa_op,
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue