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>
This commit is contained in:
Damien George
2024-03-07 11:38:27 +11:00
parent e2ae03e979
commit 9dbc787ce8
11 changed files with 315 additions and 4 deletions

View File

@@ -103,6 +103,7 @@ static const emit_method_table_t *emit_native_table[] = {
&emit_native_xtensa_method_table,
&emit_native_xtensawin_method_table,
&emit_native_rv32_method_table,
&emit_native_debug_method_table,
};
#elif MICROPY_EMIT_NATIVE
@@ -121,6 +122,8 @@ static const emit_method_table_t *emit_native_table[] = {
#define NATIVE_EMITTER(f) emit_native_xtensawin_##f
#elif MICROPY_EMIT_RV32
#define NATIVE_EMITTER(f) emit_native_rv32_##f
#elif MICROPY_EMIT_NATIVE_DEBUG
#define NATIVE_EMITTER(f) emit_native_debug_##f
#else
#error "unknown native emitter"
#endif