aboutsummaryrefslogtreecommitdiff
path: root/py/nlr.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-06-17 23:19:34 +1000
committerDamien George <damien.p.george@gmail.com>2019-06-19 14:53:17 +1000
commit34c04d2319cdfae01ed7bf7f9e341d69b86d751a (patch)
tree6d892dafc9c9cca8fc04c96141625107867518a9 /py/nlr.h
parent3ee3995be1c6c461110d7908498777241e08a76a (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 90595a12d..8ce5cf0f4 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)