mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py/emit: Combine import from/name/star into one emit function.
Change in code size is:
bare-arm: +4
minimal x86: -88
unix x64: -456
unix nanbox: -88
stm32: -44
cc3200: +0
esp8266: -104
esp32: +8
This commit is contained in:
13
py/emit.h
13
py/emit.h
@@ -63,6 +63,11 @@ typedef enum {
|
||||
#define MP_EMIT_IDOP_GLOBAL_NAME (0)
|
||||
#define MP_EMIT_IDOP_GLOBAL_GLOBAL (1)
|
||||
|
||||
// Kind for emit->import()
|
||||
#define MP_EMIT_IMPORT_NAME (0)
|
||||
#define MP_EMIT_IMPORT_FROM (1)
|
||||
#define MP_EMIT_IMPORT_STAR (2)
|
||||
|
||||
// Kind for emit->subscr()
|
||||
#define MP_EMIT_SUBSCR_LOAD (0)
|
||||
#define MP_EMIT_SUBSCR_STORE (1)
|
||||
@@ -102,9 +107,7 @@ typedef struct _emit_method_table_t {
|
||||
mp_emit_method_table_id_ops_t delete_id;
|
||||
|
||||
void (*label_assign)(emit_t *emit, mp_uint_t l);
|
||||
void (*import_name)(emit_t *emit, qstr qst);
|
||||
void (*import_from)(emit_t *emit, qstr qst);
|
||||
void (*import_star)(emit_t *emit);
|
||||
void (*import)(emit_t *emit, qstr qst, int kind);
|
||||
void (*load_const_tok)(emit_t *emit, mp_token_kind_t tok);
|
||||
void (*load_const_small_int)(emit_t *emit, mp_int_t arg);
|
||||
void (*load_const_str)(emit_t *emit, qstr qst);
|
||||
@@ -205,9 +208,7 @@ void mp_emit_bc_delete_local(emit_t *emit, qstr qst, mp_uint_t local_num, int ki
|
||||
void mp_emit_bc_delete_global(emit_t *emit, qstr qst, int kind);
|
||||
|
||||
void mp_emit_bc_label_assign(emit_t *emit, mp_uint_t l);
|
||||
void mp_emit_bc_import_name(emit_t *emit, qstr qst);
|
||||
void mp_emit_bc_import_from(emit_t *emit, qstr qst);
|
||||
void mp_emit_bc_import_star(emit_t *emit);
|
||||
void mp_emit_bc_import(emit_t *emit, qstr qst, int kind);
|
||||
void mp_emit_bc_load_const_tok(emit_t *emit, mp_token_kind_t tok);
|
||||
void mp_emit_bc_load_const_small_int(emit_t *emit, mp_int_t arg);
|
||||
void mp_emit_bc_load_const_str(emit_t *emit, qstr qst);
|
||||
|
||||
Reference in New Issue
Block a user