| 1 | /* |
| 2 | * Copyright (C) 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_loongarch_h |
| 21 | #define _jit_loongarch_h |
| 22 | |
| 23 | /* |
| 24 | * Types |
| 25 | */ |
| 26 | #define JIT_FP _FP |
| 27 | typedef enum { |
| 28 | #define jit_r_num() 9 |
| 29 | #define jit_r(i) (_T0 - (i)) |
| 30 | #define JIT_R0 _T0 |
| 31 | #define JIT_R1 _T1 |
| 32 | #define JIT_R2 _T2 |
| 33 | #define JIT_R3 _T3 |
| 34 | #define JIT_R4 _T4 |
| 35 | #define JIT_R5 _T5 |
| 36 | #define JIT_R6 _T6 |
| 37 | #define JIT_R7 _T7 |
| 38 | #define JIT_R8 _T8 |
| 39 | _T8, _T7, _T6, _T5, _T4, _T3, _T2, _T1, _T0, |
| 40 | #define jit_v_num() 9 |
| 41 | #define jit_v(i) (_S0 - (i)) |
| 42 | #define JIT_V0 _S0 |
| 43 | #define JIT_V1 _S1 |
| 44 | #define JIT_V2 _S2 |
| 45 | #define JIT_V3 _S3 |
| 46 | #define JIT_V4 _S4 |
| 47 | #define JIT_V5 _S5 |
| 48 | #define JIT_V6 _S6 |
| 49 | #define JIT_V7 _S7 |
| 50 | #define JIT_V8 _S8 |
| 51 | _S8, _S7, _S6, _S5, _S4, _S3, _S2, _S1, _S0, |
| 52 | _A7, _A6, _A5, _A4, _A3, _A2, _A1, _A0, |
| 53 | _FP, |
| 54 | _R21, |
| 55 | _ZERO, |
| 56 | _RA, |
| 57 | _TP, |
| 58 | _SP, |
| 59 | _FT0, _FT1, _FT2, _FT3, _FT4, _FT5, _FT6, _FT7, |
| 60 | _FT8, _FT9, _FT10, _FT11, _FT12, _FT13, _FT14, _FT15, |
| 61 | _FA7, _FA6, _FA5, _FA4, FA3, _FA2, _FA1, _FA0, |
| 62 | #define jit_f_num() 8 |
| 63 | #define jit_f(i) (_FS0 - (i)) |
| 64 | #define JIT_F0 _FS0 |
| 65 | #define JIT_F1 _FS1 |
| 66 | #define JIT_F2 _FS2 |
| 67 | #define JIT_F3 _FS3 |
| 68 | #define JIT_F4 _FS4 |
| 69 | #define JIT_F5 _FS5 |
| 70 | #define JIT_F6 _FS6 |
| 71 | #define JIT_F7 _FS7 |
| 72 | _FS7, _FS6, _FS5, _FS4, _FS3, _FS2, _FS1, _FS0, |
| 73 | #define JIT_NOREG _NOREG |
| 74 | _NOREG, |
| 75 | } jit_reg_t; |
| 76 | |
| 77 | typedef struct { |
| 78 | /* generate special instructions for unaligned load/store? */ |
| 79 | /* It is not guaranteed unaligned memory access is supported. */ |
| 80 | jit_uint32_t unaligned : 1; |
| 81 | } jit_cpu_t; |
| 82 | |
| 83 | /* |
| 84 | * Initialization |
| 85 | */ |
| 86 | extern jit_cpu_t jit_cpu; |
| 87 | |
| 88 | #endif /* _jit_loongarch_h */ |