Files
micropython/py/emitndebug.c
Alessandro Gatti f0895f0ea0 py/emitnative: Optimise register clearing.
This commit introduces a new generic ASM API function to clear a
register (i.e. clearing all the registers' bits).

The native emitter used to perform a XOR operation to clear a given
register, but different platform have more optimised method to achieve
the same result taking up less space - either for the generated code or
for the code generator itself.

Arm, RV32, X86, and X64 already had an already optimised generator and
generated optimised code.  The code generator when build for Thumb takes
less space generating a constant immediate move rather than a XOR
operation, even though both operations would distill down to a single
narrow opcode.  On Xtensa the situation is almost the same as Thumb,
with the exception that a constant immediate move would take one byte
less than a XOR operation.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-12-19 14:26:01 +11:00

10 KiB