| 1 | /* |
| 2 | * Copyright (C) 2012-2019 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_mips_h |
| 21 | #define _jit_mips_h |
| 22 | |
| 23 | #define JIT_HASH_CONSTS 1 |
| 24 | #define JIT_NUM_OPERANDS 3 |
| 25 | |
| 26 | #if _MIPS_SIM != _ABIO32 |
| 27 | # define NEW_ABI 1 |
| 28 | #endif |
| 29 | |
| 30 | /* |
| 31 | * Types |
| 32 | */ |
| 33 | #define JIT_FP _FP |
| 34 | typedef enum { |
| 35 | #define jit_r(i) (_V0 + (i)) |
| 36 | #if NEW_ABI |
| 37 | # define jit_r_num() 8 |
| 38 | #else |
| 39 | # define jit_r_num() 12 |
| 40 | #endif |
| 41 | #define jit_v(i) (_S0 + (i)) |
| 42 | #define jit_v_num() 8 |
| 43 | #define jit_f(i) (_F0 + (i)) |
| 44 | #if NEW_ABI |
| 45 | # define jit_f_num() 6 |
| 46 | #else |
| 47 | # define jit_f_num() 8 |
| 48 | #endif |
| 49 | _AT, |
| 50 | #define JIT_R0 _V0 |
| 51 | #define JIT_R1 _V1 |
| 52 | #if NEW_ABI |
| 53 | # define JIT_R2 _T4 |
| 54 | # define JIT_R3 _T5 |
| 55 | # define JIT_R4 _T6 |
| 56 | # define JIT_R5 _T7 |
| 57 | # define JIT_R6 _T8 |
| 58 | # define JIT_R7 _T9 |
| 59 | #else |
| 60 | # define JIT_R2 _T0 |
| 61 | # define JIT_R3 _T1 |
| 62 | # define JIT_R4 _T2 |
| 63 | # define JIT_R5 _T3 |
| 64 | # define JIT_R6 _T4 |
| 65 | # define JIT_R7 _T5 |
| 66 | # define JIT_R8 _T6 |
| 67 | # define JIT_R9 _T7 |
| 68 | # define JIT_R10 _T8 |
| 69 | # define JIT_R11 _T9 |
| 70 | #endif |
| 71 | _V0, _V1, |
| 72 | #if !NEW_ABI |
| 73 | _T0, _T1, _T2, _T3, |
| 74 | #endif |
| 75 | _T4, _T5, _T6, _T7, _T8, _T9, |
| 76 | #define JIT_V0 _S0 |
| 77 | #define JIT_V1 _S1 |
| 78 | #define JIT_V2 _S2 |
| 79 | #define JIT_V3 _S3 |
| 80 | #define JIT_V4 _S4 |
| 81 | #define JIT_V5 _S5 |
| 82 | #define JIT_V6 _S6 |
| 83 | #define JIT_V7 _S7 |
| 84 | _S0, _S1, _S2, _S3, _S4, _S5, _S6, _S7, |
| 85 | _ZERO, _K0, _K1, _RA, |
| 86 | _GP, |
| 87 | _SP, _FP, |
| 88 | #if NEW_ABI |
| 89 | _A7, _A6, _A5, _A4, |
| 90 | #endif |
| 91 | _A3, _A2, _A1, _A0, |
| 92 | #define JIT_F0 _F0 |
| 93 | #define JIT_F1 _F2 |
| 94 | #define JIT_F2 _F4 |
| 95 | #define JIT_F3 _F6 |
| 96 | #define JIT_F4 _F8 |
| 97 | #define JIT_F5 _F10 |
| 98 | #if !NEW_ABI |
| 99 | # define JIT_F6 _F16 |
| 100 | # define JIT_F7 _F18 |
| 101 | #endif |
| 102 | _F0, _F2, _F4, _F6, _F8, _F10, |
| 103 | /* callee save float registers */ |
| 104 | #if !NEW_ABI |
| 105 | _F16, _F18, |
| 106 | #endif |
| 107 | _F20, _F22, _F24, _F26, _F28, _F30, |
| 108 | #if NEW_ABI |
| 109 | _F19, _F18, _F17, _F16, _F15, _F14, _F13, _F12, |
| 110 | #else |
| 111 | _F14, _F12, |
| 112 | #endif |
| 113 | #define JIT_NOREG _NOREG |
| 114 | _NOREG, |
| 115 | } jit_reg_t; |
| 116 | |
| 117 | #endif /* _jit_mips_h */ |