Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
switch_arm32_ios.h
1/*
2 * this is the internal transfer function.
3 *
4 * HISTORY
5 * 31-May-15 iOS support. Ported from arm32. Proton <feisuzhu@163.com>
6 *
7 * NOTES
8 *
9 * It is not possible to detect if fp is used or not, so the supplied
10 * switch function needs to support it, so that you can remove it if
11 * it does not apply to you.
12 *
13 * POSSIBLE ERRORS
14 *
15 * "fp cannot be used in asm here"
16 *
17 * - Try commenting out "fp" in REGS_TO_SAVE.
18 *
19 */
20
21#define STACK_REFPLUS 1
22
23#ifdef SLP_EVAL
24
25#define STACK_MAGIC 0
26#define REG_SP "sp"
27#define REG_SPSP "sp,sp"
28#define REG_FP "r7"
29#define REG_FPFP "r7,r7"
30#define REGS_TO_SAVE_GENERAL "r4", "r5", "r6", "r8", "r10", "r11", "lr"
31#define REGS_TO_SAVE REGS_TO_SAVE_GENERAL, "d8", "d9", "d10", "d11", \
32 "d12", "d13", "d14", "d15"
33
34static int
35#ifdef __GNUC__
36__attribute__((optimize("no-omit-frame-pointer")))
37#endif
38slp_switch(void)
39{
40 void *fp;
41 int *stackref, stsizediff, result;
42 __asm__ volatile ("" : : : REGS_TO_SAVE);
43 __asm__ volatile ("str " REG_FP ",%0" : "=m" (fp));
44 __asm__ ("mov %0," REG_SP : "=r" (stackref));
45 {
46 SLP_SAVE_STATE(stackref, stsizediff);
47 __asm__ volatile (
48 "add " REG_SPSP ",%0\n"
49 "add " REG_FPFP ",%0\n"
50 :
51 : "r" (stsizediff)
52 : REGS_TO_SAVE /* Clobber registers, force compiler to
53 * recalculate address of void *fp from REG_SP or REG_FP */
54 );
55 SLP_RESTORE_STATE();
56 }
57 __asm__ volatile (
58 "ldr " REG_FP ", %1\n\t"
59 "mov %0, #0"
60 : "=r" (result)
61 : "m" (fp)
62 : REGS_TO_SAVE /* Force compiler to restore saved registers after this */
63 );
64 return result;
65}
66
67#endif
nodes.Node optimize(nodes.Node node, "Environment" environment)
Definition optimizer.py:20