Commit | Line | Data |
---|---|---|
4a71579b | 1 | /* |
79bfeef6 | 2 | * Copyright (C) 2012-2023 Free Software Foundation, Inc. |
4a71579b PC |
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 | |
79bfeef6 PC |
28 | #else |
29 | # define NEW_ABI 0 | |
4a71579b PC |
30 | #endif |
31 | ||
32 | /* | |
33 | * Types | |
34 | */ | |
35 | #define JIT_FP _FP | |
36 | typedef enum { | |
37 | #define jit_r(i) (_V0 + (i)) | |
38 | #if NEW_ABI | |
519a9ea1 | 39 | # define jit_r_num() 8 |
4a71579b | 40 | #else |
519a9ea1 | 41 | # define jit_r_num() 12 |
4a71579b PC |
42 | #endif |
43 | #define jit_v(i) (_S0 + (i)) | |
44 | #define jit_v_num() 8 | |
45 | #define jit_f(i) (_F0 + (i)) | |
46 | #if NEW_ABI | |
47 | # define jit_f_num() 6 | |
48 | #else | |
49 | # define jit_f_num() 8 | |
50 | #endif | |
51 | _AT, | |
52 | #define JIT_R0 _V0 | |
53 | #define JIT_R1 _V1 | |
54 | #if NEW_ABI | |
55 | # define JIT_R2 _T4 | |
56 | # define JIT_R3 _T5 | |
57 | # define JIT_R4 _T6 | |
58 | # define JIT_R5 _T7 | |
59 | # define JIT_R6 _T8 | |
519a9ea1 | 60 | # define JIT_R7 _T9 |
4a71579b PC |
61 | #else |
62 | # define JIT_R2 _T0 | |
63 | # define JIT_R3 _T1 | |
64 | # define JIT_R4 _T2 | |
65 | # define JIT_R5 _T3 | |
66 | # define JIT_R6 _T4 | |
67 | # define JIT_R7 _T5 | |
68 | # define JIT_R8 _T6 | |
69 | # define JIT_R9 _T7 | |
70 | # define JIT_R10 _T8 | |
519a9ea1 | 71 | # define JIT_R11 _T9 |
4a71579b PC |
72 | #endif |
73 | _V0, _V1, | |
74 | #if !NEW_ABI | |
75 | _T0, _T1, _T2, _T3, | |
76 | #endif | |
77 | _T4, _T5, _T6, _T7, _T8, _T9, | |
78 | #define JIT_V0 _S0 | |
79 | #define JIT_V1 _S1 | |
80 | #define JIT_V2 _S2 | |
81 | #define JIT_V3 _S3 | |
82 | #define JIT_V4 _S4 | |
83 | #define JIT_V5 _S5 | |
84 | #define JIT_V6 _S6 | |
85 | #define JIT_V7 _S7 | |
86 | _S0, _S1, _S2, _S3, _S4, _S5, _S6, _S7, | |
87 | _ZERO, _K0, _K1, _RA, | |
88 | _GP, | |
89 | _SP, _FP, | |
90 | #if NEW_ABI | |
91 | _A7, _A6, _A5, _A4, | |
92 | #endif | |
93 | _A3, _A2, _A1, _A0, | |
94 | #define JIT_F0 _F0 | |
95 | #define JIT_F1 _F2 | |
96 | #define JIT_F2 _F4 | |
97 | #define JIT_F3 _F6 | |
98 | #define JIT_F4 _F8 | |
99 | #define JIT_F5 _F10 | |
100 | #if !NEW_ABI | |
101 | # define JIT_F6 _F16 | |
102 | # define JIT_F7 _F18 | |
103 | #endif | |
104 | _F0, _F2, _F4, _F6, _F8, _F10, | |
105 | /* callee save float registers */ | |
106 | #if !NEW_ABI | |
107 | _F16, _F18, | |
108 | #endif | |
109 | _F20, _F22, _F24, _F26, _F28, _F30, | |
110 | #if NEW_ABI | |
111 | _F19, _F18, _F17, _F16, _F15, _F14, _F13, _F12, | |
112 | #else | |
113 | _F14, _F12, | |
114 | #endif | |
115 | #define JIT_NOREG _NOREG | |
116 | _NOREG, | |
117 | } jit_reg_t; | |
118 | ||
79bfeef6 PC |
119 | typedef struct { |
120 | jit_uint32_t release : 4; | |
ba86ff93 PC |
121 | /* set if lwc1, ldc1, swc1, sdc1, mtc1, mfc1, dmtc1, and dmfc1 |
122 | * can be put in delay slot */ | |
123 | jit_uint32_t cop1_delay : 1; | |
124 | /* set if sll can be put in delay slot */ | |
125 | jit_uint32_t sll_delay : 1; | |
126 | /* set if lwl and lwr can be put in delay slot */ | |
127 | jit_uint32_t lwl_lwr_delay : 1; | |
128 | /* generate special instructions for un{ld,st}*; ignored for mips 6 | |
129 | * that does not have unaligned load/store instructions. */ | |
130 | jit_uint32_t unaligned : 1; | |
79bfeef6 PC |
131 | } jit_cpu_t; |
132 | ||
133 | /* | |
134 | * Initialization | |
135 | */ | |
136 | extern jit_cpu_t jit_cpu; | |
137 | ||
4a71579b | 138 | #endif /* _jit_mips_h */ |