1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | |* *| |
3 | |* Pseudo-instruction MC lowering Source Fragment *| |
4 | |* *| |
5 | |* Automatically generated file, do not edit! *| |
6 | |* *| |
7 | \*===----------------------------------------------------------------------===*/ |
8 | |
9 | bool RISCVAsmPrinter:: |
10 | lowerPseudoInstExpansion(const MachineInstr *MI, MCInst &Inst) { |
11 | Inst.clear(); |
12 | switch (MI->getOpcode()) { |
13 | default: return false; |
14 | case RISCV::PseudoBR: { |
15 | MCOperand MCOp; |
16 | Inst.setOpcode(RISCV::JAL); |
17 | // Operand: rd |
18 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
19 | // Operand: imm20 |
20 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
21 | Inst.addOperand(Op: MCOp); |
22 | break; |
23 | } |
24 | case RISCV::PseudoBRIND: { |
25 | MCOperand MCOp; |
26 | Inst.setOpcode(RISCV::JALR); |
27 | // Operand: rd |
28 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
29 | // Operand: rs1 |
30 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
31 | Inst.addOperand(Op: MCOp); |
32 | // Operand: imm12 |
33 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
34 | Inst.addOperand(Op: MCOp); |
35 | break; |
36 | } |
37 | case RISCV::PseudoBRINDNonX7: { |
38 | MCOperand MCOp; |
39 | Inst.setOpcode(RISCV::JALR); |
40 | // Operand: rd |
41 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
42 | // Operand: rs1 |
43 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
44 | Inst.addOperand(Op: MCOp); |
45 | // Operand: imm12 |
46 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
47 | Inst.addOperand(Op: MCOp); |
48 | break; |
49 | } |
50 | case RISCV::PseudoBRINDX7: { |
51 | MCOperand MCOp; |
52 | Inst.setOpcode(RISCV::JALR); |
53 | // Operand: rd |
54 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
55 | // Operand: rs1 |
56 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
57 | Inst.addOperand(Op: MCOp); |
58 | // Operand: imm12 |
59 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
60 | Inst.addOperand(Op: MCOp); |
61 | break; |
62 | } |
63 | case RISCV::PseudoCALLIndirect: { |
64 | MCOperand MCOp; |
65 | Inst.setOpcode(RISCV::JALR); |
66 | // Operand: rd |
67 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
68 | // Operand: rs1 |
69 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
70 | Inst.addOperand(Op: MCOp); |
71 | // Operand: imm12 |
72 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
73 | break; |
74 | } |
75 | case RISCV::PseudoCALLIndirectNonX7: { |
76 | MCOperand MCOp; |
77 | Inst.setOpcode(RISCV::JALR); |
78 | // Operand: rd |
79 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
80 | // Operand: rs1 |
81 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
82 | Inst.addOperand(Op: MCOp); |
83 | // Operand: imm12 |
84 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
85 | break; |
86 | } |
87 | case RISCV::PseudoCALLIndirectX7: { |
88 | MCOperand MCOp; |
89 | Inst.setOpcode(RISCV::JALR); |
90 | // Operand: rd |
91 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
92 | // Operand: rs1 |
93 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
94 | Inst.addOperand(Op: MCOp); |
95 | // Operand: imm12 |
96 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
97 | break; |
98 | } |
99 | case RISCV::PseudoRET: { |
100 | MCOperand MCOp; |
101 | Inst.setOpcode(RISCV::JALR); |
102 | // Operand: rd |
103 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
104 | // Operand: rs1 |
105 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
106 | // Operand: imm12 |
107 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
108 | break; |
109 | } |
110 | case RISCV::PseudoReadVL: { |
111 | MCOperand MCOp; |
112 | Inst.setOpcode(RISCV::CSRRS); |
113 | // Operand: rd |
114 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
115 | Inst.addOperand(Op: MCOp); |
116 | // Operand: imm12 |
117 | Inst.addOperand(Op: MCOperand::createImm(Val: 3104)); |
118 | // Operand: rs1 |
119 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
120 | break; |
121 | } |
122 | case RISCV::PseudoReadVLENB: { |
123 | MCOperand MCOp; |
124 | Inst.setOpcode(RISCV::CSRRS); |
125 | // Operand: rd |
126 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
127 | Inst.addOperand(Op: MCOp); |
128 | // Operand: imm12 |
129 | Inst.addOperand(Op: MCOperand::createImm(Val: 3106)); |
130 | // Operand: rs1 |
131 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
132 | break; |
133 | } |
134 | case RISCV::PseudoTAILIndirect: { |
135 | MCOperand MCOp; |
136 | Inst.setOpcode(RISCV::JALR); |
137 | // Operand: rd |
138 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
139 | // Operand: rs1 |
140 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
141 | Inst.addOperand(Op: MCOp); |
142 | // Operand: imm12 |
143 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
144 | break; |
145 | } |
146 | case RISCV::PseudoTAILIndirectNonX7: { |
147 | MCOperand MCOp; |
148 | Inst.setOpcode(RISCV::JALR); |
149 | // Operand: rd |
150 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
151 | // Operand: rs1 |
152 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
153 | Inst.addOperand(Op: MCOp); |
154 | // Operand: imm12 |
155 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
156 | break; |
157 | } |
158 | case RISCV::PseudoTAILIndirectX7: { |
159 | MCOperand MCOp; |
160 | Inst.setOpcode(RISCV::JALR); |
161 | // Operand: rd |
162 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
163 | // Operand: rs1 |
164 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
165 | Inst.addOperand(Op: MCOp); |
166 | // Operand: imm12 |
167 | Inst.addOperand(Op: MCOperand::createImm(Val: 0)); |
168 | break; |
169 | } |
170 | case RISCV::PseudoVSETIVLI: { |
171 | MCOperand MCOp; |
172 | Inst.setOpcode(RISCV::VSETIVLI); |
173 | // Operand: rd |
174 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
175 | Inst.addOperand(Op: MCOp); |
176 | // Operand: uimm |
177 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
178 | Inst.addOperand(Op: MCOp); |
179 | // Operand: vtypei |
180 | lowerOperand(MO: MI->getOperand(i: 2), MCOp); |
181 | Inst.addOperand(Op: MCOp); |
182 | break; |
183 | } |
184 | case RISCV::PseudoVSETVLI: { |
185 | MCOperand MCOp; |
186 | Inst.setOpcode(RISCV::VSETVLI); |
187 | // Operand: rd |
188 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
189 | Inst.addOperand(Op: MCOp); |
190 | // Operand: rs1 |
191 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
192 | Inst.addOperand(Op: MCOp); |
193 | // Operand: vtypei |
194 | lowerOperand(MO: MI->getOperand(i: 2), MCOp); |
195 | Inst.addOperand(Op: MCOp); |
196 | break; |
197 | } |
198 | case RISCV::PseudoVSETVLIX0: { |
199 | MCOperand MCOp; |
200 | Inst.setOpcode(RISCV::VSETVLI); |
201 | // Operand: rd |
202 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
203 | Inst.addOperand(Op: MCOp); |
204 | // Operand: rs1 |
205 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
206 | Inst.addOperand(Op: MCOp); |
207 | // Operand: vtypei |
208 | lowerOperand(MO: MI->getOperand(i: 2), MCOp); |
209 | Inst.addOperand(Op: MCOp); |
210 | break; |
211 | } |
212 | case RISCV::PseudoVSETVLIX0X0: { |
213 | MCOperand MCOp; |
214 | Inst.setOpcode(RISCV::VSETVLI); |
215 | // Operand: rd |
216 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
217 | Inst.addOperand(Op: MCOp); |
218 | // Operand: rs1 |
219 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
220 | Inst.addOperand(Op: MCOp); |
221 | // Operand: vtypei |
222 | lowerOperand(MO: MI->getOperand(i: 2), MCOp); |
223 | Inst.addOperand(Op: MCOp); |
224 | break; |
225 | } |
226 | case RISCV::ReadFCSR: { |
227 | MCOperand MCOp; |
228 | Inst.setOpcode(RISCV::CSRRS); |
229 | // Operand: rd |
230 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
231 | Inst.addOperand(Op: MCOp); |
232 | // Operand: imm12 |
233 | Inst.addOperand(Op: MCOperand::createImm(Val: 3)); |
234 | // Operand: rs1 |
235 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
236 | break; |
237 | } |
238 | case RISCV::ReadFFLAGS: { |
239 | MCOperand MCOp; |
240 | Inst.setOpcode(RISCV::CSRRS); |
241 | // Operand: rd |
242 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
243 | Inst.addOperand(Op: MCOp); |
244 | // Operand: imm12 |
245 | Inst.addOperand(Op: MCOperand::createImm(Val: 1)); |
246 | // Operand: rs1 |
247 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
248 | break; |
249 | } |
250 | case RISCV::ReadFRM: { |
251 | MCOperand MCOp; |
252 | Inst.setOpcode(RISCV::CSRRS); |
253 | // Operand: rd |
254 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
255 | Inst.addOperand(Op: MCOp); |
256 | // Operand: imm12 |
257 | Inst.addOperand(Op: MCOperand::createImm(Val: 2)); |
258 | // Operand: rs1 |
259 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
260 | break; |
261 | } |
262 | case RISCV::SwapFRMImm: { |
263 | MCOperand MCOp; |
264 | Inst.setOpcode(RISCV::CSRRWI); |
265 | // Operand: rd |
266 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
267 | Inst.addOperand(Op: MCOp); |
268 | // Operand: imm12 |
269 | Inst.addOperand(Op: MCOperand::createImm(Val: 2)); |
270 | // Operand: rs1 |
271 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
272 | Inst.addOperand(Op: MCOp); |
273 | break; |
274 | } |
275 | case RISCV::WriteFCSR: { |
276 | MCOperand MCOp; |
277 | Inst.setOpcode(RISCV::CSRRW); |
278 | // Operand: rd |
279 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
280 | // Operand: imm12 |
281 | Inst.addOperand(Op: MCOperand::createImm(Val: 3)); |
282 | // Operand: rs1 |
283 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
284 | Inst.addOperand(Op: MCOp); |
285 | break; |
286 | } |
287 | case RISCV::WriteFCSRImm: { |
288 | MCOperand MCOp; |
289 | Inst.setOpcode(RISCV::CSRRWI); |
290 | // Operand: rd |
291 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
292 | // Operand: imm12 |
293 | Inst.addOperand(Op: MCOperand::createImm(Val: 3)); |
294 | // Operand: rs1 |
295 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
296 | Inst.addOperand(Op: MCOp); |
297 | break; |
298 | } |
299 | case RISCV::WriteFFLAGS: { |
300 | MCOperand MCOp; |
301 | Inst.setOpcode(RISCV::CSRRW); |
302 | // Operand: rd |
303 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
304 | // Operand: imm12 |
305 | Inst.addOperand(Op: MCOperand::createImm(Val: 1)); |
306 | // Operand: rs1 |
307 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
308 | Inst.addOperand(Op: MCOp); |
309 | break; |
310 | } |
311 | case RISCV::WriteFRM: { |
312 | MCOperand MCOp; |
313 | Inst.setOpcode(RISCV::CSRRW); |
314 | // Operand: rd |
315 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
316 | // Operand: imm12 |
317 | Inst.addOperand(Op: MCOperand::createImm(Val: 2)); |
318 | // Operand: rs1 |
319 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
320 | Inst.addOperand(Op: MCOp); |
321 | break; |
322 | } |
323 | case RISCV::WriteFRMImm: { |
324 | MCOperand MCOp; |
325 | Inst.setOpcode(RISCV::CSRRWI); |
326 | // Operand: rd |
327 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
328 | // Operand: imm12 |
329 | Inst.addOperand(Op: MCOperand::createImm(Val: 2)); |
330 | // Operand: rs1 |
331 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
332 | Inst.addOperand(Op: MCOp); |
333 | break; |
334 | } |
335 | case RISCV::WriteVXRMImm: { |
336 | MCOperand MCOp; |
337 | Inst.setOpcode(RISCV::CSRRWI); |
338 | // Operand: rd |
339 | Inst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
340 | // Operand: imm12 |
341 | Inst.addOperand(Op: MCOperand::createImm(Val: 10)); |
342 | // Operand: rs1 |
343 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
344 | Inst.addOperand(Op: MCOp); |
345 | break; |
346 | } |
347 | } |
348 | return true; |
349 | } |
350 | |
351 | |