diff options
| author | Alessandro Gatti <a.gatti@frob.it> | 2025-07-07 19:39:06 +0200 |
|---|---|---|
| committer | Alessandro Gatti <a.gatti@frob.it> | 2025-09-19 10:06:18 +0200 |
| commit | 42ea7bc32af49f305ece4f4e4601accea9df0534 (patch) | |
| tree | 7c3e2337621dafa46d311e27e0ac826a767598ee /py/mpstate.h | |
| parent | 44986b1f0401f086254f7dabc65f1816db35829a (diff) | |
py/mpstate: Make it possible for mpy-cross to set emitter options.
This commit introduces a way for mpy-cross to pass a set of options to
the chosen emitter.
This is achieved by adding an opaque pointer to the dynamic compiler
state structure that is only accessed by emitters that have a need to
receive options from mpy-cross when generating code. That's a way to
make this feature possible without breaking any existing code or
emitter, and without re-engineering the compiler entry point function
(together with passing the options struct downstream until it's time to
emit code).
The main use case for this is letting the RV32 emitter know which
optional extensions it can generate code with, to be able to emit better
suited code for the platform in use.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'py/mpstate.h')
| -rw-r--r-- | py/mpstate.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/py/mpstate.h b/py/mpstate.h index 138c56173..325c12217 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -60,6 +60,12 @@ enum { // This structure contains dynamic configuration for the compiler. #if MICROPY_DYNAMIC_COMPILER typedef struct mp_dynamic_compiler_t { + // This is used to let mpy-cross pass options to the emitter chosen with + // `native_arch`. The main use case for the time being is to give the + // RV32 emitter extended information about which extensions can be + // optionally used, in order to generate code that's better suited for the + // hardware platform the code will run on. + void *backend_options; uint8_t small_int_bits; // must be <= host small_int_bits uint8_t native_arch; uint8_t nlr_buf_num_regs; |
