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 "llvm/CodeGen/MachineFunctionPass.h"
21 #include "llvm/CodeGen/MachineInstrBuilder.h"
22 #include "llvm/Target/TargetRegisterInfo.h"
26 class ARMExpandPseudo : public MachineFunctionPass {
29 ARMExpandPseudo() : MachineFunctionPass(ID) {}
31 const TargetInstrInfo *TII;
32 const TargetRegisterInfo *TRI;
34 virtual bool runOnMachineFunction(MachineFunction &Fn);
36 virtual const char *getPassName() const {
37 return "ARM pseudo instruction expansion pass";
41 void TransferImpOps(MachineInstr &OldMI,
42 MachineInstrBuilder &UseMI, MachineInstrBuilder &DefMI);
43 bool ExpandMBB(MachineBasicBlock &MBB);
44 void ExpandVLD(MachineBasicBlock::iterator &MBBI);
45 void ExpandVST(MachineBasicBlock::iterator &MBBI);
46 void ExpandLaneOp(MachineBasicBlock::iterator &MBBI);
47 void ExpandVTBL(MachineBasicBlock::iterator &MBBI,
48 unsigned Opc, bool IsExt, unsigned NumRegs);
50 char ARMExpandPseudo::ID = 0;
53 /// TransferImpOps - Transfer implicit operands on the pseudo instruction to
54 /// the instructions created from the expansion.
55 void ARMExpandPseudo::TransferImpOps(MachineInstr &OldMI,
56 MachineInstrBuilder &UseMI,
57 MachineInstrBuilder &DefMI) {
58 const TargetInstrDesc &Desc = OldMI.getDesc();
59 for (unsigned i = Desc.getNumOperands(), e = OldMI.getNumOperands();
61 const MachineOperand &MO = OldMI.getOperand(i);
62 assert(MO.isReg() && MO.getReg());
71 // Constants for register spacing in NEON load/store instructions.
72 // For quad-register load-lane and store-lane pseudo instructors, the
73 // spacing is initially assumed to be EvenDblSpc, and that is changed to
74 // OddDblSpc depending on the lane number operand.
81 // Entries for NEON load/store information table. The table is sorted by
82 // PseudoOpc for fast binary-search lookups.
83 struct NEONLdStTableEntry {
88 NEONRegSpacing RegSpacing;
89 unsigned char NumRegs; // D registers loaded or stored
90 unsigned char RegElts; // elements per D register; used for lane ops
92 // Comparison methods for binary search of the table.
93 bool operator<(const NEONLdStTableEntry &TE) const {
94 return PseudoOpc < TE.PseudoOpc;
96 friend bool operator<(const NEONLdStTableEntry &TE, unsigned PseudoOpc) {
97 return TE.PseudoOpc < PseudoOpc;
99 friend bool ATTRIBUTE_UNUSED operator<(unsigned PseudoOpc,
100 const NEONLdStTableEntry &TE) {
101 return PseudoOpc < TE.PseudoOpc;
106 static const NEONLdStTableEntry NEONLdStTable[] = {
107 { ARM::VLD1d64QPseudo, ARM::VLD1d64Q, true, false, SingleSpc, 4, 1 },
108 { ARM::VLD1d64QPseudo_UPD, ARM::VLD1d64Q_UPD, true, true, SingleSpc, 4, 1 },
109 { ARM::VLD1d64TPseudo, ARM::VLD1d64T, true, false, SingleSpc, 3, 1 },
110 { ARM::VLD1d64TPseudo_UPD, ARM::VLD1d64T_UPD, true, true, SingleSpc, 3, 1 },
112 { ARM::VLD1q16Pseudo, ARM::VLD1q16, true, false, SingleSpc, 2, 4 },
113 { ARM::VLD1q16Pseudo_UPD, ARM::VLD1q16_UPD, true, true, SingleSpc, 2, 4 },
114 { ARM::VLD1q32Pseudo, ARM::VLD1q32, true, false, SingleSpc, 2, 2 },
115 { ARM::VLD1q32Pseudo_UPD, ARM::VLD1q32_UPD, true, true, SingleSpc, 2, 2 },
116 { ARM::VLD1q64Pseudo, ARM::VLD1q64, true, false, SingleSpc, 2, 1 },
117 { ARM::VLD1q64Pseudo_UPD, ARM::VLD1q64_UPD, true, true, SingleSpc, 2, 1 },
118 { ARM::VLD1q8Pseudo, ARM::VLD1q8, true, false, SingleSpc, 2, 8 },
119 { ARM::VLD1q8Pseudo_UPD, ARM::VLD1q8_UPD, true, true, SingleSpc, 2, 8 },
121 { ARM::VLD2LNd16Pseudo, ARM::VLD2LNd16, true, false, SingleSpc, 2, 4 },
122 { ARM::VLD2LNd16Pseudo_UPD, ARM::VLD2LNd16_UPD, true, true, SingleSpc, 2, 4 },
123 { ARM::VLD2LNd32Pseudo, ARM::VLD2LNd32, true, false, SingleSpc, 2, 2 },
124 { ARM::VLD2LNd32Pseudo_UPD, ARM::VLD2LNd32_UPD, true, true, SingleSpc, 2, 2 },
125 { ARM::VLD2LNd8Pseudo, ARM::VLD2LNd8, true, false, SingleSpc, 2, 8 },
126 { ARM::VLD2LNd8Pseudo_UPD, ARM::VLD2LNd8_UPD, true, true, SingleSpc, 2, 8 },
127 { ARM::VLD2LNq16Pseudo, ARM::VLD2LNq16, true, false, EvenDblSpc, 2, 4 },
128 { ARM::VLD2LNq16Pseudo_UPD, ARM::VLD2LNq16_UPD, true, true, EvenDblSpc, 2, 4 },
129 { ARM::VLD2LNq32Pseudo, ARM::VLD2LNq32, true, false, EvenDblSpc, 2, 2 },
130 { ARM::VLD2LNq32Pseudo_UPD, ARM::VLD2LNq32_UPD, true, true, EvenDblSpc, 2, 2 },
132 { ARM::VLD2d16Pseudo, ARM::VLD2d16, true, false, SingleSpc, 2, 4 },
133 { ARM::VLD2d16Pseudo_UPD, ARM::VLD2d16_UPD, true, true, SingleSpc, 2, 4 },
134 { ARM::VLD2d32Pseudo, ARM::VLD2d32, true, false, SingleSpc, 2, 2 },
135 { ARM::VLD2d32Pseudo_UPD, ARM::VLD2d32_UPD, true, true, SingleSpc, 2, 2 },
136 { ARM::VLD2d8Pseudo, ARM::VLD2d8, true, false, SingleSpc, 2, 8 },
137 { ARM::VLD2d8Pseudo_UPD, ARM::VLD2d8_UPD, true, true, SingleSpc, 2, 8 },
139 { ARM::VLD2q16Pseudo, ARM::VLD2q16, true, false, SingleSpc, 4, 4 },
140 { ARM::VLD2q16Pseudo_UPD, ARM::VLD2q16_UPD, true, true, SingleSpc, 4, 4 },
141 { ARM::VLD2q32Pseudo, ARM::VLD2q32, true, false, SingleSpc, 4, 2 },
142 { ARM::VLD2q32Pseudo_UPD, ARM::VLD2q32_UPD, true, true, SingleSpc, 4, 2 },
143 { ARM::VLD2q8Pseudo, ARM::VLD2q8, true, false, SingleSpc, 4, 8 },
144 { ARM::VLD2q8Pseudo_UPD, ARM::VLD2q8_UPD, true, true, SingleSpc, 4, 8 },
146 { ARM::VLD3LNd16Pseudo, ARM::VLD3LNd16, true, false, SingleSpc, 3, 4 },
147 { ARM::VLD3LNd16Pseudo_UPD, ARM::VLD3LNd16_UPD, true, true, SingleSpc, 3, 4 },
148 { ARM::VLD3LNd32Pseudo, ARM::VLD3LNd32, true, false, SingleSpc, 3, 2 },
149 { ARM::VLD3LNd32Pseudo_UPD, ARM::VLD3LNd32_UPD, true, true, SingleSpc, 3, 2 },
150 { ARM::VLD3LNd8Pseudo, ARM::VLD3LNd8, true, false, SingleSpc, 3, 8 },
151 { ARM::VLD3LNd8Pseudo_UPD, ARM::VLD3LNd8_UPD, true, true, SingleSpc, 3, 8 },
152 { ARM::VLD3LNq16Pseudo, ARM::VLD3LNq16, true, false, EvenDblSpc, 3, 4 },
153 { ARM::VLD3LNq16Pseudo_UPD, ARM::VLD3LNq16_UPD, true, true, EvenDblSpc, 3, 4 },
154 { ARM::VLD3LNq32Pseudo, ARM::VLD3LNq32, true, false, EvenDblSpc, 3, 2 },
155 { ARM::VLD3LNq32Pseudo_UPD, ARM::VLD3LNq32_UPD, true, true, EvenDblSpc, 3, 2 },
157 { ARM::VLD3d16Pseudo, ARM::VLD3d16, true, false, SingleSpc, 3, 4 },
158 { ARM::VLD3d16Pseudo_UPD, ARM::VLD3d16_UPD, true, true, SingleSpc, 3, 4 },
159 { ARM::VLD3d32Pseudo, ARM::VLD3d32, true, false, SingleSpc, 3, 2 },
160 { ARM::VLD3d32Pseudo_UPD, ARM::VLD3d32_UPD, true, true, SingleSpc, 3, 2 },
161 { ARM::VLD3d8Pseudo, ARM::VLD3d8, true, false, SingleSpc, 3, 8 },
162 { ARM::VLD3d8Pseudo_UPD, ARM::VLD3d8_UPD, true, true, SingleSpc, 3, 8 },
164 { ARM::VLD3q16Pseudo_UPD, ARM::VLD3q16_UPD, true, true, EvenDblSpc, 3, 4 },
165 { ARM::VLD3q16oddPseudo_UPD, ARM::VLD3q16_UPD, true, true, OddDblSpc, 3, 4 },
166 { ARM::VLD3q32Pseudo_UPD, ARM::VLD3q32_UPD, true, true, EvenDblSpc, 3, 2 },
167 { ARM::VLD3q32oddPseudo_UPD, ARM::VLD3q32_UPD, true, true, OddDblSpc, 3, 2 },
168 { ARM::VLD3q8Pseudo_UPD, ARM::VLD3q8_UPD, true, true, EvenDblSpc, 3, 8 },
169 { ARM::VLD3q8oddPseudo_UPD, ARM::VLD3q8_UPD, true, true, OddDblSpc, 3, 8 },
171 { ARM::VLD4LNd16Pseudo, ARM::VLD4LNd16, true, false, SingleSpc, 4, 4 },
172 { ARM::VLD4LNd16Pseudo_UPD, ARM::VLD4LNd16_UPD, true, true, SingleSpc, 4, 4 },
173 { ARM::VLD4LNd32Pseudo, ARM::VLD4LNd32, true, false, SingleSpc, 4, 2 },
174 { ARM::VLD4LNd32Pseudo_UPD, ARM::VLD4LNd32_UPD, true, true, SingleSpc, 4, 2 },
175 { ARM::VLD4LNd8Pseudo, ARM::VLD4LNd8, true, false, SingleSpc, 4, 8 },
176 { ARM::VLD4LNd8Pseudo_UPD, ARM::VLD4LNd8_UPD, true, true, SingleSpc, 4, 8 },
177 { ARM::VLD4LNq16Pseudo, ARM::VLD4LNq16, true, false, EvenDblSpc, 4, 4 },
178 { ARM::VLD4LNq16Pseudo_UPD, ARM::VLD4LNq16_UPD, true, true, EvenDblSpc, 4, 4 },
179 { ARM::VLD4LNq32Pseudo, ARM::VLD4LNq32, true, false, EvenDblSpc, 4, 2 },
180 { ARM::VLD4LNq32Pseudo_UPD, ARM::VLD4LNq32_UPD, true, true, EvenDblSpc, 4, 2 },
182 { ARM::VLD4d16Pseudo, ARM::VLD4d16, true, false, SingleSpc, 4, 4 },
183 { ARM::VLD4d16Pseudo_UPD, ARM::VLD4d16_UPD, true, true, SingleSpc, 4, 4 },
184 { ARM::VLD4d32Pseudo, ARM::VLD4d32, true, false, SingleSpc, 4, 2 },
185 { ARM::VLD4d32Pseudo_UPD, ARM::VLD4d32_UPD, true, true, SingleSpc, 4, 2 },
186 { ARM::VLD4d8Pseudo, ARM::VLD4d8, true, false, SingleSpc, 4, 8 },
187 { ARM::VLD4d8Pseudo_UPD, ARM::VLD4d8_UPD, true, true, SingleSpc, 4, 8 },
189 { ARM::VLD4q16Pseudo_UPD, ARM::VLD4q16_UPD, true, true, EvenDblSpc, 4, 4 },
190 { ARM::VLD4q16oddPseudo_UPD, ARM::VLD4q16_UPD, true, true, OddDblSpc, 4, 4 },
191 { ARM::VLD4q32Pseudo_UPD, ARM::VLD4q32_UPD, true, true, EvenDblSpc, 4, 2 },
192 { ARM::VLD4q32oddPseudo_UPD, ARM::VLD4q32_UPD, true, true, OddDblSpc, 4, 2 },
193 { ARM::VLD4q8Pseudo_UPD, ARM::VLD4q8_UPD, true, true, EvenDblSpc, 4, 8 },
194 { ARM::VLD4q8oddPseudo_UPD, ARM::VLD4q8_UPD, true, true, OddDblSpc, 4, 8 },
196 { ARM::VST1d64QPseudo, ARM::VST1d64Q, false, false, SingleSpc, 4, 1 },
197 { ARM::VST1d64QPseudo_UPD, ARM::VST1d64Q_UPD, false, true, SingleSpc, 4, 1 },
198 { ARM::VST1d64TPseudo, ARM::VST1d64T, false, false, SingleSpc, 3, 1 },
199 { ARM::VST1d64TPseudo_UPD, ARM::VST1d64T_UPD, false, true, SingleSpc, 3, 1 },
201 { ARM::VST1q16Pseudo, ARM::VST1q16, false, false, SingleSpc, 2, 4 },
202 { ARM::VST1q16Pseudo_UPD, ARM::VST1q16_UPD, false, true, SingleSpc, 2, 4 },
203 { ARM::VST1q32Pseudo, ARM::VST1q32, false, false, SingleSpc, 2, 2 },
204 { ARM::VST1q32Pseudo_UPD, ARM::VST1q32_UPD, false, true, SingleSpc, 2, 2 },
205 { ARM::VST1q64Pseudo, ARM::VST1q64, false, false, SingleSpc, 2, 1 },
206 { ARM::VST1q64Pseudo_UPD, ARM::VST1q64_UPD, false, true, SingleSpc, 2, 1 },
207 { ARM::VST1q8Pseudo, ARM::VST1q8, false, false, SingleSpc, 2, 8 },
208 { ARM::VST1q8Pseudo_UPD, ARM::VST1q8_UPD, false, true, SingleSpc, 2, 8 },
210 { ARM::VST2LNd16Pseudo, ARM::VST2LNd16, false, false, SingleSpc, 2, 4 },
211 { ARM::VST2LNd16Pseudo_UPD, ARM::VST2LNd16_UPD, false, true, SingleSpc, 2, 4 },
212 { ARM::VST2LNd32Pseudo, ARM::VST2LNd32, false, false, SingleSpc, 2, 2 },
213 { ARM::VST2LNd32Pseudo_UPD, ARM::VST2LNd32_UPD, false, true, SingleSpc, 2, 2 },
214 { ARM::VST2LNd8Pseudo, ARM::VST2LNd8, false, false, SingleSpc, 2, 8 },
215 { ARM::VST2LNd8Pseudo_UPD, ARM::VST2LNd8_UPD, false, true, SingleSpc, 2, 8 },
216 { ARM::VST2LNq16Pseudo, ARM::VST2LNq16, false, false, EvenDblSpc, 2, 4},
217 { ARM::VST2LNq16Pseudo_UPD, ARM::VST2LNq16_UPD, false, true, EvenDblSpc, 2, 4},
218 { ARM::VST2LNq32Pseudo, ARM::VST2LNq32, false, false, EvenDblSpc, 2, 2},
219 { ARM::VST2LNq32Pseudo_UPD, ARM::VST2LNq32_UPD, false, true, EvenDblSpc, 2, 2},
221 { ARM::VST2d16Pseudo, ARM::VST2d16, false, false, SingleSpc, 2, 4 },
222 { ARM::VST2d16Pseudo_UPD, ARM::VST2d16_UPD, false, true, SingleSpc, 2, 4 },
223 { ARM::VST2d32Pseudo, ARM::VST2d32, false, false, SingleSpc, 2, 2 },
224 { ARM::VST2d32Pseudo_UPD, ARM::VST2d32_UPD, false, true, SingleSpc, 2, 2 },
225 { ARM::VST2d8Pseudo, ARM::VST2d8, false, false, SingleSpc, 2, 8 },
226 { ARM::VST2d8Pseudo_UPD, ARM::VST2d8_UPD, false, true, SingleSpc, 2, 8 },
228 { ARM::VST2q16Pseudo, ARM::VST2q16, false, false, SingleSpc, 4, 4 },
229 { ARM::VST2q16Pseudo_UPD, ARM::VST2q16_UPD, false, true, SingleSpc, 4, 4 },
230 { ARM::VST2q32Pseudo, ARM::VST2q32, false, false, SingleSpc, 4, 2 },
231 { ARM::VST2q32Pseudo_UPD, ARM::VST2q32_UPD, false, true, SingleSpc, 4, 2 },
232 { ARM::VST2q8Pseudo, ARM::VST2q8, false, false, SingleSpc, 4, 8 },
233 { ARM::VST2q8Pseudo_UPD, ARM::VST2q8_UPD, false, true, SingleSpc, 4, 8 },
235 { ARM::VST3LNd16Pseudo, ARM::VST3LNd16, false, false, SingleSpc, 3, 4 },
236 { ARM::VST3LNd16Pseudo_UPD, ARM::VST3LNd16_UPD, false, true, SingleSpc, 3, 4 },
237 { ARM::VST3LNd32Pseudo, ARM::VST3LNd32, false, false, SingleSpc, 3, 2 },
238 { ARM::VST3LNd32Pseudo_UPD, ARM::VST3LNd32_UPD, false, true, SingleSpc, 3, 2 },
239 { ARM::VST3LNd8Pseudo, ARM::VST3LNd8, false, false, SingleSpc, 3, 8 },
240 { ARM::VST3LNd8Pseudo_UPD, ARM::VST3LNd8_UPD, false, true, SingleSpc, 3, 8 },
241 { ARM::VST3LNq16Pseudo, ARM::VST3LNq16, false, false, EvenDblSpc, 3, 4},
242 { ARM::VST3LNq16Pseudo_UPD, ARM::VST3LNq16_UPD, false, true, EvenDblSpc, 3, 4},
243 { ARM::VST3LNq32Pseudo, ARM::VST3LNq32, false, false, EvenDblSpc, 3, 2},
244 { ARM::VST3LNq32Pseudo_UPD, ARM::VST3LNq32_UPD, false, true, EvenDblSpc, 3, 2},
246 { ARM::VST3d16Pseudo, ARM::VST3d16, false, false, SingleSpc, 3, 4 },
247 { ARM::VST3d16Pseudo_UPD, ARM::VST3d16_UPD, false, true, SingleSpc, 3, 4 },
248 { ARM::VST3d32Pseudo, ARM::VST3d32, false, false, SingleSpc, 3, 2 },
249 { ARM::VST3d32Pseudo_UPD, ARM::VST3d32_UPD, false, true, SingleSpc, 3, 2 },
250 { ARM::VST3d8Pseudo, ARM::VST3d8, false, false, SingleSpc, 3, 8 },
251 { ARM::VST3d8Pseudo_UPD, ARM::VST3d8_UPD, false, true, SingleSpc, 3, 8 },
253 { ARM::VST3q16Pseudo_UPD, ARM::VST3q16_UPD, false, true, EvenDblSpc, 3, 4 },
254 { ARM::VST3q16oddPseudo_UPD, ARM::VST3q16_UPD, false, true, OddDblSpc, 3, 4 },
255 { ARM::VST3q32Pseudo_UPD, ARM::VST3q32_UPD, false, true, EvenDblSpc, 3, 2 },
256 { ARM::VST3q32oddPseudo_UPD, ARM::VST3q32_UPD, false, true, OddDblSpc, 3, 2 },
257 { ARM::VST3q8Pseudo_UPD, ARM::VST3q8_UPD, false, true, EvenDblSpc, 3, 8 },
258 { ARM::VST3q8oddPseudo_UPD, ARM::VST3q8_UPD, false, true, OddDblSpc, 3, 8 },
260 { ARM::VST4LNd16Pseudo, ARM::VST4LNd16, false, false, SingleSpc, 4, 4 },
261 { ARM::VST4LNd16Pseudo_UPD, ARM::VST4LNd16_UPD, false, true, SingleSpc, 4, 4 },
262 { ARM::VST4LNd32Pseudo, ARM::VST4LNd32, false, false, SingleSpc, 4, 2 },
263 { ARM::VST4LNd32Pseudo_UPD, ARM::VST4LNd32_UPD, false, true, SingleSpc, 4, 2 },
264 { ARM::VST4LNd8Pseudo, ARM::VST4LNd8, false, false, SingleSpc, 4, 8 },
265 { ARM::VST4LNd8Pseudo_UPD, ARM::VST4LNd8_UPD, false, true, SingleSpc, 4, 8 },
266 { ARM::VST4LNq16Pseudo, ARM::VST4LNq16, false, false, EvenDblSpc, 4, 4},
267 { ARM::VST4LNq16Pseudo_UPD, ARM::VST4LNq16_UPD, false, true, EvenDblSpc, 4, 4},
268 { ARM::VST4LNq32Pseudo, ARM::VST4LNq32, false, false, EvenDblSpc, 4, 2},
269 { ARM::VST4LNq32Pseudo_UPD, ARM::VST4LNq32_UPD, false, true, EvenDblSpc, 4, 2},
271 { ARM::VST4d16Pseudo, ARM::VST4d16, false, false, SingleSpc, 4, 4 },
272 { ARM::VST4d16Pseudo_UPD, ARM::VST4d16_UPD, false, true, SingleSpc, 4, 4 },
273 { ARM::VST4d32Pseudo, ARM::VST4d32, false, false, SingleSpc, 4, 2 },
274 { ARM::VST4d32Pseudo_UPD, ARM::VST4d32_UPD, false, true, SingleSpc, 4, 2 },
275 { ARM::VST4d8Pseudo, ARM::VST4d8, false, false, SingleSpc, 4, 8 },
276 { ARM::VST4d8Pseudo_UPD, ARM::VST4d8_UPD, false, true, SingleSpc, 4, 8 },
278 { ARM::VST4q16Pseudo_UPD, ARM::VST4q16_UPD, false, true, EvenDblSpc, 4, 4 },
279 { ARM::VST4q16oddPseudo_UPD, ARM::VST4q16_UPD, false, true, OddDblSpc, 4, 4 },
280 { ARM::VST4q32Pseudo_UPD, ARM::VST4q32_UPD, false, true, EvenDblSpc, 4, 2 },
281 { ARM::VST4q32oddPseudo_UPD, ARM::VST4q32_UPD, false, true, OddDblSpc, 4, 2 },
282 { ARM::VST4q8Pseudo_UPD, ARM::VST4q8_UPD, false, true, EvenDblSpc, 4, 8 },
283 { ARM::VST4q8oddPseudo_UPD , ARM::VST4q8_UPD, false, true, OddDblSpc, 4, 8 }
286 /// LookupNEONLdSt - Search the NEONLdStTable for information about a NEON
287 /// load or store pseudo instruction.
288 static const NEONLdStTableEntry *LookupNEONLdSt(unsigned Opcode) {
289 unsigned NumEntries = array_lengthof(NEONLdStTable);
292 // Make sure the table is sorted.
293 static bool TableChecked = false;
295 for (unsigned i = 0; i != NumEntries-1; ++i)
296 assert(NEONLdStTable[i] < NEONLdStTable[i+1] &&
297 "NEONLdStTable is not sorted!");
302 const NEONLdStTableEntry *I =
303 std::lower_bound(NEONLdStTable, NEONLdStTable + NumEntries, Opcode);
304 if (I != NEONLdStTable + NumEntries && I->PseudoOpc == Opcode)
309 /// GetDSubRegs - Get 4 D subregisters of a Q, QQ, or QQQQ register,
310 /// corresponding to the specified register spacing. Not all of the results
311 /// are necessarily valid, e.g., a Q register only has 2 D subregisters.
312 static void GetDSubRegs(unsigned Reg, NEONRegSpacing RegSpc,
313 const TargetRegisterInfo *TRI, unsigned &D0,
314 unsigned &D1, unsigned &D2, unsigned &D3) {
315 if (RegSpc == SingleSpc) {
316 D0 = TRI->getSubReg(Reg, ARM::dsub_0);
317 D1 = TRI->getSubReg(Reg, ARM::dsub_1);
318 D2 = TRI->getSubReg(Reg, ARM::dsub_2);
319 D3 = TRI->getSubReg(Reg, ARM::dsub_3);
320 } else if (RegSpc == EvenDblSpc) {
321 D0 = TRI->getSubReg(Reg, ARM::dsub_0);
322 D1 = TRI->getSubReg(Reg, ARM::dsub_2);
323 D2 = TRI->getSubReg(Reg, ARM::dsub_4);
324 D3 = TRI->getSubReg(Reg, ARM::dsub_6);
326 assert(RegSpc == OddDblSpc && "unknown register spacing");
327 D0 = TRI->getSubReg(Reg, ARM::dsub_1);
328 D1 = TRI->getSubReg(Reg, ARM::dsub_3);
329 D2 = TRI->getSubReg(Reg, ARM::dsub_5);
330 D3 = TRI->getSubReg(Reg, ARM::dsub_7);
334 /// ExpandVLD - Translate VLD pseudo instructions with Q, QQ or QQQQ register
335 /// operands to real VLD instructions with D register operands.
336 void ARMExpandPseudo::ExpandVLD(MachineBasicBlock::iterator &MBBI) {
337 MachineInstr &MI = *MBBI;
338 MachineBasicBlock &MBB = *MI.getParent();
340 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
341 assert(TableEntry && TableEntry->IsLoad && "NEONLdStTable lookup failed");
342 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
343 unsigned NumRegs = TableEntry->NumRegs;
345 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
346 TII->get(TableEntry->RealOpc));
349 bool DstIsDead = MI.getOperand(OpIdx).isDead();
350 unsigned DstReg = MI.getOperand(OpIdx++).getReg();
351 unsigned D0, D1, D2, D3;
352 GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
353 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
354 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
356 MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
358 MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
360 if (TableEntry->HasWriteBack)
361 MIB.addOperand(MI.getOperand(OpIdx++));
363 // Copy the addrmode6 operands.
364 MIB.addOperand(MI.getOperand(OpIdx++));
365 MIB.addOperand(MI.getOperand(OpIdx++));
366 // Copy the am6offset operand.
367 if (TableEntry->HasWriteBack)
368 MIB.addOperand(MI.getOperand(OpIdx++));
370 // For an instruction writing double-spaced subregs, the pseudo instruction
371 // has an extra operand that is a use of the super-register. Record the
372 // operand index and skip over it.
373 unsigned SrcOpIdx = 0;
374 if (RegSpc == EvenDblSpc || RegSpc == OddDblSpc)
377 // Copy the predicate operands.
378 MIB.addOperand(MI.getOperand(OpIdx++));
379 MIB.addOperand(MI.getOperand(OpIdx++));
381 // Copy the super-register source operand used for double-spaced subregs over
382 // to the new instruction as an implicit operand.
384 MachineOperand MO = MI.getOperand(SrcOpIdx);
385 MO.setImplicit(true);
388 // Add an implicit def for the super-register.
389 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
390 TransferImpOps(MI, MIB, MIB);
391 MI.eraseFromParent();
394 /// ExpandVST - Translate VST pseudo instructions with Q, QQ or QQQQ register
395 /// operands to real VST instructions with D register operands.
396 void ARMExpandPseudo::ExpandVST(MachineBasicBlock::iterator &MBBI) {
397 MachineInstr &MI = *MBBI;
398 MachineBasicBlock &MBB = *MI.getParent();
400 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
401 assert(TableEntry && !TableEntry->IsLoad && "NEONLdStTable lookup failed");
402 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
403 unsigned NumRegs = TableEntry->NumRegs;
405 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
406 TII->get(TableEntry->RealOpc));
408 if (TableEntry->HasWriteBack)
409 MIB.addOperand(MI.getOperand(OpIdx++));
411 // Copy the addrmode6 operands.
412 MIB.addOperand(MI.getOperand(OpIdx++));
413 MIB.addOperand(MI.getOperand(OpIdx++));
414 // Copy the am6offset operand.
415 if (TableEntry->HasWriteBack)
416 MIB.addOperand(MI.getOperand(OpIdx++));
418 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
419 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
420 unsigned D0, D1, D2, D3;
421 GetDSubRegs(SrcReg, RegSpc, TRI, D0, D1, D2, D3);
422 MIB.addReg(D0).addReg(D1);
428 // Copy the predicate operands.
429 MIB.addOperand(MI.getOperand(OpIdx++));
430 MIB.addOperand(MI.getOperand(OpIdx++));
433 // Add an implicit kill for the super-reg.
434 (*MIB).addRegisterKilled(SrcReg, TRI, true);
435 TransferImpOps(MI, MIB, MIB);
436 MI.eraseFromParent();
439 /// ExpandLaneOp - Translate VLD*LN and VST*LN instructions with Q, QQ or QQQQ
440 /// register operands to real instructions with D register operands.
441 void ARMExpandPseudo::ExpandLaneOp(MachineBasicBlock::iterator &MBBI) {
442 MachineInstr &MI = *MBBI;
443 MachineBasicBlock &MBB = *MI.getParent();
445 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
446 assert(TableEntry && "NEONLdStTable lookup failed");
447 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
448 unsigned NumRegs = TableEntry->NumRegs;
449 unsigned RegElts = TableEntry->RegElts;
451 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
452 TII->get(TableEntry->RealOpc));
454 // The lane operand is always the 3rd from last operand, before the 2
455 // predicate operands.
456 unsigned Lane = MI.getOperand(MI.getDesc().getNumOperands() - 3).getImm();
458 // Adjust the lane and spacing as needed for Q registers.
459 assert(RegSpc != OddDblSpc && "unexpected register spacing for VLD/VST-lane");
460 if (RegSpc == EvenDblSpc && Lane >= RegElts) {
464 assert(Lane < RegElts && "out of range lane for VLD/VST-lane");
466 unsigned D0, D1, D2, D3;
468 bool DstIsDead = false;
469 if (TableEntry->IsLoad) {
470 DstIsDead = MI.getOperand(OpIdx).isDead();
471 DstReg = MI.getOperand(OpIdx++).getReg();
472 GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
473 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
474 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
476 MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
478 MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
481 if (TableEntry->HasWriteBack)
482 MIB.addOperand(MI.getOperand(OpIdx++));
484 // Copy the addrmode6 operands.
485 MIB.addOperand(MI.getOperand(OpIdx++));
486 MIB.addOperand(MI.getOperand(OpIdx++));
487 // Copy the am6offset operand.
488 if (TableEntry->HasWriteBack)
489 MIB.addOperand(MI.getOperand(OpIdx++));
491 // Grab the super-register source.
492 MachineOperand MO = MI.getOperand(OpIdx++);
493 if (!TableEntry->IsLoad)
494 GetDSubRegs(MO.getReg(), RegSpc, TRI, D0, D1, D2, D3);
496 // Add the subregs as sources of the new instruction.
497 unsigned SrcFlags = (getUndefRegState(MO.isUndef()) |
498 getKillRegState(MO.isKill()));
499 MIB.addReg(D0, SrcFlags).addReg(D1, SrcFlags);
501 MIB.addReg(D2, SrcFlags);
503 MIB.addReg(D3, SrcFlags);
505 // Add the lane number operand.
509 // Copy the predicate operands.
510 MIB.addOperand(MI.getOperand(OpIdx++));
511 MIB.addOperand(MI.getOperand(OpIdx++));
513 // Copy the super-register source to be an implicit source.
514 MO.setImplicit(true);
516 if (TableEntry->IsLoad)
517 // Add an implicit def for the super-register.
518 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
519 TransferImpOps(MI, MIB, MIB);
520 MI.eraseFromParent();
523 /// ExpandVTBL - Translate VTBL and VTBX pseudo instructions with Q or QQ
524 /// register operands to real instructions with D register operands.
525 void ARMExpandPseudo::ExpandVTBL(MachineBasicBlock::iterator &MBBI,
526 unsigned Opc, bool IsExt, unsigned NumRegs) {
527 MachineInstr &MI = *MBBI;
528 MachineBasicBlock &MBB = *MI.getParent();
530 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc));
533 // Transfer the destination register operand.
534 MIB.addOperand(MI.getOperand(OpIdx++));
536 MIB.addOperand(MI.getOperand(OpIdx++));
538 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
539 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
540 unsigned D0, D1, D2, D3;
541 GetDSubRegs(SrcReg, SingleSpc, TRI, D0, D1, D2, D3);
542 MIB.addReg(D0).addReg(D1);
548 // Copy the other source register operand.
549 MIB.addOperand(MI.getOperand(OpIdx++));
551 // Copy the predicate operands.
552 MIB.addOperand(MI.getOperand(OpIdx++));
553 MIB.addOperand(MI.getOperand(OpIdx++));
556 // Add an implicit kill for the super-reg.
557 (*MIB).addRegisterKilled(SrcReg, TRI, true);
558 TransferImpOps(MI, MIB, MIB);
559 MI.eraseFromParent();
562 bool ARMExpandPseudo::ExpandMBB(MachineBasicBlock &MBB) {
563 bool Modified = false;
565 MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
567 MachineInstr &MI = *MBBI;
568 MachineBasicBlock::iterator NMBBI = llvm::next(MBBI);
570 bool ModifiedOp = true;
571 unsigned Opcode = MI.getOpcode();
577 case ARM::tLDRpci_pic:
578 case ARM::t2LDRpci_pic: {
579 unsigned NewLdOpc = (Opcode == ARM::tLDRpci_pic)
580 ? ARM::tLDRpci : ARM::t2LDRpci;
581 unsigned DstReg = MI.getOperand(0).getReg();
582 bool DstIsDead = MI.getOperand(0).isDead();
583 MachineInstrBuilder MIB1 =
584 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
585 TII->get(NewLdOpc), DstReg)
586 .addOperand(MI.getOperand(1)));
587 (*MIB1).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
588 MachineInstrBuilder MIB2 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
589 TII->get(ARM::tPICADD))
590 .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead))
592 .addOperand(MI.getOperand(2));
593 TransferImpOps(MI, MIB1, MIB2);
594 MI.eraseFromParent();
599 case ARM::t2MOVi32imm: {
600 unsigned PredReg = 0;
601 ARMCC::CondCodes Pred = llvm::getInstrPredicate(&MI, PredReg);
602 unsigned DstReg = MI.getOperand(0).getReg();
603 bool DstIsDead = MI.getOperand(0).isDead();
604 const MachineOperand &MO = MI.getOperand(1);
605 MachineInstrBuilder LO16, HI16;
607 LO16 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
608 TII->get(Opcode == ARM::MOVi32imm ?
609 ARM::MOVi16 : ARM::t2MOVi16),
611 HI16 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
612 TII->get(Opcode == ARM::MOVi32imm ?
613 ARM::MOVTi16 : ARM::t2MOVTi16))
614 .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead))
618 unsigned Imm = MO.getImm();
619 unsigned Lo16 = Imm & 0xffff;
620 unsigned Hi16 = (Imm >> 16) & 0xffff;
621 LO16 = LO16.addImm(Lo16);
622 HI16 = HI16.addImm(Hi16);
624 const GlobalValue *GV = MO.getGlobal();
625 unsigned TF = MO.getTargetFlags();
626 LO16 = LO16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_LO16);
627 HI16 = HI16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_HI16);
629 (*LO16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
630 (*HI16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
631 LO16.addImm(Pred).addReg(PredReg);
632 HI16.addImm(Pred).addReg(PredReg);
633 TransferImpOps(MI, LO16, HI16);
634 MI.eraseFromParent();
639 unsigned DstReg = MI.getOperand(0).getReg();
640 bool DstIsDead = MI.getOperand(0).isDead();
641 unsigned EvenDst = TRI->getSubReg(DstReg, ARM::qsub_0);
642 unsigned OddDst = TRI->getSubReg(DstReg, ARM::qsub_1);
643 unsigned SrcReg = MI.getOperand(1).getReg();
644 bool SrcIsKill = MI.getOperand(1).isKill();
645 unsigned EvenSrc = TRI->getSubReg(SrcReg, ARM::qsub_0);
646 unsigned OddSrc = TRI->getSubReg(SrcReg, ARM::qsub_1);
647 MachineInstrBuilder Even =
648 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
649 TII->get(ARM::VMOVQ))
651 getDefRegState(true) | getDeadRegState(DstIsDead))
652 .addReg(EvenSrc, getKillRegState(SrcIsKill)));
653 MachineInstrBuilder Odd =
654 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
655 TII->get(ARM::VMOVQ))
657 getDefRegState(true) | getDeadRegState(DstIsDead))
658 .addReg(OddSrc, getKillRegState(SrcIsKill)));
659 TransferImpOps(MI, Even, Odd);
660 MI.eraseFromParent();
665 MachineInstrBuilder MIB =
666 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::VLDMD));
668 // Grab the Q register destination.
669 bool DstIsDead = MI.getOperand(OpIdx).isDead();
670 unsigned DstReg = MI.getOperand(OpIdx++).getReg();
671 // Copy the addrmode4 operands.
672 MIB.addOperand(MI.getOperand(OpIdx++));
673 MIB.addOperand(MI.getOperand(OpIdx++));
674 // Copy the predicate operands.
675 MIB.addOperand(MI.getOperand(OpIdx++));
676 MIB.addOperand(MI.getOperand(OpIdx++));
677 // Add the destination operands (D subregs).
678 unsigned D0 = TRI->getSubReg(DstReg, ARM::dsub_0);
679 unsigned D1 = TRI->getSubReg(DstReg, ARM::dsub_1);
680 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
681 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
682 // Add an implicit def for the super-register.
683 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
684 TransferImpOps(MI, MIB, MIB);
685 MI.eraseFromParent();
690 MachineInstrBuilder MIB =
691 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::VSTMD));
693 // Grab the Q register source.
694 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
695 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
696 // Copy the addrmode4 operands.
697 MIB.addOperand(MI.getOperand(OpIdx++));
698 MIB.addOperand(MI.getOperand(OpIdx++));
699 // Copy the predicate operands.
700 MIB.addOperand(MI.getOperand(OpIdx++));
701 MIB.addOperand(MI.getOperand(OpIdx++));
702 // Add the source operands (D subregs).
703 unsigned D0 = TRI->getSubReg(SrcReg, ARM::dsub_0);
704 unsigned D1 = TRI->getSubReg(SrcReg, ARM::dsub_1);
705 MIB.addReg(D0).addReg(D1);
707 // Add an implicit kill for the Q register.
708 (*MIB).addRegisterKilled(SrcReg, TRI, true);
709 TransferImpOps(MI, MIB, MIB);
710 MI.eraseFromParent();
714 case ARM::VLD1q8Pseudo:
715 case ARM::VLD1q16Pseudo:
716 case ARM::VLD1q32Pseudo:
717 case ARM::VLD1q64Pseudo:
718 case ARM::VLD1q8Pseudo_UPD:
719 case ARM::VLD1q16Pseudo_UPD:
720 case ARM::VLD1q32Pseudo_UPD:
721 case ARM::VLD1q64Pseudo_UPD:
722 case ARM::VLD2d8Pseudo:
723 case ARM::VLD2d16Pseudo:
724 case ARM::VLD2d32Pseudo:
725 case ARM::VLD2q8Pseudo:
726 case ARM::VLD2q16Pseudo:
727 case ARM::VLD2q32Pseudo:
728 case ARM::VLD2d8Pseudo_UPD:
729 case ARM::VLD2d16Pseudo_UPD:
730 case ARM::VLD2d32Pseudo_UPD:
731 case ARM::VLD2q8Pseudo_UPD:
732 case ARM::VLD2q16Pseudo_UPD:
733 case ARM::VLD2q32Pseudo_UPD:
734 case ARM::VLD3d8Pseudo:
735 case ARM::VLD3d16Pseudo:
736 case ARM::VLD3d32Pseudo:
737 case ARM::VLD1d64TPseudo:
738 case ARM::VLD3d8Pseudo_UPD:
739 case ARM::VLD3d16Pseudo_UPD:
740 case ARM::VLD3d32Pseudo_UPD:
741 case ARM::VLD1d64TPseudo_UPD:
742 case ARM::VLD3q8Pseudo_UPD:
743 case ARM::VLD3q16Pseudo_UPD:
744 case ARM::VLD3q32Pseudo_UPD:
745 case ARM::VLD3q8oddPseudo_UPD:
746 case ARM::VLD3q16oddPseudo_UPD:
747 case ARM::VLD3q32oddPseudo_UPD:
748 case ARM::VLD4d8Pseudo:
749 case ARM::VLD4d16Pseudo:
750 case ARM::VLD4d32Pseudo:
751 case ARM::VLD1d64QPseudo:
752 case ARM::VLD4d8Pseudo_UPD:
753 case ARM::VLD4d16Pseudo_UPD:
754 case ARM::VLD4d32Pseudo_UPD:
755 case ARM::VLD1d64QPseudo_UPD:
756 case ARM::VLD4q8Pseudo_UPD:
757 case ARM::VLD4q16Pseudo_UPD:
758 case ARM::VLD4q32Pseudo_UPD:
759 case ARM::VLD4q8oddPseudo_UPD:
760 case ARM::VLD4q16oddPseudo_UPD:
761 case ARM::VLD4q32oddPseudo_UPD:
765 case ARM::VST1q8Pseudo:
766 case ARM::VST1q16Pseudo:
767 case ARM::VST1q32Pseudo:
768 case ARM::VST1q64Pseudo:
769 case ARM::VST1q8Pseudo_UPD:
770 case ARM::VST1q16Pseudo_UPD:
771 case ARM::VST1q32Pseudo_UPD:
772 case ARM::VST1q64Pseudo_UPD:
773 case ARM::VST2d8Pseudo:
774 case ARM::VST2d16Pseudo:
775 case ARM::VST2d32Pseudo:
776 case ARM::VST2q8Pseudo:
777 case ARM::VST2q16Pseudo:
778 case ARM::VST2q32Pseudo:
779 case ARM::VST2d8Pseudo_UPD:
780 case ARM::VST2d16Pseudo_UPD:
781 case ARM::VST2d32Pseudo_UPD:
782 case ARM::VST2q8Pseudo_UPD:
783 case ARM::VST2q16Pseudo_UPD:
784 case ARM::VST2q32Pseudo_UPD:
785 case ARM::VST3d8Pseudo:
786 case ARM::VST3d16Pseudo:
787 case ARM::VST3d32Pseudo:
788 case ARM::VST1d64TPseudo:
789 case ARM::VST3d8Pseudo_UPD:
790 case ARM::VST3d16Pseudo_UPD:
791 case ARM::VST3d32Pseudo_UPD:
792 case ARM::VST1d64TPseudo_UPD:
793 case ARM::VST3q8Pseudo_UPD:
794 case ARM::VST3q16Pseudo_UPD:
795 case ARM::VST3q32Pseudo_UPD:
796 case ARM::VST3q8oddPseudo_UPD:
797 case ARM::VST3q16oddPseudo_UPD:
798 case ARM::VST3q32oddPseudo_UPD:
799 case ARM::VST4d8Pseudo:
800 case ARM::VST4d16Pseudo:
801 case ARM::VST4d32Pseudo:
802 case ARM::VST1d64QPseudo:
803 case ARM::VST4d8Pseudo_UPD:
804 case ARM::VST4d16Pseudo_UPD:
805 case ARM::VST4d32Pseudo_UPD:
806 case ARM::VST1d64QPseudo_UPD:
807 case ARM::VST4q8Pseudo_UPD:
808 case ARM::VST4q16Pseudo_UPD:
809 case ARM::VST4q32Pseudo_UPD:
810 case ARM::VST4q8oddPseudo_UPD:
811 case ARM::VST4q16oddPseudo_UPD:
812 case ARM::VST4q32oddPseudo_UPD:
816 case ARM::VLD2LNd8Pseudo:
817 case ARM::VLD2LNd16Pseudo:
818 case ARM::VLD2LNd32Pseudo:
819 case ARM::VLD2LNq16Pseudo:
820 case ARM::VLD2LNq32Pseudo:
821 case ARM::VLD2LNd8Pseudo_UPD:
822 case ARM::VLD2LNd16Pseudo_UPD:
823 case ARM::VLD2LNd32Pseudo_UPD:
824 case ARM::VLD2LNq16Pseudo_UPD:
825 case ARM::VLD2LNq32Pseudo_UPD:
826 case ARM::VLD3LNd8Pseudo:
827 case ARM::VLD3LNd16Pseudo:
828 case ARM::VLD3LNd32Pseudo:
829 case ARM::VLD3LNq16Pseudo:
830 case ARM::VLD3LNq32Pseudo:
831 case ARM::VLD3LNd8Pseudo_UPD:
832 case ARM::VLD3LNd16Pseudo_UPD:
833 case ARM::VLD3LNd32Pseudo_UPD:
834 case ARM::VLD3LNq16Pseudo_UPD:
835 case ARM::VLD3LNq32Pseudo_UPD:
836 case ARM::VLD4LNd8Pseudo:
837 case ARM::VLD4LNd16Pseudo:
838 case ARM::VLD4LNd32Pseudo:
839 case ARM::VLD4LNq16Pseudo:
840 case ARM::VLD4LNq32Pseudo:
841 case ARM::VLD4LNd8Pseudo_UPD:
842 case ARM::VLD4LNd16Pseudo_UPD:
843 case ARM::VLD4LNd32Pseudo_UPD:
844 case ARM::VLD4LNq16Pseudo_UPD:
845 case ARM::VLD4LNq32Pseudo_UPD:
846 case ARM::VST2LNd8Pseudo:
847 case ARM::VST2LNd16Pseudo:
848 case ARM::VST2LNd32Pseudo:
849 case ARM::VST2LNq16Pseudo:
850 case ARM::VST2LNq32Pseudo:
851 case ARM::VST2LNd8Pseudo_UPD:
852 case ARM::VST2LNd16Pseudo_UPD:
853 case ARM::VST2LNd32Pseudo_UPD:
854 case ARM::VST2LNq16Pseudo_UPD:
855 case ARM::VST2LNq32Pseudo_UPD:
856 case ARM::VST3LNd8Pseudo:
857 case ARM::VST3LNd16Pseudo:
858 case ARM::VST3LNd32Pseudo:
859 case ARM::VST3LNq16Pseudo:
860 case ARM::VST3LNq32Pseudo:
861 case ARM::VST3LNd8Pseudo_UPD:
862 case ARM::VST3LNd16Pseudo_UPD:
863 case ARM::VST3LNd32Pseudo_UPD:
864 case ARM::VST3LNq16Pseudo_UPD:
865 case ARM::VST3LNq32Pseudo_UPD:
866 case ARM::VST4LNd8Pseudo:
867 case ARM::VST4LNd16Pseudo:
868 case ARM::VST4LNd32Pseudo:
869 case ARM::VST4LNq16Pseudo:
870 case ARM::VST4LNq32Pseudo:
871 case ARM::VST4LNd8Pseudo_UPD:
872 case ARM::VST4LNd16Pseudo_UPD:
873 case ARM::VST4LNd32Pseudo_UPD:
874 case ARM::VST4LNq16Pseudo_UPD:
875 case ARM::VST4LNq32Pseudo_UPD:
879 case ARM::VTBL2Pseudo:
880 ExpandVTBL(MBBI, ARM::VTBL2, false, 2); break;
881 case ARM::VTBL3Pseudo:
882 ExpandVTBL(MBBI, ARM::VTBL3, false, 3); break;
883 case ARM::VTBL4Pseudo:
884 ExpandVTBL(MBBI, ARM::VTBL4, false, 4); break;
885 case ARM::VTBX2Pseudo:
886 ExpandVTBL(MBBI, ARM::VTBX2, true, 2); break;
887 case ARM::VTBX3Pseudo:
888 ExpandVTBL(MBBI, ARM::VTBX3, true, 3); break;
889 case ARM::VTBX4Pseudo:
890 ExpandVTBL(MBBI, ARM::VTBX4, true, 4); break;
901 bool ARMExpandPseudo::runOnMachineFunction(MachineFunction &MF) {
902 TII = MF.getTarget().getInstrInfo();
903 TRI = MF.getTarget().getRegisterInfo();
905 bool Modified = false;
906 for (MachineFunction::iterator MFI = MF.begin(), E = MF.end(); MFI != E;
908 Modified |= ExpandMBB(*MFI);
912 /// createARMExpandPseudoPass - returns an instance of the pseudo instruction
914 FunctionPass *llvm::createARMExpandPseudoPass() {
915 return new ARMExpandPseudo();