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.
pull/1/head
Jun Wu 2019-05-06 00:31:11 -07:00 committed by Damien George
parent ced340d739
commit b152bbddd1
6 changed files with 11 additions and 8 deletions

View File

@ -31,7 +31,7 @@
#include "py/misc.h" #include "py/misc.h"
#include "py/asmbase.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) { void mp_asm_base_init(mp_asm_base_t *as, size_t max_num_labels) {
as->max_num_labels = 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

View File

@ -88,7 +88,7 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code,
#endif #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, 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 #if MICROPY_PERSISTENT_CODE_SAVE
uint16_t prelude_offset, uint16_t prelude_offset,

View File

@ -63,13 +63,13 @@ typedef struct _mp_raw_code_t {
size_t fun_data_len; size_t fun_data_len;
uint16_t n_obj; uint16_t n_obj;
uint16_t n_raw_code; uint16_t n_raw_code;
#if MICROPY_EMIT_NATIVE || MICROPY_EMIT_INLINE_ASM #if MICROPY_EMIT_MACHINE_CODE
uint16_t prelude_offset; uint16_t prelude_offset;
uint16_t n_qstr; uint16_t n_qstr;
mp_qstr_link_entry_t *qstr_link; mp_qstr_link_entry_t *qstr_link;
#endif #endif
#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 mp_uint_t type_sig; // for viper, compressed as 2-bit types; ret is MSB, then arg0, arg1, etc
#endif #endif
} mp_raw_code_t; } mp_raw_code_t;

View File

@ -329,6 +329,9 @@
// Convenience definition for whether any inline assembler emitter is enabled // Convenience definition for whether any inline assembler emitter is enabled
#define MICROPY_EMIT_INLINE_ASM (MICROPY_EMIT_INLINE_THUMB || MICROPY_EMIT_INLINE_XTENSA) #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 */ /* Compiler configuration */

View File

@ -77,7 +77,7 @@ mp_uint_t mp_native_from_obj(mp_obj_t obj, mp_uint_t type) {
#endif #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 // 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) { mp_obj_t mp_native_to_obj(mp_uint_t val, mp_uint_t type) {

View File

@ -410,13 +410,13 @@ class RawCode(object):
print(' .fun_data_len = %u,' % len(self.bytecode)) print(' .fun_data_len = %u,' % len(self.bytecode))
print(' .n_obj = %u,' % len(self.objs)) print(' .n_obj = %u,' % len(self.objs))
print(' .n_raw_code = %u,' % len(self.raw_codes)) 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(' .prelude_offset = %u,' % self.prelude_offset)
print(' .n_qstr = %u,' % len(qstr_links)) print(' .n_qstr = %u,' % len(qstr_links))
print(' .qstr_link = NULL,') # TODO print(' .qstr_link = NULL,') # TODO
print(' #endif') print(' #endif')
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(' .type_sig = %u,' % type_sig)
print(' #endif') print(' #endif')
print('};') print('};')