1 //===-- ARMExpandPseudoInsts.cpp - Expand pseudo instructions -----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains a pass that expands pseudo instructions into target
11 // instructions to allow proper scheduling, if-conversion, and other late
12 // optimizations. This pass should be run after register allocation but before
13 // the post-regalloc scheduling pass.
15 //===----------------------------------------------------------------------===//
17 #define DEBUG_TYPE "arm-pseudo"
19 #include "ARMBaseInstrInfo.h"
20 #include "ARMRegisterInfo.h"
21 #include "llvm/CodeGen/MachineFunctionPass.h"
22 #include "llvm/CodeGen/MachineInstrBuilder.h"
23 #include "llvm/Target/TargetRegisterInfo.h"
27 class ARMExpandPseudo : public MachineFunctionPass {
30 ARMExpandPseudo() : MachineFunctionPass(ID) {}
32 const TargetInstrInfo *TII;
33 const TargetRegisterInfo *TRI;
35 virtual bool runOnMachineFunction(MachineFunction &Fn);
37 virtual const char *getPassName() const {
38 return "ARM pseudo instruction expansion pass";
42 void TransferImpOps(MachineInstr &OldMI,
43 MachineInstrBuilder &UseMI, MachineInstrBuilder &DefMI);
44 bool ExpandMBB(MachineBasicBlock &MBB);
45 void ExpandVLD(MachineBasicBlock::iterator &MBBI);
46 void ExpandVST(MachineBasicBlock::iterator &MBBI);
47 void ExpandLaneOp(MachineBasicBlock::iterator &MBBI);
48 void ExpandVTBL(MachineBasicBlock::iterator &MBBI,
49 unsigned Opc, bool IsExt, unsigned NumRegs);
51 char ARMExpandPseudo::ID = 0;
54 /// TransferImpOps - Transfer implicit operands on the pseudo instruction to
55 /// the instructions created from the expansion.
56 void ARMExpandPseudo::TransferImpOps(MachineInstr &OldMI,
57 MachineInstrBuilder &UseMI,
58 MachineInstrBuilder &DefMI) {
59 const TargetInstrDesc &Desc = OldMI.getDesc();
60 for (unsigned i = Desc.getNumOperands(), e = OldMI.getNumOperands();
62 const MachineOperand &MO = OldMI.getOperand(i);
63 assert(MO.isReg() && MO.getReg());
72 // Constants for register spacing in NEON load/store instructions.
73 // For quad-register load-lane and store-lane pseudo instructors, the
74 // spacing is initially assumed to be EvenDblSpc, and that is changed to
75 // OddDblSpc depending on the lane number operand.
82 // Entries for NEON load/store information table. The table is sorted by
83 // PseudoOpc for fast binary-search lookups.
84 struct NEONLdStTableEntry {
89 NEONRegSpacing RegSpacing;
90 unsigned char NumRegs; // D registers loaded or stored
91 unsigned char RegElts; // elements per D register; used for lane ops
93 // Comparison methods for binary search of the table.
94 bool operator<(const NEONLdStTableEntry &TE) const {
95 return PseudoOpc < TE.PseudoOpc;
97 friend bool operator<(const NEONLdStTableEntry &TE, unsigned PseudoOpc) {
98 return TE.PseudoOpc < PseudoOpc;
100 friend bool ATTRIBUTE_UNUSED operator<(unsigned PseudoOpc,
101 const NEONLdStTableEntry &TE) {
102 return PseudoOpc < TE.PseudoOpc;
107 static const NEONLdStTableEntry NEONLdStTable[] = {
108 { ARM::VLD1d64QPseudo, ARM::VLD1d64Q, true, false, SingleSpc, 4, 1 },
109 { ARM::VLD1d64QPseudo_UPD, ARM::VLD1d64Q_UPD, true, true, SingleSpc, 4, 1 },
110 { ARM::VLD1d64TPseudo, ARM::VLD1d64T, true, false, SingleSpc, 3, 1 },
111 { ARM::VLD1d64TPseudo_UPD, ARM::VLD1d64T_UPD, true, true, SingleSpc, 3, 1 },
113 { ARM::VLD1q16Pseudo, ARM::VLD1q16, true, false, SingleSpc, 2, 4 },
114 { ARM::VLD1q16Pseudo_UPD, ARM::VLD1q16_UPD, true, true, SingleSpc, 2, 4 },
115 { ARM::VLD1q32Pseudo, ARM::VLD1q32, true, false, SingleSpc, 2, 2 },
116 { ARM::VLD1q32Pseudo_UPD, ARM::VLD1q32_UPD, true, true, SingleSpc, 2, 2 },
117 { ARM::VLD1q64Pseudo, ARM::VLD1q64, true, false, SingleSpc, 2, 1 },
118 { ARM::VLD1q64Pseudo_UPD, ARM::VLD1q64_UPD, true, true, SingleSpc, 2, 1 },
119 { ARM::VLD1q8Pseudo, ARM::VLD1q8, true, false, SingleSpc, 2, 8 },
120 { ARM::VLD1q8Pseudo_UPD, ARM::VLD1q8_UPD, true, true, SingleSpc, 2, 8 },
122 { ARM::VLD2LNd16Pseudo, ARM::VLD2LNd16, true, false, SingleSpc, 2, 4 },
123 { ARM::VLD2LNd16Pseudo_UPD, ARM::VLD2LNd16_UPD, true, true, SingleSpc, 2, 4 },
124 { ARM::VLD2LNd32Pseudo, ARM::VLD2LNd32, true, false, SingleSpc, 2, 2 },
125 { ARM::VLD2LNd32Pseudo_UPD, ARM::VLD2LNd32_UPD, true, true, SingleSpc, 2, 2 },
126 { ARM::VLD2LNd8Pseudo, ARM::VLD2LNd8, true, false, SingleSpc, 2, 8 },
127 { ARM::VLD2LNd8Pseudo_UPD, ARM::VLD2LNd8_UPD, true, true, SingleSpc, 2, 8 },
128 { ARM::VLD2LNq16Pseudo, ARM::VLD2LNq16, true, false, EvenDblSpc, 2, 4 },
129 { ARM::VLD2LNq16Pseudo_UPD, ARM::VLD2LNq16_UPD, true, true, EvenDblSpc, 2, 4 },
130 { ARM::VLD2LNq32Pseudo, ARM::VLD2LNq32, true, false, EvenDblSpc, 2, 2 },
131 { ARM::VLD2LNq32Pseudo_UPD, ARM::VLD2LNq32_UPD, true, true, EvenDblSpc, 2, 2 },
133 { ARM::VLD2d16Pseudo, ARM::VLD2d16, true, false, SingleSpc, 2, 4 },
134 { ARM::VLD2d16Pseudo_UPD, ARM::VLD2d16_UPD, true, true, SingleSpc, 2, 4 },
135 { ARM::VLD2d32Pseudo, ARM::VLD2d32, true, false, SingleSpc, 2, 2 },
136 { ARM::VLD2d32Pseudo_UPD, ARM::VLD2d32_UPD, true, true, SingleSpc, 2, 2 },
137 { ARM::VLD2d8Pseudo, ARM::VLD2d8, true, false, SingleSpc, 2, 8 },
138 { ARM::VLD2d8Pseudo_UPD, ARM::VLD2d8_UPD, true, true, SingleSpc, 2, 8 },
140 { ARM::VLD2q16Pseudo, ARM::VLD2q16, true, false, SingleSpc, 4, 4 },
141 { ARM::VLD2q16Pseudo_UPD, ARM::VLD2q16_UPD, true, true, SingleSpc, 4, 4 },
142 { ARM::VLD2q32Pseudo, ARM::VLD2q32, true, false, SingleSpc, 4, 2 },
143 { ARM::VLD2q32Pseudo_UPD, ARM::VLD2q32_UPD, true, true, SingleSpc, 4, 2 },
144 { ARM::VLD2q8Pseudo, ARM::VLD2q8, true, false, SingleSpc, 4, 8 },
145 { ARM::VLD2q8Pseudo_UPD, ARM::VLD2q8_UPD, true, true, SingleSpc, 4, 8 },
147 { ARM::VLD3LNd16Pseudo, ARM::VLD3LNd16, true, false, SingleSpc, 3, 4 },
148 { ARM::VLD3LNd16Pseudo_UPD, ARM::VLD3LNd16_UPD, true, true, SingleSpc, 3, 4 },
149 { ARM::VLD3LNd32Pseudo, ARM::VLD3LNd32, true, false, SingleSpc, 3, 2 },
150 { ARM::VLD3LNd32Pseudo_UPD, ARM::VLD3LNd32_UPD, true, true, SingleSpc, 3, 2 },
151 { ARM::VLD3LNd8Pseudo, ARM::VLD3LNd8, true, false, SingleSpc, 3, 8 },
152 { ARM::VLD3LNd8Pseudo_UPD, ARM::VLD3LNd8_UPD, true, true, SingleSpc, 3, 8 },
153 { ARM::VLD3LNq16Pseudo, ARM::VLD3LNq16, true, false, EvenDblSpc, 3, 4 },
154 { ARM::VLD3LNq16Pseudo_UPD, ARM::VLD3LNq16_UPD, true, true, EvenDblSpc, 3, 4 },
155 { ARM::VLD3LNq32Pseudo, ARM::VLD3LNq32, true, false, EvenDblSpc, 3, 2 },
156 { ARM::VLD3LNq32Pseudo_UPD, ARM::VLD3LNq32_UPD, true, true, EvenDblSpc, 3, 2 },
158 { ARM::VLD3d16Pseudo, ARM::VLD3d16, true, false, SingleSpc, 3, 4 },
159 { ARM::VLD3d16Pseudo_UPD, ARM::VLD3d16_UPD, true, true, SingleSpc, 3, 4 },
160 { ARM::VLD3d32Pseudo, ARM::VLD3d32, true, false, SingleSpc, 3, 2 },
161 { ARM::VLD3d32Pseudo_UPD, ARM::VLD3d32_UPD, true, true, SingleSpc, 3, 2 },
162 { ARM::VLD3d8Pseudo, ARM::VLD3d8, true, false, SingleSpc, 3, 8 },
163 { ARM::VLD3d8Pseudo_UPD, ARM::VLD3d8_UPD, true, true, SingleSpc, 3, 8 },
165 { ARM::VLD3q16Pseudo_UPD, ARM::VLD3q16_UPD, true, true, EvenDblSpc, 3, 4 },
166 { ARM::VLD3q16oddPseudo_UPD, ARM::VLD3q16_UPD, true, true, OddDblSpc, 3, 4 },
167 { ARM::VLD3q32Pseudo_UPD, ARM::VLD3q32_UPD, true, true, EvenDblSpc, 3, 2 },
168 { ARM::VLD3q32oddPseudo_UPD, ARM::VLD3q32_UPD, true, true, OddDblSpc, 3, 2 },
169 { ARM::VLD3q8Pseudo_UPD, ARM::VLD3q8_UPD, true, true, EvenDblSpc, 3, 8 },
170 { ARM::VLD3q8oddPseudo_UPD, ARM::VLD3q8_UPD, true, true, OddDblSpc, 3, 8 },
172 { ARM::VLD4LNd16Pseudo, ARM::VLD4LNd16, true, false, SingleSpc, 4, 4 },
173 { ARM::VLD4LNd16Pseudo_UPD, ARM::VLD4LNd16_UPD, true, true, SingleSpc, 4, 4 },
174 { ARM::VLD4LNd32Pseudo, ARM::VLD4LNd32, true, false, SingleSpc, 4, 2 },
175 { ARM::VLD4LNd32Pseudo_UPD, ARM::VLD4LNd32_UPD, true, true, SingleSpc, 4, 2 },
176 { ARM::VLD4LNd8Pseudo, ARM::VLD4LNd8, true, false, SingleSpc, 4, 8 },
177 { ARM::VLD4LNd8Pseudo_UPD, ARM::VLD4LNd8_UPD, true, true, SingleSpc, 4, 8 },
178 { ARM::VLD4LNq16Pseudo, ARM::VLD4LNq16, true, false, EvenDblSpc, 4, 4 },
179 { ARM::VLD4LNq16Pseudo_UPD, ARM::VLD4LNq16_UPD, true, true, EvenDblSpc, 4, 4 },
180 { ARM::VLD4LNq32Pseudo, ARM::VLD4LNq32, true, false, EvenDblSpc, 4, 2 },
181 { ARM::VLD4LNq32Pseudo_UPD, ARM::VLD4LNq32_UPD, true, true, EvenDblSpc, 4, 2 },
183 { ARM::VLD4d16Pseudo, ARM::VLD4d16, true, false, SingleSpc, 4, 4 },
184 { ARM::VLD4d16Pseudo_UPD, ARM::VLD4d16_UPD, true, true, SingleSpc, 4, 4 },
185 { ARM::VLD4d32Pseudo, ARM::VLD4d32, true, false, SingleSpc, 4, 2 },
186 { ARM::VLD4d32Pseudo_UPD, ARM::VLD4d32_UPD, true, true, SingleSpc, 4, 2 },
187 { ARM::VLD4d8Pseudo, ARM::VLD4d8, true, false, SingleSpc, 4, 8 },
188 { ARM::VLD4d8Pseudo_UPD, ARM::VLD4d8_UPD, true, true, SingleSpc, 4, 8 },
190 { ARM::VLD4q16Pseudo_UPD, ARM::VLD4q16_UPD, true, true, EvenDblSpc, 4, 4 },
191 { ARM::VLD4q16oddPseudo_UPD, ARM::VLD4q16_UPD, true, true, OddDblSpc, 4, 4 },
192 { ARM::VLD4q32Pseudo_UPD, ARM::VLD4q32_UPD, true, true, EvenDblSpc, 4, 2 },
193 { ARM::VLD4q32oddPseudo_UPD, ARM::VLD4q32_UPD, true, true, OddDblSpc, 4, 2 },
194 { ARM::VLD4q8Pseudo_UPD, ARM::VLD4q8_UPD, true, true, EvenDblSpc, 4, 8 },
195 { ARM::VLD4q8oddPseudo_UPD, ARM::VLD4q8_UPD, true, true, OddDblSpc, 4, 8 },
197 { ARM::VST1d64QPseudo, ARM::VST1d64Q, false, false, SingleSpc, 4, 1 },
198 { ARM::VST1d64QPseudo_UPD, ARM::VST1d64Q_UPD, false, true, SingleSpc, 4, 1 },
199 { ARM::VST1d64TPseudo, ARM::VST1d64T, false, false, SingleSpc, 3, 1 },
200 { ARM::VST1d64TPseudo_UPD, ARM::VST1d64T_UPD, false, true, SingleSpc, 3, 1 },
202 { ARM::VST1q16Pseudo, ARM::VST1q16, false, false, SingleSpc, 2, 4 },
203 { ARM::VST1q16Pseudo_UPD, ARM::VST1q16_UPD, false, true, SingleSpc, 2, 4 },
204 { ARM::VST1q32Pseudo, ARM::VST1q32, false, false, SingleSpc, 2, 2 },
205 { ARM::VST1q32Pseudo_UPD, ARM::VST1q32_UPD, false, true, SingleSpc, 2, 2 },
206 { ARM::VST1q64Pseudo, ARM::VST1q64, false, false, SingleSpc, 2, 1 },
207 { ARM::VST1q64Pseudo_UPD, ARM::VST1q64_UPD, false, true, SingleSpc, 2, 1 },
208 { ARM::VST1q8Pseudo, ARM::VST1q8, false, false, SingleSpc, 2, 8 },
209 { ARM::VST1q8Pseudo_UPD, ARM::VST1q8_UPD, false, true, SingleSpc, 2, 8 },
211 { ARM::VST2LNd16Pseudo, ARM::VST2LNd16, false, false, SingleSpc, 2, 4 },
212 { ARM::VST2LNd16Pseudo_UPD, ARM::VST2LNd16_UPD, false, true, SingleSpc, 2, 4 },
213 { ARM::VST2LNd32Pseudo, ARM::VST2LNd32, false, false, SingleSpc, 2, 2 },
214 { ARM::VST2LNd32Pseudo_UPD, ARM::VST2LNd32_UPD, false, true, SingleSpc, 2, 2 },
215 { ARM::VST2LNd8Pseudo, ARM::VST2LNd8, false, false, SingleSpc, 2, 8 },
216 { ARM::VST2LNd8Pseudo_UPD, ARM::VST2LNd8_UPD, false, true, SingleSpc, 2, 8 },
217 { ARM::VST2LNq16Pseudo, ARM::VST2LNq16, false, false, EvenDblSpc, 2, 4},
218 { ARM::VST2LNq16Pseudo_UPD, ARM::VST2LNq16_UPD, false, true, EvenDblSpc, 2, 4},
219 { ARM::VST2LNq32Pseudo, ARM::VST2LNq32, false, false, EvenDblSpc, 2, 2},
220 { ARM::VST2LNq32Pseudo_UPD, ARM::VST2LNq32_UPD, false, true, EvenDblSpc, 2, 2},
222 { ARM::VST2d16Pseudo, ARM::VST2d16, false, false, SingleSpc, 2, 4 },
223 { ARM::VST2d16Pseudo_UPD, ARM::VST2d16_UPD, false, true, SingleSpc, 2, 4 },
224 { ARM::VST2d32Pseudo, ARM::VST2d32, false, false, SingleSpc, 2, 2 },
225 { ARM::VST2d32Pseudo_UPD, ARM::VST2d32_UPD, false, true, SingleSpc, 2, 2 },
226 { ARM::VST2d8Pseudo, ARM::VST2d8, false, false, SingleSpc, 2, 8 },
227 { ARM::VST2d8Pseudo_UPD, ARM::VST2d8_UPD, false, true, SingleSpc, 2, 8 },
229 { ARM::VST2q16Pseudo, ARM::VST2q16, false, false, SingleSpc, 4, 4 },
230 { ARM::VST2q16Pseudo_UPD, ARM::VST2q16_UPD, false, true, SingleSpc, 4, 4 },
231 { ARM::VST2q32Pseudo, ARM::VST2q32, false, false, SingleSpc, 4, 2 },
232 { ARM::VST2q32Pseudo_UPD, ARM::VST2q32_UPD, false, true, SingleSpc, 4, 2 },
233 { ARM::VST2q8Pseudo, ARM::VST2q8, false, false, SingleSpc, 4, 8 },
234 { ARM::VST2q8Pseudo_UPD, ARM::VST2q8_UPD, false, true, SingleSpc, 4, 8 },
236 { ARM::VST3LNd16Pseudo, ARM::VST3LNd16, false, false, SingleSpc, 3, 4 },
237 { ARM::VST3LNd16Pseudo_UPD, ARM::VST3LNd16_UPD, false, true, SingleSpc, 3, 4 },
238 { ARM::VST3LNd32Pseudo, ARM::VST3LNd32, false, false, SingleSpc, 3, 2 },
239 { ARM::VST3LNd32Pseudo_UPD, ARM::VST3LNd32_UPD, false, true, SingleSpc, 3, 2 },
240 { ARM::VST3LNd8Pseudo, ARM::VST3LNd8, false, false, SingleSpc, 3, 8 },
241 { ARM::VST3LNd8Pseudo_UPD, ARM::VST3LNd8_UPD, false, true, SingleSpc, 3, 8 },
242 { ARM::VST3LNq16Pseudo, ARM::VST3LNq16, false, false, EvenDblSpc, 3, 4},
243 { ARM::VST3LNq16Pseudo_UPD, ARM::VST3LNq16_UPD, false, true, EvenDblSpc, 3, 4},
244 { ARM::VST3LNq32Pseudo, ARM::VST3LNq32, false, false, EvenDblSpc, 3, 2},
245 { ARM::VST3LNq32Pseudo_UPD, ARM::VST3LNq32_UPD, false, true, EvenDblSpc, 3, 2},
247 { ARM::VST3d16Pseudo, ARM::VST3d16, false, false, SingleSpc, 3, 4 },
248 { ARM::VST3d16Pseudo_UPD, ARM::VST3d16_UPD, false, true, SingleSpc, 3, 4 },
249 { ARM::VST3d32Pseudo, ARM::VST3d32, false, false, SingleSpc, 3, 2 },
250 { ARM::VST3d32Pseudo_UPD, ARM::VST3d32_UPD, false, true, SingleSpc, 3, 2 },
251 { ARM::VST3d8Pseudo, ARM::VST3d8, false, false, SingleSpc, 3, 8 },
252 { ARM::VST3d8Pseudo_UPD, ARM::VST3d8_UPD, false, true, SingleSpc, 3, 8 },
254 { ARM::VST3q16Pseudo_UPD, ARM::VST3q16_UPD, false, true, EvenDblSpc, 3, 4 },
255 { ARM::VST3q16oddPseudo_UPD, ARM::VST3q16_UPD, false, true, OddDblSpc, 3, 4 },
256 { ARM::VST3q32Pseudo_UPD, ARM::VST3q32_UPD, false, true, EvenDblSpc, 3, 2 },
257 { ARM::VST3q32oddPseudo_UPD, ARM::VST3q32_UPD, false, true, OddDblSpc, 3, 2 },
258 { ARM::VST3q8Pseudo_UPD, ARM::VST3q8_UPD, false, true, EvenDblSpc, 3, 8 },
259 { ARM::VST3q8oddPseudo_UPD, ARM::VST3q8_UPD, false, true, OddDblSpc, 3, 8 },
261 { ARM::VST4LNd16Pseudo, ARM::VST4LNd16, false, false, SingleSpc, 4, 4 },
262 { ARM::VST4LNd16Pseudo_UPD, ARM::VST4LNd16_UPD, false, true, SingleSpc, 4, 4 },
263 { ARM::VST4LNd32Pseudo, ARM::VST4LNd32, false, false, SingleSpc, 4, 2 },
264 { ARM::VST4LNd32Pseudo_UPD, ARM::VST4LNd32_UPD, false, true, SingleSpc, 4, 2 },
265 { ARM::VST4LNd8Pseudo, ARM::VST4LNd8, false, false, SingleSpc, 4, 8 },
266 { ARM::VST4LNd8Pseudo_UPD, ARM::VST4LNd8_UPD, false, true, SingleSpc, 4, 8 },
267 { ARM::VST4LNq16Pseudo, ARM::VST4LNq16, false, false, EvenDblSpc, 4, 4},
268 { ARM::VST4LNq16Pseudo_UPD, ARM::VST4LNq16_UPD, false, true, EvenDblSpc, 4, 4},
269 { ARM::VST4LNq32Pseudo, ARM::VST4LNq32, false, false, EvenDblSpc, 4, 2},
270 { ARM::VST4LNq32Pseudo_UPD, ARM::VST4LNq32_UPD, false, true, EvenDblSpc, 4, 2},
272 { ARM::VST4d16Pseudo, ARM::VST4d16, false, false, SingleSpc, 4, 4 },
273 { ARM::VST4d16Pseudo_UPD, ARM::VST4d16_UPD, false, true, SingleSpc, 4, 4 },
274 { ARM::VST4d32Pseudo, ARM::VST4d32, false, false, SingleSpc, 4, 2 },
275 { ARM::VST4d32Pseudo_UPD, ARM::VST4d32_UPD, false, true, SingleSpc, 4, 2 },
276 { ARM::VST4d8Pseudo, ARM::VST4d8, false, false, SingleSpc, 4, 8 },
277 { ARM::VST4d8Pseudo_UPD, ARM::VST4d8_UPD, false, true, SingleSpc, 4, 8 },
279 { ARM::VST4q16Pseudo_UPD, ARM::VST4q16_UPD, false, true, EvenDblSpc, 4, 4 },
280 { ARM::VST4q16oddPseudo_UPD, ARM::VST4q16_UPD, false, true, OddDblSpc, 4, 4 },
281 { ARM::VST4q32Pseudo_UPD, ARM::VST4q32_UPD, false, true, EvenDblSpc, 4, 2 },
282 { ARM::VST4q32oddPseudo_UPD, ARM::VST4q32_UPD, false, true, OddDblSpc, 4, 2 },
283 { ARM::VST4q8Pseudo_UPD, ARM::VST4q8_UPD, false, true, EvenDblSpc, 4, 8 },
284 { ARM::VST4q8oddPseudo_UPD , ARM::VST4q8_UPD, false, true, OddDblSpc, 4, 8 }
287 /// LookupNEONLdSt - Search the NEONLdStTable for information about a NEON
288 /// load or store pseudo instruction.
289 static const NEONLdStTableEntry *LookupNEONLdSt(unsigned Opcode) {
290 unsigned NumEntries = array_lengthof(NEONLdStTable);
293 // Make sure the table is sorted.
294 static bool TableChecked = false;
296 for (unsigned i = 0; i != NumEntries-1; ++i)
297 assert(NEONLdStTable[i] < NEONLdStTable[i+1] &&
298 "NEONLdStTable is not sorted!");
303 const NEONLdStTableEntry *I =
304 std::lower_bound(NEONLdStTable, NEONLdStTable + NumEntries, Opcode);
305 if (I != NEONLdStTable + NumEntries && I->PseudoOpc == Opcode)
310 /// GetDSubRegs - Get 4 D subregisters of a Q, QQ, or QQQQ register,
311 /// corresponding to the specified register spacing. Not all of the results
312 /// are necessarily valid, e.g., a Q register only has 2 D subregisters.
313 static void GetDSubRegs(unsigned Reg, NEONRegSpacing RegSpc,
314 const TargetRegisterInfo *TRI, unsigned &D0,
315 unsigned &D1, unsigned &D2, unsigned &D3) {
316 if (RegSpc == SingleSpc) {
317 D0 = TRI->getSubReg(Reg, ARM::dsub_0);
318 D1 = TRI->getSubReg(Reg, ARM::dsub_1);
319 D2 = TRI->getSubReg(Reg, ARM::dsub_2);
320 D3 = TRI->getSubReg(Reg, ARM::dsub_3);
321 } else if (RegSpc == EvenDblSpc) {
322 D0 = TRI->getSubReg(Reg, ARM::dsub_0);
323 D1 = TRI->getSubReg(Reg, ARM::dsub_2);
324 D2 = TRI->getSubReg(Reg, ARM::dsub_4);
325 D3 = TRI->getSubReg(Reg, ARM::dsub_6);
327 assert(RegSpc == OddDblSpc && "unknown register spacing");
328 D0 = TRI->getSubReg(Reg, ARM::dsub_1);
329 D1 = TRI->getSubReg(Reg, ARM::dsub_3);
330 D2 = TRI->getSubReg(Reg, ARM::dsub_5);
331 D3 = TRI->getSubReg(Reg, ARM::dsub_7);
335 /// ExpandVLD - Translate VLD pseudo instructions with Q, QQ or QQQQ register
336 /// operands to real VLD instructions with D register operands.
337 void ARMExpandPseudo::ExpandVLD(MachineBasicBlock::iterator &MBBI) {
338 MachineInstr &MI = *MBBI;
339 MachineBasicBlock &MBB = *MI.getParent();
341 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
342 assert(TableEntry && TableEntry->IsLoad && "NEONLdStTable lookup failed");
343 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
344 unsigned NumRegs = TableEntry->NumRegs;
346 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
347 TII->get(TableEntry->RealOpc));
350 bool DstIsDead = MI.getOperand(OpIdx).isDead();
351 unsigned DstReg = MI.getOperand(OpIdx++).getReg();
352 unsigned D0, D1, D2, D3;
353 GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
354 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
355 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
357 MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
359 MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
361 if (TableEntry->HasWriteBack)
362 MIB.addOperand(MI.getOperand(OpIdx++));
364 // Copy the addrmode6 operands.
365 MIB.addOperand(MI.getOperand(OpIdx++));
366 MIB.addOperand(MI.getOperand(OpIdx++));
367 // Copy the am6offset operand.
368 if (TableEntry->HasWriteBack)
369 MIB.addOperand(MI.getOperand(OpIdx++));
371 // For an instruction writing double-spaced subregs, the pseudo instruction
372 // has an extra operand that is a use of the super-register. Record the
373 // operand index and skip over it.
374 unsigned SrcOpIdx = 0;
375 if (RegSpc == EvenDblSpc || RegSpc == OddDblSpc)
378 // Copy the predicate operands.
379 MIB.addOperand(MI.getOperand(OpIdx++));
380 MIB.addOperand(MI.getOperand(OpIdx++));
382 // Copy the super-register source operand used for double-spaced subregs over
383 // to the new instruction as an implicit operand.
385 MachineOperand MO = MI.getOperand(SrcOpIdx);
386 MO.setImplicit(true);
389 // Add an implicit def for the super-register.
390 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
391 TransferImpOps(MI, MIB, MIB);
392 MI.eraseFromParent();
395 /// ExpandVST - Translate VST pseudo instructions with Q, QQ or QQQQ register
396 /// operands to real VST instructions with D register operands.
397 void ARMExpandPseudo::ExpandVST(MachineBasicBlock::iterator &MBBI) {
398 MachineInstr &MI = *MBBI;
399 MachineBasicBlock &MBB = *MI.getParent();
401 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
402 assert(TableEntry && !TableEntry->IsLoad && "NEONLdStTable lookup failed");
403 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
404 unsigned NumRegs = TableEntry->NumRegs;
406 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
407 TII->get(TableEntry->RealOpc));
409 if (TableEntry->HasWriteBack)
410 MIB.addOperand(MI.getOperand(OpIdx++));
412 // Copy the addrmode6 operands.
413 MIB.addOperand(MI.getOperand(OpIdx++));
414 MIB.addOperand(MI.getOperand(OpIdx++));
415 // Copy the am6offset operand.
416 if (TableEntry->HasWriteBack)
417 MIB.addOperand(MI.getOperand(OpIdx++));
419 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
420 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
421 unsigned D0, D1, D2, D3;
422 GetDSubRegs(SrcReg, RegSpc, TRI, D0, D1, D2, D3);
423 MIB.addReg(D0).addReg(D1);
429 // Copy the predicate operands.
430 MIB.addOperand(MI.getOperand(OpIdx++));
431 MIB.addOperand(MI.getOperand(OpIdx++));
434 // Add an implicit kill for the super-reg.
435 (*MIB).addRegisterKilled(SrcReg, TRI, true);
436 TransferImpOps(MI, MIB, MIB);
437 MI.eraseFromParent();
440 /// ExpandLaneOp - Translate VLD*LN and VST*LN instructions with Q, QQ or QQQQ
441 /// register operands to real instructions with D register operands.
442 void ARMExpandPseudo::ExpandLaneOp(MachineBasicBlock::iterator &MBBI) {
443 MachineInstr &MI = *MBBI;
444 MachineBasicBlock &MBB = *MI.getParent();
446 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
447 assert(TableEntry && "NEONLdStTable lookup failed");
448 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
449 unsigned NumRegs = TableEntry->NumRegs;
450 unsigned RegElts = TableEntry->RegElts;
452 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
453 TII->get(TableEntry->RealOpc));
455 // The lane operand is always the 3rd from last operand, before the 2
456 // predicate operands.
457 unsigned Lane = MI.getOperand(MI.getDesc().getNumOperands() - 3).getImm();
459 // Adjust the lane and spacing as needed for Q registers.
460 assert(RegSpc != OddDblSpc && "unexpected register spacing for VLD/VST-lane");
461 if (RegSpc == EvenDblSpc && Lane >= RegElts) {
465 assert(Lane < RegElts && "out of range lane for VLD/VST-lane");
467 unsigned D0, D1, D2, D3;
469 bool DstIsDead = false;
470 if (TableEntry->IsLoad) {
471 DstIsDead = MI.getOperand(OpIdx).isDead();
472 DstReg = MI.getOperand(OpIdx++).getReg();
473 GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
474 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
475 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
477 MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
479 MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
482 if (TableEntry->HasWriteBack)
483 MIB.addOperand(MI.getOperand(OpIdx++));
485 // Copy the addrmode6 operands.
486 MIB.addOperand(MI.getOperand(OpIdx++));
487 MIB.addOperand(MI.getOperand(OpIdx++));
488 // Copy the am6offset operand.
489 if (TableEntry->HasWriteBack)
490 MIB.addOperand(MI.getOperand(OpIdx++));
492 // Grab the super-register source.
493 MachineOperand MO = MI.getOperand(OpIdx++);
494 if (!TableEntry->IsLoad)
495 GetDSubRegs(MO.getReg(), RegSpc, TRI, D0, D1, D2, D3);
497 // Add the subregs as sources of the new instruction.
498 unsigned SrcFlags = (getUndefRegState(MO.isUndef()) |
499 getKillRegState(MO.isKill()));
500 MIB.addReg(D0, SrcFlags).addReg(D1, SrcFlags);
502 MIB.addReg(D2, SrcFlags);
504 MIB.addReg(D3, SrcFlags);
506 // Add the lane number operand.
510 // Copy the predicate operands.
511 MIB.addOperand(MI.getOperand(OpIdx++));
512 MIB.addOperand(MI.getOperand(OpIdx++));
514 // Copy the super-register source to be an implicit source.
515 MO.setImplicit(true);
517 if (TableEntry->IsLoad)
518 // Add an implicit def for the super-register.
519 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
520 TransferImpOps(MI, MIB, MIB);
521 MI.eraseFromParent();
524 /// ExpandVTBL - Translate VTBL and VTBX pseudo instructions with Q or QQ
525 /// register operands to real instructions with D register operands.
526 void ARMExpandPseudo::ExpandVTBL(MachineBasicBlock::iterator &MBBI,
527 unsigned Opc, bool IsExt, unsigned NumRegs) {
528 MachineInstr &MI = *MBBI;
529 MachineBasicBlock &MBB = *MI.getParent();
531 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc));
534 // Transfer the destination register operand.
535 MIB.addOperand(MI.getOperand(OpIdx++));
537 MIB.addOperand(MI.getOperand(OpIdx++));
539 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
540 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
541 unsigned D0, D1, D2, D3;
542 GetDSubRegs(SrcReg, SingleSpc, TRI, D0, D1, D2, D3);
543 MIB.addReg(D0).addReg(D1);
549 // Copy the other source register operand.
550 MIB.addOperand(MI.getOperand(OpIdx++));
552 // Copy the predicate operands.
553 MIB.addOperand(MI.getOperand(OpIdx++));
554 MIB.addOperand(MI.getOperand(OpIdx++));
557 // Add an implicit kill for the super-reg.
558 (*MIB).addRegisterKilled(SrcReg, TRI, true);
559 TransferImpOps(MI, MIB, MIB);
560 MI.eraseFromParent();
563 bool ARMExpandPseudo::ExpandMBB(MachineBasicBlock &MBB) {
564 bool Modified = false;
566 MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
568 MachineInstr &MI = *MBBI;
569 MachineBasicBlock::iterator NMBBI = llvm::next(MBBI);
571 bool ModifiedOp = true;
572 unsigned Opcode = MI.getOpcode();
578 case ARM::tLDRpci_pic:
579 case ARM::t2LDRpci_pic: {
580 unsigned NewLdOpc = (Opcode == ARM::tLDRpci_pic)
581 ? ARM::tLDRpci : ARM::t2LDRpci;
582 unsigned DstReg = MI.getOperand(0).getReg();
583 bool DstIsDead = MI.getOperand(0).isDead();
584 MachineInstrBuilder MIB1 =
585 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
586 TII->get(NewLdOpc), DstReg)
587 .addOperand(MI.getOperand(1)));
588 (*MIB1).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
589 MachineInstrBuilder MIB2 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
590 TII->get(ARM::tPICADD))
591 .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead))
593 .addOperand(MI.getOperand(2));
594 TransferImpOps(MI, MIB1, MIB2);
595 MI.eraseFromParent();
600 case ARM::t2MOVi32imm: {
601 unsigned PredReg = 0;
602 ARMCC::CondCodes Pred = llvm::getInstrPredicate(&MI, PredReg);
603 unsigned DstReg = MI.getOperand(0).getReg();
604 bool DstIsDead = MI.getOperand(0).isDead();
605 const MachineOperand &MO = MI.getOperand(1);
606 MachineInstrBuilder LO16, HI16;
608 LO16 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
609 TII->get(Opcode == ARM::MOVi32imm ?
610 ARM::MOVi16 : ARM::t2MOVi16),
612 HI16 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
613 TII->get(Opcode == ARM::MOVi32imm ?
614 ARM::MOVTi16 : ARM::t2MOVTi16))
615 .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead))
619 unsigned Imm = MO.getImm();
620 unsigned Lo16 = Imm & 0xffff;
621 unsigned Hi16 = (Imm >> 16) & 0xffff;
622 LO16 = LO16.addImm(Lo16);
623 HI16 = HI16.addImm(Hi16);
625 const GlobalValue *GV = MO.getGlobal();
626 unsigned TF = MO.getTargetFlags();
627 LO16 = LO16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_LO16);
628 HI16 = HI16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_HI16);
630 (*LO16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
631 (*HI16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
632 LO16.addImm(Pred).addReg(PredReg);
633 HI16.addImm(Pred).addReg(PredReg);
634 TransferImpOps(MI, LO16, HI16);
635 MI.eraseFromParent();
640 unsigned DstReg = MI.getOperand(0).getReg();
641 bool DstIsDead = MI.getOperand(0).isDead();
642 unsigned EvenDst = TRI->getSubReg(DstReg, ARM::qsub_0);
643 unsigned OddDst = TRI->getSubReg(DstReg, ARM::qsub_1);
644 unsigned SrcReg = MI.getOperand(1).getReg();
645 bool SrcIsKill = MI.getOperand(1).isKill();
646 unsigned EvenSrc = TRI->getSubReg(SrcReg, ARM::qsub_0);
647 unsigned OddSrc = TRI->getSubReg(SrcReg, ARM::qsub_1);
648 MachineInstrBuilder Even =
649 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
650 TII->get(ARM::VMOVQ))
652 getDefRegState(true) | getDeadRegState(DstIsDead))
653 .addReg(EvenSrc, getKillRegState(SrcIsKill)));
654 MachineInstrBuilder Odd =
655 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
656 TII->get(ARM::VMOVQ))
658 getDefRegState(true) | getDeadRegState(DstIsDead))
659 .addReg(OddSrc, getKillRegState(SrcIsKill)));
660 TransferImpOps(MI, Even, Odd);
661 MI.eraseFromParent();
666 MachineInstrBuilder MIB =
667 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::VLDMD));
669 // Grab the Q register destination.
670 bool DstIsDead = MI.getOperand(OpIdx).isDead();
671 unsigned DstReg = MI.getOperand(OpIdx++).getReg();
672 // Copy the addrmode4 operands.
673 MIB.addOperand(MI.getOperand(OpIdx++));
674 MIB.addOperand(MI.getOperand(OpIdx++));
675 // Copy the predicate operands.
676 MIB.addOperand(MI.getOperand(OpIdx++));
677 MIB.addOperand(MI.getOperand(OpIdx++));
678 // Add the destination operands (D subregs).
679 unsigned D0 = TRI->getSubReg(DstReg, ARM::dsub_0);
680 unsigned D1 = TRI->getSubReg(DstReg, ARM::dsub_1);
681 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
682 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
683 // Add an implicit def for the super-register.
684 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
685 TransferImpOps(MI, MIB, MIB);
686 MI.eraseFromParent();
691 MachineInstrBuilder MIB =
692 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::VSTMD));
694 // Grab the Q register source.
695 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
696 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
697 // Copy the addrmode4 operands.
698 MIB.addOperand(MI.getOperand(OpIdx++));
699 MIB.addOperand(MI.getOperand(OpIdx++));
700 // Copy the predicate operands.
701 MIB.addOperand(MI.getOperand(OpIdx++));
702 MIB.addOperand(MI.getOperand(OpIdx++));
703 // Add the source operands (D subregs).
704 unsigned D0 = TRI->getSubReg(SrcReg, ARM::dsub_0);
705 unsigned D1 = TRI->getSubReg(SrcReg, ARM::dsub_1);
706 MIB.addReg(D0).addReg(D1);
708 // Add an implicit kill for the Q register.
709 (*MIB).addRegisterKilled(SrcReg, TRI, true);
710 TransferImpOps(MI, MIB, MIB);
711 MI.eraseFromParent();
716 unsigned NewOpc = Opcode == ARM::VDUPfqf ? ARM::VDUPLNfq : ARM::VDUPLNfd;
717 MachineInstrBuilder MIB =
718 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(NewOpc));
720 unsigned SrcReg = MI.getOperand(1).getReg();
721 unsigned Lane = getARMRegisterNumbering(SrcReg) & 1;
722 unsigned DReg = TRI->getMatchingSuperReg(SrcReg,
723 Lane & 1 ? ARM::ssub_1 : ARM::ssub_0, &ARM::DPR_VFP2RegClass);
724 // The lane is [0,1] for the containing DReg superregister.
725 // Copy the dst/src register operands.
726 MIB.addOperand(MI.getOperand(OpIdx++));
729 // Add the lane select operand.
731 // Add the predicate operands.
732 MIB.addOperand(MI.getOperand(OpIdx++));
733 MIB.addOperand(MI.getOperand(OpIdx++));
735 TransferImpOps(MI, MIB, MIB);
736 MI.eraseFromParent();
740 case ARM::VLD1q8Pseudo:
741 case ARM::VLD1q16Pseudo:
742 case ARM::VLD1q32Pseudo:
743 case ARM::VLD1q64Pseudo:
744 case ARM::VLD1q8Pseudo_UPD:
745 case ARM::VLD1q16Pseudo_UPD:
746 case ARM::VLD1q32Pseudo_UPD:
747 case ARM::VLD1q64Pseudo_UPD:
748 case ARM::VLD2d8Pseudo:
749 case ARM::VLD2d16Pseudo:
750 case ARM::VLD2d32Pseudo:
751 case ARM::VLD2q8Pseudo:
752 case ARM::VLD2q16Pseudo:
753 case ARM::VLD2q32Pseudo:
754 case ARM::VLD2d8Pseudo_UPD:
755 case ARM::VLD2d16Pseudo_UPD:
756 case ARM::VLD2d32Pseudo_UPD:
757 case ARM::VLD2q8Pseudo_UPD:
758 case ARM::VLD2q16Pseudo_UPD:
759 case ARM::VLD2q32Pseudo_UPD:
760 case ARM::VLD3d8Pseudo:
761 case ARM::VLD3d16Pseudo:
762 case ARM::VLD3d32Pseudo:
763 case ARM::VLD1d64TPseudo:
764 case ARM::VLD3d8Pseudo_UPD:
765 case ARM::VLD3d16Pseudo_UPD:
766 case ARM::VLD3d32Pseudo_UPD:
767 case ARM::VLD1d64TPseudo_UPD:
768 case ARM::VLD3q8Pseudo_UPD:
769 case ARM::VLD3q16Pseudo_UPD:
770 case ARM::VLD3q32Pseudo_UPD:
771 case ARM::VLD3q8oddPseudo_UPD:
772 case ARM::VLD3q16oddPseudo_UPD:
773 case ARM::VLD3q32oddPseudo_UPD:
774 case ARM::VLD4d8Pseudo:
775 case ARM::VLD4d16Pseudo:
776 case ARM::VLD4d32Pseudo:
777 case ARM::VLD1d64QPseudo:
778 case ARM::VLD4d8Pseudo_UPD:
779 case ARM::VLD4d16Pseudo_UPD:
780 case ARM::VLD4d32Pseudo_UPD:
781 case ARM::VLD1d64QPseudo_UPD:
782 case ARM::VLD4q8Pseudo_UPD:
783 case ARM::VLD4q16Pseudo_UPD:
784 case ARM::VLD4q32Pseudo_UPD:
785 case ARM::VLD4q8oddPseudo_UPD:
786 case ARM::VLD4q16oddPseudo_UPD:
787 case ARM::VLD4q32oddPseudo_UPD:
791 case ARM::VST1q8Pseudo:
792 case ARM::VST1q16Pseudo:
793 case ARM::VST1q32Pseudo:
794 case ARM::VST1q64Pseudo:
795 case ARM::VST1q8Pseudo_UPD:
796 case ARM::VST1q16Pseudo_UPD:
797 case ARM::VST1q32Pseudo_UPD:
798 case ARM::VST1q64Pseudo_UPD:
799 case ARM::VST2d8Pseudo:
800 case ARM::VST2d16Pseudo:
801 case ARM::VST2d32Pseudo:
802 case ARM::VST2q8Pseudo:
803 case ARM::VST2q16Pseudo:
804 case ARM::VST2q32Pseudo:
805 case ARM::VST2d8Pseudo_UPD:
806 case ARM::VST2d16Pseudo_UPD:
807 case ARM::VST2d32Pseudo_UPD:
808 case ARM::VST2q8Pseudo_UPD:
809 case ARM::VST2q16Pseudo_UPD:
810 case ARM::VST2q32Pseudo_UPD:
811 case ARM::VST3d8Pseudo:
812 case ARM::VST3d16Pseudo:
813 case ARM::VST3d32Pseudo:
814 case ARM::VST1d64TPseudo:
815 case ARM::VST3d8Pseudo_UPD:
816 case ARM::VST3d16Pseudo_UPD:
817 case ARM::VST3d32Pseudo_UPD:
818 case ARM::VST1d64TPseudo_UPD:
819 case ARM::VST3q8Pseudo_UPD:
820 case ARM::VST3q16Pseudo_UPD:
821 case ARM::VST3q32Pseudo_UPD:
822 case ARM::VST3q8oddPseudo_UPD:
823 case ARM::VST3q16oddPseudo_UPD:
824 case ARM::VST3q32oddPseudo_UPD:
825 case ARM::VST4d8Pseudo:
826 case ARM::VST4d16Pseudo:
827 case ARM::VST4d32Pseudo:
828 case ARM::VST1d64QPseudo:
829 case ARM::VST4d8Pseudo_UPD:
830 case ARM::VST4d16Pseudo_UPD:
831 case ARM::VST4d32Pseudo_UPD:
832 case ARM::VST1d64QPseudo_UPD:
833 case ARM::VST4q8Pseudo_UPD:
834 case ARM::VST4q16Pseudo_UPD:
835 case ARM::VST4q32Pseudo_UPD:
836 case ARM::VST4q8oddPseudo_UPD:
837 case ARM::VST4q16oddPseudo_UPD:
838 case ARM::VST4q32oddPseudo_UPD:
842 case ARM::VLD2LNd8Pseudo:
843 case ARM::VLD2LNd16Pseudo:
844 case ARM::VLD2LNd32Pseudo:
845 case ARM::VLD2LNq16Pseudo:
846 case ARM::VLD2LNq32Pseudo:
847 case ARM::VLD2LNd8Pseudo_UPD:
848 case ARM::VLD2LNd16Pseudo_UPD:
849 case ARM::VLD2LNd32Pseudo_UPD:
850 case ARM::VLD2LNq16Pseudo_UPD:
851 case ARM::VLD2LNq32Pseudo_UPD:
852 case ARM::VLD3LNd8Pseudo:
853 case ARM::VLD3LNd16Pseudo:
854 case ARM::VLD3LNd32Pseudo:
855 case ARM::VLD3LNq16Pseudo:
856 case ARM::VLD3LNq32Pseudo:
857 case ARM::VLD3LNd8Pseudo_UPD:
858 case ARM::VLD3LNd16Pseudo_UPD:
859 case ARM::VLD3LNd32Pseudo_UPD:
860 case ARM::VLD3LNq16Pseudo_UPD:
861 case ARM::VLD3LNq32Pseudo_UPD:
862 case ARM::VLD4LNd8Pseudo:
863 case ARM::VLD4LNd16Pseudo:
864 case ARM::VLD4LNd32Pseudo:
865 case ARM::VLD4LNq16Pseudo:
866 case ARM::VLD4LNq32Pseudo:
867 case ARM::VLD4LNd8Pseudo_UPD:
868 case ARM::VLD4LNd16Pseudo_UPD:
869 case ARM::VLD4LNd32Pseudo_UPD:
870 case ARM::VLD4LNq16Pseudo_UPD:
871 case ARM::VLD4LNq32Pseudo_UPD:
872 case ARM::VST2LNd8Pseudo:
873 case ARM::VST2LNd16Pseudo:
874 case ARM::VST2LNd32Pseudo:
875 case ARM::VST2LNq16Pseudo:
876 case ARM::VST2LNq32Pseudo:
877 case ARM::VST2LNd8Pseudo_UPD:
878 case ARM::VST2LNd16Pseudo_UPD:
879 case ARM::VST2LNd32Pseudo_UPD:
880 case ARM::VST2LNq16Pseudo_UPD:
881 case ARM::VST2LNq32Pseudo_UPD:
882 case ARM::VST3LNd8Pseudo:
883 case ARM::VST3LNd16Pseudo:
884 case ARM::VST3LNd32Pseudo:
885 case ARM::VST3LNq16Pseudo:
886 case ARM::VST3LNq32Pseudo:
887 case ARM::VST3LNd8Pseudo_UPD:
888 case ARM::VST3LNd16Pseudo_UPD:
889 case ARM::VST3LNd32Pseudo_UPD:
890 case ARM::VST3LNq16Pseudo_UPD:
891 case ARM::VST3LNq32Pseudo_UPD:
892 case ARM::VST4LNd8Pseudo:
893 case ARM::VST4LNd16Pseudo:
894 case ARM::VST4LNd32Pseudo:
895 case ARM::VST4LNq16Pseudo:
896 case ARM::VST4LNq32Pseudo:
897 case ARM::VST4LNd8Pseudo_UPD:
898 case ARM::VST4LNd16Pseudo_UPD:
899 case ARM::VST4LNd32Pseudo_UPD:
900 case ARM::VST4LNq16Pseudo_UPD:
901 case ARM::VST4LNq32Pseudo_UPD:
905 case ARM::VTBL2Pseudo:
906 ExpandVTBL(MBBI, ARM::VTBL2, false, 2); break;
907 case ARM::VTBL3Pseudo:
908 ExpandVTBL(MBBI, ARM::VTBL3, false, 3); break;
909 case ARM::VTBL4Pseudo:
910 ExpandVTBL(MBBI, ARM::VTBL4, false, 4); break;
911 case ARM::VTBX2Pseudo:
912 ExpandVTBL(MBBI, ARM::VTBX2, true, 2); break;
913 case ARM::VTBX3Pseudo:
914 ExpandVTBL(MBBI, ARM::VTBX3, true, 3); break;
915 case ARM::VTBX4Pseudo:
916 ExpandVTBL(MBBI, ARM::VTBX4, true, 4); break;
927 bool ARMExpandPseudo::runOnMachineFunction(MachineFunction &MF) {
928 TII = MF.getTarget().getInstrInfo();
929 TRI = MF.getTarget().getRegisterInfo();
931 bool Modified = false;
932 for (MachineFunction::iterator MFI = MF.begin(), E = MF.end(); MFI != E;
934 Modified |= ExpandMBB(*MFI);
938 /// createARMExpandPseudoPass - returns an instance of the pseudo instruction
940 FunctionPass *llvm::createARMExpandPseudoPass() {
941 return new ARMExpandPseudo();