summaryrefslogtreecommitdiff
path: root/py/emitndebug.c
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2025-06-26 21:56:26 +0200
committerDamien George <damien@micropython.org>2025-07-04 16:07:04 +1000
commit2ab06b61b3f60e42cda250203bda31667ecef043 (patch)
treed7e55a12b6c38bf69beef98922f359339c825edb /py/emitndebug.c
parent3a97175f5f7023d9f8db37c21e0c04174df0f205 (diff)
py/emitnative: Let emitters know the compiled entity's name.
This commit introduces an optional feature to provide to native emitters the fully qualified name of the entity they are compiling. This is achieved by altering the generic ASM API to provide a third argument to the entry function, containing the name of the entity being compiled. Currently only the debug emitter uses this feature, as it is not really useful for other emitters for the time being; in fact the macros in question just strip the name away. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'py/emitndebug.c')
-rw-r--r--py/emitndebug.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/emitndebug.c b/py/emitndebug.c
index c068a9a9a..e49c5cdbf 100644
--- a/py/emitndebug.c
+++ b/py/emitndebug.c
@@ -108,8 +108,8 @@ static void asm_debug_end_pass(asm_debug_t *as) {
(void)as;
}
-static void asm_debug_entry(asm_debug_t *as, int num_locals) {
- asm_debug_printf(as, "ENTRY(num_locals=%d)\n", num_locals);
+static void asm_debug_entry(asm_debug_t *as, int num_locals, char *name) {
+ asm_debug_printf(as, "ENTRY(%s, num_locals=%d)\n", name != NULL ? name : "?", num_locals);
}
static void asm_debug_exit(asm_debug_t *as) {
@@ -195,8 +195,8 @@ static void asm_debug_setcc_reg_reg_reg(asm_debug_t *as, int op, int reg1, int r
#define ASM_T asm_debug_t
#define ASM_END_PASS asm_debug_end_pass
-#define ASM_ENTRY(as, num_locals) \
- asm_debug_entry(as, num_locals)
+#define ASM_ENTRY(as, num_locals, name) \
+ asm_debug_entry(as, num_locals, name)
#define ASM_EXIT(as) \
asm_debug_exit(as)