1 /*
  2  * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  4  * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. All rights reserved.
  5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  6  *
  7  * This code is free software; you can redistribute it and/or modify it
  8  * under the terms of the GNU General Public License version 2 only, as
  9  * published by the Free Software Foundation.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  *
 25  */
 26 
 27 #include "precompiled.hpp"
 28 #include "asm/assembler.hpp"
 29 #include "asm/macroAssembler.inline.hpp"
 30 #include "asm/register.hpp"
 31 #include "interp_masm_riscv.hpp"
 32 #include "register_riscv.hpp"
 33 
 34 REGISTER_DEFINITION(Register, noreg);
 35 
 36 REGISTER_DEFINITION(Register, x0);
 37 REGISTER_DEFINITION(Register, x1);
 38 REGISTER_DEFINITION(Register, x2);
 39 REGISTER_DEFINITION(Register, x3);
 40 REGISTER_DEFINITION(Register, x4);
 41 REGISTER_DEFINITION(Register, x5);
 42 REGISTER_DEFINITION(Register, x6);
 43 REGISTER_DEFINITION(Register, x7);
 44 REGISTER_DEFINITION(Register, x8);
 45 REGISTER_DEFINITION(Register, x9);
 46 REGISTER_DEFINITION(Register, x10);
 47 REGISTER_DEFINITION(Register, x11);
 48 REGISTER_DEFINITION(Register, x12);
 49 REGISTER_DEFINITION(Register, x13);
 50 REGISTER_DEFINITION(Register, x14);
 51 REGISTER_DEFINITION(Register, x15);
 52 REGISTER_DEFINITION(Register, x16);
 53 REGISTER_DEFINITION(Register, x17);
 54 REGISTER_DEFINITION(Register, x18);
 55 REGISTER_DEFINITION(Register, x19);
 56 REGISTER_DEFINITION(Register, x20);
 57 REGISTER_DEFINITION(Register, x21);
 58 REGISTER_DEFINITION(Register, x22);
 59 REGISTER_DEFINITION(Register, x23);
 60 REGISTER_DEFINITION(Register, x24);
 61 REGISTER_DEFINITION(Register, x25);
 62 REGISTER_DEFINITION(Register, x26);
 63 REGISTER_DEFINITION(Register, x27);
 64 REGISTER_DEFINITION(Register, x28);
 65 REGISTER_DEFINITION(Register, x29);
 66 REGISTER_DEFINITION(Register, x30);
 67 REGISTER_DEFINITION(Register, x31);
 68 
 69 REGISTER_DEFINITION(FloatRegister, fnoreg);
 70 
 71 REGISTER_DEFINITION(FloatRegister, f0);
 72 REGISTER_DEFINITION(FloatRegister, f1);
 73 REGISTER_DEFINITION(FloatRegister, f2);
 74 REGISTER_DEFINITION(FloatRegister, f3);
 75 REGISTER_DEFINITION(FloatRegister, f4);
 76 REGISTER_DEFINITION(FloatRegister, f5);
 77 REGISTER_DEFINITION(FloatRegister, f6);
 78 REGISTER_DEFINITION(FloatRegister, f7);
 79 REGISTER_DEFINITION(FloatRegister, f8);
 80 REGISTER_DEFINITION(FloatRegister, f9);
 81 REGISTER_DEFINITION(FloatRegister, f10);
 82 REGISTER_DEFINITION(FloatRegister, f11);
 83 REGISTER_DEFINITION(FloatRegister, f12);
 84 REGISTER_DEFINITION(FloatRegister, f13);
 85 REGISTER_DEFINITION(FloatRegister, f14);
 86 REGISTER_DEFINITION(FloatRegister, f15);
 87 REGISTER_DEFINITION(FloatRegister, f16);
 88 REGISTER_DEFINITION(FloatRegister, f17);
 89 REGISTER_DEFINITION(FloatRegister, f18);
 90 REGISTER_DEFINITION(FloatRegister, f19);
 91 REGISTER_DEFINITION(FloatRegister, f20);
 92 REGISTER_DEFINITION(FloatRegister, f21);
 93 REGISTER_DEFINITION(FloatRegister, f22);
 94 REGISTER_DEFINITION(FloatRegister, f23);
 95 REGISTER_DEFINITION(FloatRegister, f24);
 96 REGISTER_DEFINITION(FloatRegister, f25);
 97 REGISTER_DEFINITION(FloatRegister, f26);
 98 REGISTER_DEFINITION(FloatRegister, f27);
 99 REGISTER_DEFINITION(FloatRegister, f28);
