1 /*
2  * Copyright (C) 2012-2017  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()		7
38 #else
39 #  define jit_r_num()		11
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 #else
59 #  define JIT_R2		_T0
60 #  define JIT_R3		_T1
61 #  define JIT_R4		_T2
62 #  define JIT_R5		_T3
63 #  define JIT_R6		_T4
64 #  define JIT_R7		_T5
65 #  define JIT_R8		_T6
66 #  define JIT_R9		_T7
67 #  define JIT_R10		_T8
68 #endif
69     _V0, _V1,
70 #if !NEW_ABI
71     _T0, _T1, _T2, _T3,
72 #endif
73     _T4, _T5, _T6, _T7, _T8, _T9,
74 #define JIT_V0			_S0
75 #define JIT_V1			_S1
76 #define JIT_V2			_S2
77 #define JIT_V3			_S3
78 #define JIT_V4			_S4
79 #define JIT_V5			_S5
80 #define JIT_V6			_S6
81 #define JIT_V7			_S7
82     _S0, _S1, _S2, _S3, _S4, _S5, _S6, _S7,
83     _ZERO, _K0, _K1, _RA,
84     _GP,
85     _SP, _FP,
86 #if NEW_ABI
87     _A7, _A6, _A5, _A4,
88 #endif
89     _A3, _A2, _A1, _A0,
90 #define JIT_F0			_F0
91 #define JIT_F1			_F2
92 #define JIT_F2			_F4
93 #define JIT_F3			_F6
94 #define JIT_F4			_F8
95 #define JIT_F5			_F10
96 #if !NEW_ABI
97 #  define JIT_F6		_F16
98 #  define JIT_F7		_F18
99 #endif
100     _F0, _F2, _F4, _F6, _F8, _F10,
101     /* callee save float registers */
102 #if !NEW_ABI
103     _F16, _F18,
104 #endif
105     _F20, _F22, _F24, _F26, _F28, _F30,
106 #if NEW_ABI
107     _F19, _F18, _F17, _F16, _F15, _F14, _F13, _F12,
108 #else
109     _F14, _F12,
110 #endif
111 #define JIT_NOREG		_NOREG
112     _NOREG,
113 } jit_reg_t;
114 
115 #endif /* _jit_mips_h */
116