| 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_hppa_h |
| 21 | #define _jit_hppa_h |
| 22 | |
| 23 | #define JIT_HASH_CONSTS 1 |
| 24 | #define JIT_NUM_OPERANDS 3 |
| 25 | |
| 26 | /* |
| 27 | * Types |
| 28 | */ |
| 29 | typedef enum { |
| 30 | _R0, /* Always zero */ |
| 31 | _R1, /* ADDIL implicit target */ |
| 32 | _R2, /* B,L implicit target */ |
| 33 | #define jit_r_num() 4 |
| 34 | #define jit_r(n) ((n) < 3 ? _R4 + (n) : _R10 + (n) - 3) |
| 35 | #define jit_v_num() 11 |
| 36 | #define jit_v(n) ((n) < 3 ? _R7 + (n) : _R11 + (n) - 3) |
| 37 | #define jit_f_num() 8 |
| 38 | #define jit_f(n) (_F12 - (n)) |
| 39 | #define JIT_FP _R3 |
| 40 | #define JIT_R0 _R4 |
| 41 | #define JIT_R1 _R5 |
| 42 | #define JIT_R2 _R6 |
| 43 | #define JIT_R3 _R10 |
| 44 | #define JIT_V0 _R7 |
| 45 | #define JIT_V1 _R8 |
| 46 | #define JIT_V2 _R9 |
| 47 | #define JIT_V3 _R11 |
| 48 | #define JIT_V4 _R12 |
| 49 | #define JIT_V5 _R13 |
| 50 | #define JIT_V6 _R14 |
| 51 | #define JIT_V7 _R15 |
| 52 | #define JIT_V8 _R16 |
| 53 | #define JIT_V9 _R17 |
| 54 | #define JIT_V10 _R18 |
| 55 | _R3, |
| 56 | _R19, |
| 57 | _R20, |
| 58 | _R21, |
| 59 | _R22, |
| 60 | _R29, /* ret1 */ |
| 61 | _R28, /* ret0 */ |
| 62 | _R4, |
| 63 | _R5, |
| 64 | _R6, |
| 65 | _R7, |
| 66 | _R8, |
| 67 | _R9, |
| 68 | _R10, |
| 69 | _R11, |
| 70 | _R12, |
| 71 | _R13, |
| 72 | _R14, |
| 73 | _R15, |
| 74 | _R16, |
| 75 | _R17, |
| 76 | _R18, |
| 77 | _R23, /* arg3 */ |
| 78 | _R24, /* arg2 */ |
| 79 | _R25, /* arg1 */ |
| 80 | _R26, /* arg0 */ |
| 81 | _R27, /* Data Pointer */ |
| 82 | _R30, /* Stack Pointer */ |
| 83 | _R31, /* Link register */ |
| 84 | #define JIT_F0 _F12 |
| 85 | #define JIT_F1 _F13 |
| 86 | #define JIT_F2 _F14 |
| 87 | #define JIT_F3 _F15 |
| 88 | #define JIT_F4 _F16 |
| 89 | #define JIT_F5 _F17 |
| 90 | #define JIT_F6 _F18 |
| 91 | #define JIT_F7 _F19 |
| 92 | #define JIT_F8 _F20 |
| 93 | #define JIT_F9 _F21 |
| 94 | /* Caller Saves */ |
| 95 | _F31, |
| 96 | _F30, |
| 97 | _F29, |
| 98 | _F28, |
| 99 | _F27, |
| 100 | _F26, |
| 101 | _F25, |
| 102 | _F24, |
| 103 | _F23, |
| 104 | _F22, |
| 105 | _F11, |
| 106 | _F10, |
| 107 | _F9, |
| 108 | _F8, |
| 109 | /* Arguments */ |
| 110 | _F7, /* farg3 */ |
| 111 | _F6, /* farg2 */ |
| 112 | _F5, /* farg1 */ |
| 113 | _F4, /* farg0 */ |
| 114 | /* Callee Saves */ |
| 115 | _F21, |
| 116 | _F20, |
| 117 | _F19, |
| 118 | _F18, |
| 119 | _F17, |
| 120 | _F16, |
| 121 | _F15, |
| 122 | _F14, |
| 123 | _F13, |
| 124 | _F12, |
| 125 | /* Floating-Pointer Status and Exception */ |
| 126 | _F0, |
| 127 | _F1, |
| 128 | _F2, |
| 129 | _F3, |
| 130 | #define JIT_NOREG _NOREG |
| 131 | _NOREG, |
| 132 | } jit_reg_t; |
| 133 | |
| 134 | typedef struct { |
| 135 | /* Need this to pass unldst.tst on . This is very strange, because |
| 136 | * even for aligned addresses it is required, but all other load/store |
| 137 | * tests *work* with index immediates. Possibly a qemu (7.0.0) bug, |
| 138 | * and for the moment, by default keep failing. Need to test in |
| 139 | * actual hardware. */ |
| 140 | jit_uint32_t imm_idx : 1; |
| 141 | } jit_cpu_t; |
| 142 | |
| 143 | /* |
| 144 | * Initialization |
| 145 | */ |
| 146 | extern jit_cpu_t jit_cpu; |
| 147 | |
| 148 | #endif /* _jit_hppa */ |