Commit Graph

4 Commits

Author SHA1 Message Date
Alessandro Gatti
326e1149ec py/asmrv32: Fix short/long jumps scheduling.
The RV32 emitter always scheduled short jumps even outside the emit
compiler pass.  Running the full test suite through the native emitter
instead of just the tests that depend on the emitter at runtime (as in,
`micropython/native_*` and `micropython/viper_* tests`) uncovered more
places where the invalid behaviour was still present.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-08-19 15:53:50 +10:00
Alessandro Gatti
bb6a4669b2 py/asmrv32: Do not use binary literals.
As per discussion in #15347, non-standard binary literals have been
removed in favour of their hexadecimal counterparts.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-07-01 22:44:02 +02:00
Alessandro Gatti
0600e4f273 py/asmrv32: Make some code sequences smaller.
This commit changes a few code sequences to use more compressed opcodes
where possible.  The sequences in question are the ones that show up the
most in the test suite and require the least amount of code changes, namely
short offset loads from memory to RET/ARG registers, indirect calls through
the function table, register-based jumps, locals' offset calculation,
reg-is-null jumps, and register comparisons.

There are no speed losses or gains from these changes, but there is an
average 15-20% generated code size reduction.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-07-01 11:36:03 +10:00
Alessandro Gatti
8338f66352 py/asmrv32: Add RISC-V RV32IMC native code emitter.
This adds a native code generation backend for RISC-V RV32I CPUs, currently
limited to the I, M, and C instruction sets.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-06-21 15:06:07 +10:00