summaryrefslogtreecommitdiff
path: root/py/asmbase.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-03-07 11:38:27 +1100
committerDamien George <damien@micropython.org>2024-06-21 16:21:27 +1000
commit9dbc787ce8dda9df39eb68c03de144155b2253f0 (patch)
treef05e960eb7f1bc173570c2bca0901524ed813407 /py/asmbase.c
parente2ae03e97963c2d338752bc4cbe8bd87981014fb (diff)
py/emitndebug: Add native debug emitter.
This emitter prints out pseudo-machine instructions, instead of the usual output of the native emitter. It can be enabled on any port via `MICROPY_EMIT_NATIVE_DEBUG` (make sure other native emitters are disabled) but the easiest way to use it is with mpy-cross: $ mpy-cross -march=debug file.py Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/asmbase.c')
-rw-r--r--py/asmbase.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/py/asmbase.c b/py/asmbase.c
index cf64e3f3d..3fce543a7 100644
--- a/py/asmbase.c
+++ b/py/asmbase.c
@@ -30,6 +30,7 @@
#include "py/obj.h"
#include "py/misc.h"
#include "py/asmbase.h"
+#include "py/persistentcode.h"
#if MICROPY_EMIT_MACHINE_CODE
@@ -91,6 +92,11 @@ void mp_asm_base_label_assign(mp_asm_base_t *as, size_t label) {
} else {
// ensure label offset has not changed from PASS_COMPUTE to PASS_EMIT
assert(as->label_offsets[label] == as->code_offset);
+ #if MICROPY_DYNAMIC_COMPILER && MICROPY_EMIT_NATIVE_DEBUG
+ if (mp_dynamic_compiler.native_arch == MP_NATIVE_ARCH_DEBUG) {
+ mp_printf(MICROPY_EMIT_NATIVE_DEBUG_PRINTER, "label(label_%u)\n", (unsigned int)label);
+ }
+ #endif
}
}