diff --git a/py/emit.h b/py/emit.h index 34c6cfd845e349318352d0a1e0999c86b3ba93ea..2a5da8e8e3933467f427fcf7b8e8287d50b1bb64 100644 --- a/py/emit.h +++ b/py/emit.h @@ -156,8 +156,6 @@ typedef struct _emit_method_table_t { void (*end_except_handler)(emit_t *emit); } emit_method_table_t; -int mp_native_type_from_qstr(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); } diff --git a/py/emitnative.c b/py/emitnative.c index ffdebd643234543105204a5bc9ae7274b95567d4..aa5ec4935d018f963755588d8f22e3564220e458 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -136,20 +136,6 @@ typedef enum { VTYPE_BUILTIN_CAST = 0x70 | MP_NATIVE_TYPE_OBJ, } vtype_kind_t; -int mp_native_type_from_qstr(qstr qst) { - switch (qst) { - case MP_QSTR_object: return MP_NATIVE_TYPE_OBJ; - case MP_QSTR_bool: return MP_NATIVE_TYPE_BOOL; - case MP_QSTR_int: return MP_NATIVE_TYPE_INT; - case MP_QSTR_uint: return MP_NATIVE_TYPE_UINT; - case MP_QSTR_ptr: return MP_NATIVE_TYPE_PTR; - case MP_QSTR_ptr8: return MP_NATIVE_TYPE_PTR8; - case MP_QSTR_ptr16: return MP_NATIVE_TYPE_PTR16; - case MP_QSTR_ptr32: return MP_NATIVE_TYPE_PTR32; - default: return -1; - } -} - STATIC qstr vtype_to_qstr(vtype_kind_t vtype) { switch (vtype) { case VTYPE_PYOBJ: return MP_QSTR_object; diff --git a/py/nativeglue.c b/py/nativeglue.c index b7031a5d272338cc6220446328d0cbf6bf650671..6e5bd6ce2e487fe22f7c0fc4aafb973820c28f17 100644 --- a/py/nativeglue.c +++ b/py/nativeglue.c @@ -41,6 +41,20 @@ #if MICROPY_EMIT_NATIVE +int mp_native_type_from_qstr(qstr qst) { + switch (qst) { + case MP_QSTR_object: return MP_NATIVE_TYPE_OBJ; + case MP_QSTR_bool: return MP_NATIVE_TYPE_BOOL; + case MP_QSTR_int: return MP_NATIVE_TYPE_INT; + case MP_QSTR_uint: return MP_NATIVE_TYPE_UINT; + case MP_QSTR_ptr: return MP_NATIVE_TYPE_PTR; + case MP_QSTR_ptr8: return MP_NATIVE_TYPE_PTR8; + case MP_QSTR_ptr16: return MP_NATIVE_TYPE_PTR16; + case MP_QSTR_ptr32: return MP_NATIVE_TYPE_PTR32; + default: return -1; + } +} + // convert a MicroPython object to a valid native value based on type mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type) { DEBUG_printf("mp_convert_obj_to_native(%p, " UINT_FMT ")\n", obj, type); diff --git a/py/runtime.h b/py/runtime.h index 9811c1b5ae8c2a581907626cc3412338c3d2e1c7..3e447ee4fe62a8b8a38fe2788da8108c4eca54db 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -169,6 +169,7 @@ NORETURN void mp_raise_recursion_depth(void); #endif // helper functions for native/viper code +int mp_native_type_from_qstr(qstr qst); mp_uint_t mp_convert_obj_to_native(mp_obj_t obj, mp_uint_t type); mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type); mp_obj_dict_t *mp_native_swap_globals(mp_obj_dict_t *new_globals);