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 | emitPseudoExpansionLowering(MCStreamer &OutStreamer, |
11 | const MachineInstr *MI) { |
12 | switch (MI->getOpcode()) { |
13 | default: return false; |
14 | case RISCV::PseudoBR: { |
15 | MCInst TmpInst; |
16 | MCOperand MCOp; |
17 | TmpInst.setOpcode(RISCV::JAL); |
18 | // Operand: rd |
19 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
20 | // Operand: imm20 |
21 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
22 | TmpInst.addOperand(Op: MCOp); |
23 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
24 | break; |
25 | } |
26 | case RISCV::PseudoBRIND: { |
27 | MCInst TmpInst; |
28 | MCOperand MCOp; |
29 | TmpInst.setOpcode(RISCV::JALR); |
30 | // Operand: rd |
31 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
32 | // Operand: rs1 |
33 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
34 | TmpInst.addOperand(Op: MCOp); |
35 | // Operand: imm12 |
36 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
37 | TmpInst.addOperand(Op: MCOp); |
38 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
39 | break; |
40 | } |
41 | case RISCV::PseudoBRINDNonX7: { |
42 | MCInst TmpInst; |
43 | MCOperand MCOp; |
44 | TmpInst.setOpcode(RISCV::JALR); |
45 | // Operand: rd |
46 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
47 | // Operand: rs1 |
48 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
49 | TmpInst.addOperand(Op: MCOp); |
50 | // Operand: imm12 |
51 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
52 | TmpInst.addOperand(Op: MCOp); |
53 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
54 | break; |
55 | } |
56 | case RISCV::PseudoBRINDX7: { |
57 | MCInst TmpInst; |
58 | MCOperand MCOp; |
59 | TmpInst.setOpcode(RISCV::JALR); |
60 | // Operand: rd |
61 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
62 | // Operand: rs1 |
63 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
64 | TmpInst.addOperand(Op: MCOp); |
65 | // Operand: imm12 |
66 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
67 | TmpInst.addOperand(Op: MCOp); |
68 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
69 | break; |
70 | } |
71 | case RISCV::PseudoCALLIndirect: { |
72 | MCInst TmpInst; |
73 | MCOperand MCOp; |
74 | TmpInst.setOpcode(RISCV::JALR); |
75 | // Operand: rd |
76 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
77 | // Operand: rs1 |
78 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
79 | TmpInst.addOperand(Op: MCOp); |
80 | // Operand: imm12 |
81 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 0)); |
82 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
83 | break; |
84 | } |
85 | case RISCV::PseudoCALLIndirectNonX7: { |
86 | MCInst TmpInst; |
87 | MCOperand MCOp; |
88 | TmpInst.setOpcode(RISCV::JALR); |
89 | // Operand: rd |
90 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
91 | // Operand: rs1 |
92 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
93 | TmpInst.addOperand(Op: MCOp); |
94 | // Operand: imm12 |
95 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 0)); |
96 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
97 | break; |
98 | } |
99 | case RISCV::PseudoRET: { |
100 | MCInst TmpInst; |
101 | MCOperand MCOp; |
102 | TmpInst.setOpcode(RISCV::JALR); |
103 | // Operand: rd |
104 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
105 | // Operand: rs1 |
106 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X1)); |
107 | // Operand: imm12 |
108 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 0)); |
109 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
110 | break; |
111 | } |
112 | case RISCV::PseudoReadVL: { |
113 | MCInst TmpInst; |
114 | MCOperand MCOp; |
115 | TmpInst.setOpcode(RISCV::CSRRS); |
116 | // Operand: rd |
117 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
118 | TmpInst.addOperand(Op: MCOp); |
119 | // Operand: imm12 |
120 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 3104)); |
121 | // Operand: rs1 |
122 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
123 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
124 | break; |
125 | } |
126 | case RISCV::PseudoReadVLENB: { |
127 | MCInst TmpInst; |
128 | MCOperand MCOp; |
129 | TmpInst.setOpcode(RISCV::CSRRS); |
130 | // Operand: rd |
131 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
132 | TmpInst.addOperand(Op: MCOp); |
133 | // Operand: imm12 |
134 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 3106)); |
135 | // Operand: rs1 |
136 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
137 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
138 | break; |
139 | } |
140 | case RISCV::PseudoTAILIndirect: { |
141 | MCInst TmpInst; |
142 | MCOperand MCOp; |
143 | TmpInst.setOpcode(RISCV::JALR); |
144 | // Operand: rd |
145 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
146 | // Operand: rs1 |
147 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
148 | TmpInst.addOperand(Op: MCOp); |
149 | // Operand: imm12 |
150 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 0)); |
151 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
152 | break; |
153 | } |
154 | case RISCV::PseudoTAILIndirectNonX7: { |
155 | MCInst TmpInst; |
156 | MCOperand MCOp; |
157 | TmpInst.setOpcode(RISCV::JALR); |
158 | // Operand: rd |
159 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
160 | // Operand: rs1 |
161 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
162 | TmpInst.addOperand(Op: MCOp); |
163 | // Operand: imm12 |
164 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 0)); |
165 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
166 | break; |
167 | } |
168 | case RISCV::ReadFFLAGS: { |
169 | MCInst TmpInst; |
170 | MCOperand MCOp; |
171 | TmpInst.setOpcode(RISCV::CSRRS); |
172 | // Operand: rd |
173 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
174 | TmpInst.addOperand(Op: MCOp); |
175 | // Operand: imm12 |
176 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 1)); |
177 | // Operand: rs1 |
178 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
179 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
180 | break; |
181 | } |
182 | case RISCV::ReadFRM: { |
183 | MCInst TmpInst; |
184 | MCOperand MCOp; |
185 | TmpInst.setOpcode(RISCV::CSRRS); |
186 | // Operand: rd |
187 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
188 | TmpInst.addOperand(Op: MCOp); |
189 | // Operand: imm12 |
190 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 2)); |
191 | // Operand: rs1 |
192 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
193 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
194 | break; |
195 | } |
196 | case RISCV::SwapFRMImm: { |
197 | MCInst TmpInst; |
198 | MCOperand MCOp; |
199 | TmpInst.setOpcode(RISCV::CSRRWI); |
200 | // Operand: rd |
201 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
202 | TmpInst.addOperand(Op: MCOp); |
203 | // Operand: imm12 |
204 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 2)); |
205 | // Operand: rs1 |
206 | lowerOperand(MO: MI->getOperand(i: 1), MCOp); |
207 | TmpInst.addOperand(Op: MCOp); |
208 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
209 | break; |
210 | } |
211 | case RISCV::WriteFFLAGS: { |
212 | MCInst TmpInst; |
213 | MCOperand MCOp; |
214 | TmpInst.setOpcode(RISCV::CSRRW); |
215 | // Operand: rd |
216 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
217 | // Operand: imm12 |
218 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 1)); |
219 | // Operand: rs1 |
220 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
221 | TmpInst.addOperand(Op: MCOp); |
222 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
223 | break; |
224 | } |
225 | case RISCV::WriteFRM: { |
226 | MCInst TmpInst; |
227 | MCOperand MCOp; |
228 | TmpInst.setOpcode(RISCV::CSRRW); |
229 | // Operand: rd |
230 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
231 | // Operand: imm12 |
232 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 2)); |
233 | // Operand: rs1 |
234 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
235 | TmpInst.addOperand(Op: MCOp); |
236 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
237 | break; |
238 | } |
239 | case RISCV::WriteFRMImm: { |
240 | MCInst TmpInst; |
241 | MCOperand MCOp; |
242 | TmpInst.setOpcode(RISCV::CSRRWI); |
243 | // Operand: rd |
244 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
245 | // Operand: imm12 |
246 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 2)); |
247 | // Operand: rs1 |
248 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
249 | TmpInst.addOperand(Op: MCOp); |
250 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
251 | break; |
252 | } |
253 | case RISCV::WriteVXRMImm: { |
254 | MCInst TmpInst; |
255 | MCOperand MCOp; |
256 | TmpInst.setOpcode(RISCV::CSRRWI); |
257 | // Operand: rd |
258 | TmpInst.addOperand(Op: MCOperand::createReg(Reg: RISCV::X0)); |
259 | // Operand: imm12 |
260 | TmpInst.addOperand(Op: MCOperand::createImm(Val: 10)); |
261 | // Operand: rs1 |
262 | lowerOperand(MO: MI->getOperand(i: 0), MCOp); |
263 | TmpInst.addOperand(Op: MCOp); |
264 | EmitToStreamer(S&: OutStreamer, Inst: TmpInst); |
265 | break; |
266 | } |
267 | } |
268 | return true; |
269 | } |
270 | |
271 | |