1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/*
* Copyright (C) 2019 Free Software Foundation, Inc.
*
* This file is part of GNU lightning.
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* Authors:
* Paulo Cesar Pereira de Andrade
*/
#ifndef _jit_riscv_h
#define _jit_riscv_h
#define JIT_HASH_CONSTS 0
#define JIT_NUM_OPERANDS 3
/*
* Types
*/
#define JIT_FP _FP
typedef enum {
#define jit_r(i) (JIT_R0 + (i))
#define jit_r_num() 7
#define jit_v(i) (JIT_V0 + (i))
#define jit_v_num() 11
#define jit_f(i) (JIT_F0 + (i))
#define jit_f_num() 12
_ZERO, /* x0 - Hard-wired zero --- */
_RA, /* x1 - Return address (CalleR save) */
_SP, /* x2 - Stack pointer (CalleE save) */
_GP, /* x3 - Global pointer --- */
#if 0 /* Pretend it does not exist, so _NOREG can be used in
* a 64 bit bitmask */
_TP, /* x4 - Thread pointer --- */
#endif
#define JIT_R0 _T0
#define JIT_R1 _T1
#define JIT_R2 _T2
#define JIT_R3 _T3
#define JIT_R4 _T4
#define JIT_R5 _T5
#define JIT_R6 _T6
_T0, /* x5 - Temporary/alternate
link register (CalleR save) */
_T1, /* x6 - Temporary (CalleR save) */
_T2, /* x7 - Temporary (CalleR save) */
_T3, /* x28 - Temporary (CalleR save) */
_T4, /* x28 - Temporary (CalleR save) */
_T5, /* x30 - Temporary (CalleR save) */
_T6, /* x31 - Temporary (CalleR save) */
_FP, /* x8 - Saved register/frame
pointer (CalleE save) */
_S0 = _FP,
#define JIT_V0 _S1
#define JIT_V1 _S2
#define JIT_V2 _S3
#define JIT_V3 _S4
#define JIT_V4 _S5
#define JIT_V5 _S6
#define JIT_V6 _S7
#define JIT_V7 _S8
#define JIT_V8 _S9
#define JIT_V9 _S10
#define JIT_V10 _S11
_S1, /* x9 - Saved register (CalleE save) */
_S2, /* x18 - Saved register (CalleE save) */
_S3, /* x19 - Saved register (CalleE save) */
_S4, /* x20 - Saved register (CalleE save) */
_S5, /* x21 - Saved register (CalleE save) */
_S6, /* x22 - Saved register (CalleE save) */
_S7, /* x23 - Saved register (CalleE save) */
_S8, /* x24 - Saved register (CalleE save) */
_S9, /* x25 - Saved register (CalleE save) */
_S10, /* x26 - Saved register (CalleE save) */
_S11, /* x27 - Saved register (CalleE save) */
_A7, /* x17 - Function argument (CalleR save) */
_A6, /* x16 - Function argument (CalleR save) */
_A5, /* x15 - Function argument (CalleR save) */
_A4, /* x14 - Function argument (CalleR save) */
_A3, /* x13 - Function argument (CalleR save) */
_A2, /* x12 - Function argument (CalleR save) */
_A1, /* x11 - Function argument/
return value (CalleR save) */
_A0, /* x10 - Function argument/
return value (CalleR save) */
_FT0, /* f0 - FP temporary (CalleR save) */
_FT1, /* f1 - FP temporary (CalleR save) */
_FT2, /* f2 - FP temporary (CalleR save) */
_FT3, /* f3 - FP temporary (CalleR save) */
_FT4, /* f4 - FP temporary (CalleR save) */
_FT5, /* f5 - FP temporary (CalleR save) */
_FT6, /* f6 - FP temporary (CalleR save) */
_FT7, /* f7 - FP temporary (CalleR save) */
_FT8, /* f28 - FP temporary (CalleR save) */
_FT9, /* f29 - FP temporary (CalleR save) */
_FT10, /* f30 - FP temporary (CalleR save) */
_FT11, /* f31 - FP temporary (CalleR save) */
#define JIT_F0 _FS0
#define JIT_F1 _FS1
#define JIT_F2 _FS2
#define JIT_F3 _FS3
#define JIT_F4 _FS4
#define JIT_F5 _FS5
#define JIT_F6 _FS6
#define JIT_F7 _FS7
#define JIT_F8 _FS8
#define JIT_F9 _FS9
#define JIT_F10 _FS10
#define JIT_F11 _FS11
_FS0, /* f8 - FP saved register (CalleE save) */
_FS1, /* f9 - FP saved register (CalleE save) */
_FS2, /* f18 - FP saved register (CalleE save) */
_FS3, /* f19 - FP saved register (CalleE save) */
_FS4, /* f20 - FP saved register (CalleE save) */
_FS5, /* f21 - FP saved register (CalleE save) */
_FS6, /* f22 - FP saved register (CalleE save) */
_FS7, /* f23 - FP saved register (CalleE save) */
_FS8, /* f24 - FP saved register (CalleE save) */
_FS9, /* f25 - FP saved register (CalleE save) */
_FS10, /* f26 - FP saved register (CalleE save) */
_FS11, /* f27 - FP saved register (CalleE save) */
_FA7, /* f17 - FP Function argument (CalleR save) */
_FA6, /* f16 - FP Function argument (CalleR save) */
_FA5, /* f15 - FP Function argument (CalleR save) */
_FA4, /* f14 - FP Function argument (CalleR save) */
_FA3, /* f13 - FP Function argument (CalleR save) */
_FA2, /* f12 - FP Function argument (CalleR save) */
_FA1, /* f11 - FP function argument/
return value (CalleR save) */
_FA0, /* f10 - FP function argument/
return value (CalleR save) */
_NOREG,
#define JIT_NOREG _NOREG
} jit_reg_t;
#endif /* _jit_riscv_h */
|