aboutsummaryrefslogtreecommitdiff
path: root/py/emitinlinethumb.c
AgeCommit message (Collapse)Author
2022-05-26py/emitinlinethumb: Make float instruction use dynamically selectable.Damien George
This allows mpy-cross to dynamically select whether ARMv7-M float instructions are supported in @micropython.asm_thumb functions. Signed-off-by: Damien George <damien@micropython.org>
2022-05-26py/emitinlinethumb: Make ARMv7-M instruction use dynamically selectable.Damien George
This follows on from a5324a10747dfba921bb363ed904f05ebb6de010 and allows mpy-cross to dynamically select whether ARMv7-M instructions are supported in @micropython.asm_thumb functions. The config option MICROPY_EMIT_INLINE_THUMB_ARMV7M is no longer needed, it is now controlled by MICROPY_EMIT_THUMB_ARMV7M. Signed-off-by: Damien George <damien@micropython.org>
2022-04-11py/emitinlinethumb: Use 16 bit encodings for PUSH LR and POP PC.Christian Zietz
The Thumb instruction set has special 16 bit encodings for PUSH involving LR and POP involving PC, which are commonly used in nested functions. Using this encoding is particularly important for ARMv6-M, where the more general 32 bit encoding of PUSH and POP is unavailable.
2021-01-29py/emitinlinethumb: Exclude code using #if when ARMV7M disabled.Damien George
So there are no references to undeclared asm_thumb_mov_reg_i16(). Signed-off-by: Damien George <damien@micropython.org>
2021-01-29py/asmthumb: Add support for ARMv6M in native emitter.graham sanderson
Adds a new compile-time option MICROPY_EMIT_THUMB_ARMV7M which is enabled by default (to get existing behaviour) and which should be disabled (set to 0) when building native emitter support (@micropython.native) on ARMv6M targets.
2020-10-22py: Use unsigned comparison of chars.Emil Renner Berthing
On x86 chars are signed, but we're comparing a char to '0' + unsigned int, which is promoted to an unsigned int. Let's promote the char to unsigned before doing the comparison to avoid weird corner cases.
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-04-05py/objexcept: Allow compression of exception message text.Jim Mussared
The decompression of error-strings is only done if the string is accessed via printing or via er.args. Tests are added for this feature to ensure the decompression works.
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28py: Removing dangling "else" to improve code format consistency.Damien George
2019-03-14py/compile: Support multiple inline asm emitters.Damien George
2018-09-20py: Shorten error messages by using contractions and some rewording.Damien George
2017-07-31all: Use the name MicroPython consistently in commentsAlexander Steffen
There were several different spellings of MicroPython present in comments, when there should be only one.
2017-02-24py: Create str/bytes objects in the parser, not the compiler.Damien George
Previous to this patch any non-interned str/bytes objects would create a special parse node that held a copy of the str/bytes data. Then in the compiler this data would be turned into a str/bytes object. This actually lead to 2 copies of the data, one in the parse node and one in the object. The parse node's copy of the data would be freed at the end of the compile stage but nevertheless it meant that the peak memory usage of the parse/compile stage was higher than it needed to be (by an amount equal to the number of bytes in all the non-interned str/bytes objects). This patch changes the behaviour so that str/bytes objects are created directly in the parser and the object stored in a const-object parse node (which already exists for bignum, float and complex const objects). This reduces peak RAM usage of the parse/compile stage, simplifies the parser and compiler, and reduces code size by about 170 bytes on Thumb2 archs, and by about 300 bytes on Xtensa archs.
2017-02-16py/grammar: Group no-compile grammar rules together to shrink tables.Damien George
Grammar rules have 2 variants: ones that are attached to a specific compile function which is called to compile that grammar node, and ones that don't have a compile function and are instead just inspected to see what form they take. In the compiler there is a table of all grammar rules, with each entry having a pointer to the associated compile function. Those rules with no compile function have a null pointer. There are 120 such rules, so that's 120 words of essentially wasted code space. By grouping together the compile vs no-compile rules we can put all the no-compile rules at the end of the list of rules, and then we don't need to store the null pointers. We just have a truncated table and it's guaranteed that when indexing this table we only index the first half, the half with populated pointers. This patch implements such a grouping by having a specific macro for the compile vs no-compile grammar rules (DEF_RULE vs DEF_RULE_NC). It saves around 460 bytes of code on 32-bit archs.
2016-12-09py/emitinline: Move common code for end of final pass to compiler.Damien George
This patch moves some common code from the individual inline assemblers to the compiler, the code that calls the emit-glue to assign the machine code to the functions scope.
2016-12-09py/emitinline: Move inline-asm align and data methods to compiler.Damien George
These are generic methods that don't depend on the architecture and so can be handled directly by the compiler.
2016-12-09py/emitinline: Embed entire asm struct instead of a pointer to it.Damien George
This reduces fragmentation, and memory use by 1 word. But more importantly it means the emit_inline_asm_t struct now "derives" from mp_asm_base.
2016-11-28py: Factor out common code from assemblers into asmbase.[ch].Damien George
All assemblers should "derive" from mp_asm_base_t.
2016-02-23py/emitinlinethumb: Use qstrs instead of char* for names of asm ops.Damien George
Reduces code size by 112 bytes on Thumb2 arch, and makes assembler faster because comparison can be a simple equals instead of a string compare. Not all ops have been converted, only those that were simple to convert and reduced code size.
2016-01-27py/inlineasm: Add ability to specify return type of asm_thumb funcs.Damien George
Supported return types are: object, bool, int, uint. For example: @micropython.asm_thumb def foo(r0, r1) -> uint: add(r0, r0, r1)
2016-01-07py/inlinethumb: Remove 30-bit restriction on movwt instruction.Damien George
movwt can now move a full 32-bit constant into a register.
2016-01-07py/inlinethumb: Allow assembler to use big ints as args to instructions.Damien George
2015-12-10py/emitinlinethumb: Add support for MRS instruction.Henrik Sölver
Only IPSR and BASEPRI special registers supported at the moment, but easy to extend in the future.
2015-11-29py: Change qstr_* functions to use size_t as the type for str len arg.Damien George
2015-11-13py: Add constant table to bytecode.Damien George
Contains just argument names at the moment but makes it easy to add arbitrary constants.
2015-11-13py: Put all bytecode state (arg count, etc) in bytecode.Damien George
2015-11-09py/emitinlinethumb: Allow to compile with -Wsign-compare.Damien George
2015-10-31py: In inline asm, vldr and vstr offsets now in bytes not words.adminpete
As per ARM convention.
2015-10-19py: Add lsl/lsr/asr opcode support to inline Thumb2 assembler.Damien George
2015-10-16py: Add option for inline assembler to support ARMv7-M instructions.Damien George
Cortex-M0, M0+ and M1 only have ARMv6-M Thumb/Thumb2 instructions. M3, M4 and M7 have a superset of these, named ARMv7-M. This patch adds a config option to enable support of the superset of instructions.
2015-04-19py/inlinethumb: Support for core floating point instructions.=
Adds support for the following Thumb2 VFP instructions, via the option MICROPY_EMIT_INLINE_THUMB_FLOAT: vcmp vsqrt vneg vcvt_f32_to_s32 vcvt_s32_to_f32 vmrs vmov vldr vstr vadd vsub vmul vdiv
2015-04-16py: Add %q format support to mp_[v]printf, and use it.Damien George
2015-04-11py: In emitinlinethumb, use qstr_data instead of qstr_str and strlen.Damien George
2015-04-07py: Implement full func arg passing for native emitter.Damien George
This patch gets full function argument passing working with native emitter. Includes named args, keyword args, default args, var args and var keyword args. Fully Python compliant. It reuses the bytecode mp_setup_code_state function to do all the hard work. This function is slightly adjusted to accommodate native calls, and the native emitter is forced a bit to emit similar prelude and code-info as bytecode.
2015-03-03py: In inline assembler, reset labels on code-size pass.Damien George
2015-03-03py: Give error for duplicate label in inline assembler.Damien George
2015-03-02py: For inline assembler, add bcc_n and bcc_w ops.Damien George
Addresses issue #1143.
2015-02-25py: Make inline assembler raise exception when branch not in range.Damien George
Addresses issue #1132.
2015-02-24py: In inline assembler, add return statement to fix flow logic.Damien George
2015-02-24py: Factor some code in inline thumb assembler to reduce code size.Damien George
2015-02-24py: Make more asmthumb functions inline to reduce code size.Damien George
2015-02-24py: Reduce code size of inline thumb assembler by using static tables.Damien George
Reduces stmhal by about 300 bytes ROM.
2015-02-16py: Implement bl/bx instructions for inline Thumb assembler.Damien George
2015-02-16py: Implement "it" instruction for inline Thumb assembler.Damien George
2015-02-13py: Implement clz and rbit for inline Thumb assembler.Damien George
2015-02-13py: Implement sdiv/udiv for inline Thumb assembler.Damien George
2015-02-13py: Implement push/pop for inline Thumb assembler.Damien George
2015-02-13py: Make inline assembler raise proper SyntaxError exception on error.Damien George
Also gives line number of location of error. Very useful!
2015-02-12py: Add ldrex and strex to thumb2 inline assembler.Damien George
These are useful for implementing atomic lock operations.