aboutsummaryrefslogtreecommitdiff
path: root/py/emit.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-10-27 22:41:21 +1100
committerDamien George <damien.p.george@gmail.com>2018-10-28 00:38:18 +1100
commite328a5d4693f9e4a03b296e7a9a7af6660d99515 (patch)
tree178e4fbab5adbd14fb3c03e9754f044699626fc8 /py/emit.h
parentba92c798414d5dcf76ac7bfd153884873cceca08 (diff)
py/scope: Optimise scope_find_or_add_id to not need "added" arg.
Taking the address of a local variable is mildly expensive, in code size and stack usage. So optimise scope_find_or_add_id() to not need to take a pointer to the "added" variable, and instead take the kind to use for newly added identifiers.
Diffstat (limited to 'py/emit.h')
-rw-r--r--py/emit.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/py/emit.h b/py/emit.h
index 84972dd69..3c42bdf14 100644
--- a/py/emit.h
+++ b/py/emit.h
@@ -159,7 +159,10 @@ typedef struct _emit_method_table_t {
int mp_native_type_from_qstr(qstr qst);
-void mp_emit_common_get_id_for_load(scope_t *scope, qstr qst);
+static inline void mp_emit_common_get_id_for_load(scope_t *scope, qstr qst) {
+ scope_find_or_add_id(scope, qst, ID_INFO_KIND_GLOBAL_IMPLICIT);
+}
+
void mp_emit_common_get_id_for_modification(scope_t *scope, qstr qst);
void mp_emit_common_id_op(emit_t *emit, const mp_emit_method_table_id_ops_t *emit_method_table, scope_t *scope, qstr qst);