summaryrefslogtreecommitdiff
path: root/py/nlr.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-06-17 23:19:34 +1000
committerScott Shawcroft <scott@tannewt.org>2019-12-12 11:10:10 -0800
commit767d47dd6025e8046b03e6b307fd0ba6a81cf504 (patch)
treeeb89019d86c2b997dd5b8621d879fb02225e4b42 /py/nlr.h
parent1cf0ce094a4a1571b7404643e7a3b992592317a5 (diff)
py/nlrthumb: Save and restore VFP registers s16-s21 when CPU has them.
These s16-s21 registers are used by gcc so need to be saved. Future versions of gcc (beyond v9.1.0), or other compilers, may eventually need additional registers saved/restored. See issue #4844.
Diffstat (limited to 'py/nlr.h')
-rw-r--r--py/nlr.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/py/nlr.h b/py/nlr.h
index b442aaf8a..1b95002d3 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -54,7 +54,14 @@
#endif
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
#define MICROPY_NLR_THUMB (1)
- #define MICROPY_NLR_NUM_REGS (10)
+ #if defined(__SOFTFP__)
+ #define MICROPY_NLR_NUM_REGS (10)
+ #else
+ // With hardware FP registers s16-s31 are callee save so in principle
+ // should be saved and restored by the NLR code. gcc only uses s16-s21
+ // so only save/restore those as an optimisation.
+ #define MICROPY_NLR_NUM_REGS (10 + 6)
+ #endif
#elif defined(__xtensa__)
#define MICROPY_NLR_XTENSA (1)
#define MICROPY_NLR_NUM_REGS (10)