py: Define EMIT_MACHINE_CODE as EMIT_NATIVE || EMIT_INLINE_ASM.
The combination MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM is used in many places, so define a new macro for it.
This commit is contained in:
parent
ced340d739
commit
b152bbddd1
@ -31,7 +31,7 @@
|
||||
#include "py/misc.h"
|
||||
#include "py/asmbase.h"
|
||||
|
||||
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||
#if MICROPY_EMIT_MACHINE_CODE
|
||||
|
||||
void mp_asm_base_init(mp_asm_base_t *as, size_t max_num_labels) {
|
||||
as->max_num_labels = max_num_labels;
|
||||
@ -99,4 +99,4 @@ void mp_asm_base_data(mp_asm_base_t* as, unsigned int bytesize, uintptr_t val) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||
#endif // MICROPY_EMIT_MACHINE_CODE
|
||||
|
@ -88,7 +88,7 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||
#if MICROPY_EMIT_MACHINE_CODE
|
||||
void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len, const mp_uint_t *const_table,
|
||||
#if MICROPY_PERSISTENT_CODE_SAVE
|
||||
uint16_t prelude_offset,
|
||||
|
@ -63,13 +63,13 @@ typedef struct _mp_raw_code_t {
|
||||
size_t fun_data_len;
|
||||
uint16_t n_obj;
|
||||
uint16_t n_raw_code;
|
||||
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||
#if MICROPY_EMIT_MACHINE_CODE
|
||||
uint16_t prelude_offset;
|
||||
uint16_t n_qstr;
|
||||
mp_qstr_link_entry_t *qstr_link;
|
||||
#endif
|
||||
#endif
|
||||
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||
#if MICROPY_EMIT_MACHINE_CODE
|
||||
mp_uint_t type_sig; // for viper, compressed as 2-bit types; ret is MSB, then arg0, arg1, etc
|
||||
#endif
|
||||
} mp_raw_code_t;
|
||||
|
@ -329,6 +329,9 @@
|
||||
// Convenience definition for whether any inline assembler emitter is enabled
|
||||
#define MICROPY_EMIT_INLINE_ASM (MICROPY_EMIT_INLINE_THUMB || MICROPY_EMIT_INLINE_XTENSA)
|
||||
|
||||
// Convenience definition for whether any native or inline assembler emitter is enabled
|
||||
#define MICROPY_EMIT_MACHINE_CODE (MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Compiler configuration */
|
||||
|
||||
|
@ -77,7 +77,7 @@ mp_uint_t mp_native_from_obj(mp_obj_t obj, mp_uint_t type) {
|
||||
|
||||
#endif
|
||||
|
||||
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM
|
||||
#if MICROPY_EMIT_MACHINE_CODE
|
||||
|
||||
// convert a native value to a MicroPython object based on type
|
||||
mp_obj_t mp_native_to_obj(mp_uint_t val, mp_uint_t type) {
|
||||
|
@ -410,13 +410,13 @@ class RawCode(object):
|
||||
print(' .fun_data_len = %u,' % len(self.bytecode))
|
||||
print(' .n_obj = %u,' % len(self.objs))
|
||||
print(' .n_raw_code = %u,' % len(self.raw_codes))
|
||||
print(' #if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM')
|
||||
print(' #if MICROPY_EMIT_MACHINE_CODE')
|
||||
print(' .prelude_offset = %u,' % self.prelude_offset)
|
||||
print(' .n_qstr = %u,' % len(qstr_links))
|
||||
print(' .qstr_link = NULL,') # TODO
|
||||
print(' #endif')
|
||||
print(' #endif')
|
||||
print(' #if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM')
|
||||
print(' #if MICROPY_EMIT_MACHINE_CODE')
|
||||
print(' .type_sig = %u,' % type_sig)
|
||||
print(' #endif')
|
||||
print('};')
|
||||
|
Loading…
Reference in New Issue
Block a user