Merge pull request #377 from pcercuei/libretro
[pcsx_rearmed.git] / deps / lightning / include / lightning / jit_riscv.h
CommitLineData
4a71579b
PC
1/*
2 * Copyright (C) 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_riscv_h
21#define _jit_riscv_h
22
23#define JIT_HASH_CONSTS 0
24#define JIT_NUM_OPERANDS 3
25
26/*
27 * Types
28 */
29#define JIT_FP _FP
30typedef enum {
31#define jit_r(i) (JIT_R0 + (i))
32#define jit_r_num() 7
33#define jit_v(i) (JIT_V0 + (i))
34#define jit_v_num() 11
35#define jit_f(i) (JIT_F0 + (i))
36#define jit_f_num() 12
37 _ZERO, /* x0 - Hard-wired zero --- */
38 _RA, /* x1 - Return address (CalleR save) */
39 _SP, /* x2 - Stack pointer (CalleE save) */
40 _GP, /* x3 - Global pointer --- */
41
42#if 0 /* Pretend it does not exist, so _NOREG can be used in
43 * a 64 bit bitmask */
44 _TP, /* x4 - Thread pointer --- */
45#endif
46
47#define JIT_R0 _T0
48#define JIT_R1 _T1
49#define JIT_R2 _T2
50#define JIT_R3 _T3
51#define JIT_R4 _T4
52#define JIT_R5 _T5
53#define JIT_R6 _T6
54 _T0, /* x5 - Temporary/alternate
55 link register (CalleR save) */
56 _T1, /* x6 - Temporary (CalleR save) */
57 _T2, /* x7 - Temporary (CalleR save) */
58 _T3, /* x28 - Temporary (CalleR save) */
59 _T4, /* x28 - Temporary (CalleR save) */
60 _T5, /* x30 - Temporary (CalleR save) */
61 _T6, /* x31 - Temporary (CalleR save) */
62 _FP, /* x8 - Saved register/frame
63 pointer (CalleE save) */
64 _S0 = _FP,
65#define JIT_V0 _S1
66#define JIT_V1 _S2
67#define JIT_V2 _S3
68#define JIT_V3 _S4
69#define JIT_V4 _S5
70#define JIT_V5 _S6
71#define JIT_V6 _S7
72#define JIT_V7 _S8
73#define JIT_V8 _S9
74#define JIT_V9 _S10
75#define JIT_V10 _S11
76 _S1, /* x9 - Saved register (CalleE save) */
77 _S2, /* x18 - Saved register (CalleE save) */
78 _S3, /* x19 - Saved register (CalleE save) */
79 _S4, /* x20 - Saved register (CalleE save) */
80 _S5, /* x21 - Saved register (CalleE save) */
81 _S6, /* x22 - Saved register (CalleE save) */
82 _S7, /* x23 - Saved register (CalleE save) */
83 _S8, /* x24 - Saved register (CalleE save) */
84 _S9, /* x25 - Saved register (CalleE save) */
85 _S10, /* x26 - Saved register (CalleE save) */
86 _S11, /* x27 - Saved register (CalleE save) */
87 _A7, /* x17 - Function argument (CalleR save) */
88 _A6, /* x16 - Function argument (CalleR save) */
89 _A5, /* x15 - Function argument (CalleR save) */
90 _A4, /* x14 - Function argument (CalleR save) */
91 _A3, /* x13 - Function argument (CalleR save) */
92 _A2, /* x12 - Function argument (CalleR save) */
93 _A1, /* x11 - Function argument/
94 return value (CalleR save) */
95 _A0, /* x10 - Function argument/
96 return value (CalleR save) */
97 _FT0, /* f0 - FP temporary (CalleR save) */
98 _FT1, /* f1 - FP temporary (CalleR save) */
99 _FT2, /* f2 - FP temporary (CalleR save) */
100 _FT3, /* f3 - FP temporary (CalleR save) */
101 _FT4, /* f4 - FP temporary (CalleR save) */
102 _FT5, /* f5 - FP temporary (CalleR save) */
103 _FT6, /* f6 - FP temporary (CalleR save) */
104 _FT7, /* f7 - FP temporary (CalleR save) */
105 _FT8, /* f28 - FP temporary (CalleR save) */
106 _FT9, /* f29 - FP temporary (CalleR save) */
107 _FT10, /* f30 - FP temporary (CalleR save) */
108 _FT11, /* f31 - FP temporary (CalleR save) */
109#define JIT_F0 _FS0
110#define JIT_F1 _FS1
111#define JIT_F2 _FS2
112#define JIT_F3 _FS3
113#define JIT_F4 _FS4
114#define JIT_F5 _FS5
115#define JIT_F6 _FS6
116#define JIT_F7 _FS7
117#define JIT_F8 _FS8
118#define JIT_F9 _FS9
119#define JIT_F10 _FS10
120#define JIT_F11 _FS11
121 _FS0, /* f8 - FP saved register (CalleE save) */
122 _FS1, /* f9 - FP saved register (CalleE save) */
123 _FS2, /* f18 - FP saved register (CalleE save) */
124 _FS3, /* f19 - FP saved register (CalleE save) */
125 _FS4, /* f20 - FP saved register (CalleE save) */
126 _FS5, /* f21 - FP saved register (CalleE save) */
127 _FS6, /* f22 - FP saved register (CalleE save) */
128 _FS7, /* f23 - FP saved register (CalleE save) */
129 _FS8, /* f24 - FP saved register (CalleE save) */
130 _FS9, /* f25 - FP saved register (CalleE save) */
131 _FS10, /* f26 - FP saved register (CalleE save) */
132 _FS11, /* f27 - FP saved register (CalleE save) */
133 _FA7, /* f17 - FP Function argument (CalleR save) */
134 _FA6, /* f16 - FP Function argument (CalleR save) */
135 _FA5, /* f15 - FP Function argument (CalleR save) */
136 _FA4, /* f14 - FP Function argument (CalleR save) */
137 _FA3, /* f13 - FP Function argument (CalleR save) */
138 _FA2, /* f12 - FP Function argument (CalleR save) */
139 _FA1, /* f11 - FP function argument/
140 return value (CalleR save) */
141 _FA0, /* f10 - FP function argument/
142 return value (CalleR save) */
143 _NOREG,
144#define JIT_NOREG _NOREG
145} jit_reg_t;
146
147#endif /* _jit_riscv_h */