| 1 | /* |
| 2 | * Copyright (C) 2013-2023 Free Software Foundation, Inc. |
| 3 | * |
| 4 | * This file is part of GNU lightning. |
| 5 | * |
| 6 | * GNU lightning is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU Lesser General Public License as published |
| 8 | * by the Free Software Foundation; either version 3, or (at your option) |
| 9 | * any later version. |
| 10 | * |
| 11 | * GNU lightning is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 14 | * License for more details. |
| 15 | * |
| 16 | * Authors: |
| 17 | * Paulo Cesar Pereira de Andrade |
| 18 | */ |
| 19 | |
| 20 | #ifndef _jit_aarch64_h |
| 21 | #define _jit_aarch64_h |
| 22 | |
| 23 | #define JIT_HASH_CONSTS 0 |
| 24 | #define JIT_NUM_OPERANDS 3 |
| 25 | |
| 26 | #if __APPLE__ |
| 27 | # define PACKED_STACK 1 |
| 28 | #endif |
| 29 | |
| 30 | /* |
| 31 | * Types |
| 32 | */ |
| 33 | #define JIT_FP _R29 |
| 34 | typedef enum { |
| 35 | #define jit_r(i) (_R9 + (i)) |
| 36 | #define jit_r_num() 7 |
| 37 | #define jit_v(i) (_R19 + (i)) |
| 38 | #define jit_v_num() 10 |
| 39 | #define jit_f(i) (_V8 + (i)) |
| 40 | #define jit_f_num() 8 |
| 41 | #define JIT_R0 _R9 |
| 42 | #define JIT_R1 _R10 |
| 43 | #define JIT_R2 _R11 |
| 44 | #define JIT_R3 _R12 |
| 45 | #define JIT_R4 _R13 |
| 46 | #define JIT_R5 _R14 |
| 47 | #define JIT_R6 _R15 |
| 48 | _R8, /* indirect result */ |
| 49 | _R18, /* platform register */ |
| 50 | _R17, /* IP1 */ |
| 51 | _R16, /* IP0 */ |
| 52 | _R9, _R10, _R11, _R12, /* temporaries */ |
| 53 | _R13, _R14, _R15, |
| 54 | #define JIT_V0 _R19 |
| 55 | #define JIT_V1 _R20 |
| 56 | #define JIT_V2 _R21 |
| 57 | #define JIT_V3 _R22 |
| 58 | #define JIT_V4 _R23 |
| 59 | #define JIT_V5 _R24 |
| 60 | #define JIT_V6 _R25 |
| 61 | #define JIT_V7 _R26 |
| 62 | #define JIT_V8 _R27 |
| 63 | #define JIT_V9 _R28 |
| 64 | _R19, _R20, _R21, _R22, /* callee save */ |
| 65 | _R23, _R24, _R25, _R26, |
| 66 | _R27, _R28, |
| 67 | _SP, /* stack pointer */ |
| 68 | _R30, /* link register */ |
| 69 | _R29, /* frame pointer */ |
| 70 | _R7, _R6, _R5, _R4, |
| 71 | _R3, _R2, _R1, _R0, |
| 72 | #define JIT_F0 _V8 |
| 73 | #define JIT_F1 _V9 |
| 74 | #define JIT_F2 _V10 |
| 75 | #define JIT_F3 _V11 |
| 76 | #define JIT_F4 _V12 |
| 77 | #define JIT_F5 _V13 |
| 78 | #define JIT_F6 _V14 |
| 79 | #define JIT_F7 _V15 |
| 80 | _V31, _V30, _V29, _V28, /* temporaries */ |
| 81 | _V27, _V26, _V25, _V24, |
| 82 | _V23, _V22, _V21, _V20, |
| 83 | _V19, _V18, _V17, _V16, |
| 84 | /* callee save */ |
| 85 | _V8, _V9, _V10, _V11, |
| 86 | _V12, _V13, _V14, _V15, |
| 87 | _V7, _V6, _V5, _V4, /* arguments */ |
| 88 | _V3, _V2, _V1, _V0, |
| 89 | _NOREG, |
| 90 | #define JIT_NOREG _NOREG |
| 91 | } jit_reg_t; |
| 92 | |
| 93 | #endif /* _jit_aarch64_h */ |