100 REGISTER_DEFINITION(FloatRegister, f29);
101 REGISTER_DEFINITION(FloatRegister, f30);
102 REGISTER_DEFINITION(FloatRegister, f31);
103 
104 REGISTER_DEFINITION(VectorRegister, vnoreg);
105 
106 REGISTER_DEFINITION(VectorRegister, v0);
107 REGISTER_DEFINITION(VectorRegister, v1);
108 REGISTER_DEFINITION(VectorRegister, v2);
109 REGISTER_DEFINITION(VectorRegister, v3);
110 REGISTER_DEFINITION(VectorRegister, v4);
111 REGISTER_DEFINITION(VectorRegister, v5);
112 REGISTER_DEFINITION(VectorRegister, v6);
113 REGISTER_DEFINITION(VectorRegister, v7);
114 REGISTER_DEFINITION(VectorRegister, v8);
115 REGISTER_DEFINITION(VectorRegister, v9);
116 REGISTER_DEFINITION(VectorRegister, v10);
117 REGISTER_DEFINITION(VectorRegister, v11);
118 REGISTER_DEFINITION(VectorRegister, v12);
119 REGISTER_DEFINITION(VectorRegister, v13);
120 REGISTER_DEFINITION(VectorRegister, v14);
121 REGISTER_DEFINITION(VectorRegister, v15);
122 REGISTER_DEFINITION(VectorRegister, v16);
123 REGISTER_DEFINITION(VectorRegister, v17);
124 REGISTER_DEFINITION(VectorRegister, v18);
125 REGISTER_DEFINITION(VectorRegister, v19);
126 REGISTER_DEFINITION(VectorRegister, v20);
127 REGISTER_DEFINITION(VectorRegister, v21);
128 REGISTER_DEFINITION(VectorRegister, v22);
129 REGISTER_DEFINITION(VectorRegister, v23);
130 REGISTER_DEFINITION(VectorRegister, v24);
131 REGISTER_DEFINITION(VectorRegister, v25);
132 REGISTER_DEFINITION(VectorRegister, v26);
133 REGISTER_DEFINITION(VectorRegister, v27);
134 REGISTER_DEFINITION(VectorRegister, v28);
135 REGISTER_DEFINITION(VectorRegister, v29);
136 REGISTER_DEFINITION(VectorRegister, v30);
137 REGISTER_DEFINITION(VectorRegister, v31);
138 
139 REGISTER_DEFINITION(Register, c_rarg0);
140 REGISTER_DEFINITION(Register, c_rarg1);
141 REGISTER_DEFINITION(Register, c_rarg2);
142 REGISTER_DEFINITION(Register, c_rarg3);
143 REGISTER_DEFINITION(Register, c_rarg4);
144 REGISTER_DEFINITION(Register, c_rarg5);
145 REGISTER_DEFINITION(Register, c_rarg6);
146 REGISTER_DEFINITION(Register, c_rarg7);
147 
148 REGISTER_DEFINITION(FloatRegister, c_farg0);
149 REGISTER_DEFINITION(FloatRegister, c_farg1);
150 REGISTER_DEFINITION(FloatRegister, c_farg2);
151 REGISTER_DEFINITION(FloatRegister, c_farg3);
152 REGISTER_DEFINITION(FloatRegister, c_farg4);
153 REGISTER_DEFINITION(FloatRegister, c_farg5);
154 REGISTER_DEFINITION(FloatRegister, c_farg6);
155 REGISTER_DEFINITION(FloatRegister, c_farg7);
156 
157 REGISTER_DEFINITION(Register, j_rarg0);
158 REGISTER_DEFINITION(Register, j_rarg1);
159 REGISTER_DEFINITION(Register, j_rarg2);
160 REGISTER_DEFINITION(Register, j_rarg3);
161 REGISTER_DEFINITION(Register, j_rarg4);
162 REGISTER_DEFINITION(Register, j_rarg5);
163 REGISTER_DEFINITION(Register, j_rarg6);
164 REGISTER_DEFINITION(Register, j_rarg7);
165 
166 REGISTER_DEFINITION(FloatRegister, j_farg0);
167 REGISTER_DEFINITION(FloatRegister, j_farg1);
168 REGISTER_DEFINITION(FloatRegister, j_farg2);
169 REGISTER_DEFINITION(FloatRegister, j_farg3);
170 REGISTER_DEFINITION(FloatRegister, j_farg4);
171 REGISTER_DEFINITION(FloatRegister, j_farg5);
172 REGISTER_DEFINITION(FloatRegister, j_farg6);
173 REGISTER_DEFINITION(FloatRegister, j_farg7);
174 
175 REGISTER_DEFINITION(Register, zr);
176 REGISTER_DEFINITION(Register, gp);
177 REGISTER_DEFINITION(Register, tp);
178 REGISTER_DEFINITION(Register, xmethod);
179 REGISTER_DEFINITION(Register, ra);
180 REGISTER_DEFINITION(Register, lr);
181 REGISTER_DEFINITION(Register, sp);
182 REGISTER_DEFINITION(Register, fp);
183 REGISTER_DEFINITION(Register, xheapbase);
184 REGISTER_DEFINITION(Register, xcpool);
185 REGISTER_DEFINITION(Register, xmonitors);
186 REGISTER_DEFINITION(Register, xlocals);
187 REGISTER_DEFINITION(Register, xthread);
188 REGISTER_DEFINITION(Register, xbcp);
189 REGISTER_DEFINITION(Register, xdispatch);
190 REGISTER_DEFINITION(Register, esp);
191 
192 REGISTER_DEFINITION(Register, t0);
193 REGISTER_DEFINITION(Register, t1);
194 REGISTER_DEFINITION(Register, t2);