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 "ARMBaseRegisterInfo.h"
21 #include "ARMMachineFunctionInfo.h"
22 #include "ARMRegisterInfo.h"
23 #include "MCTargetDesc/ARMAddressingModes.h"
24 #include "llvm/CodeGen/MachineFrameInfo.h"
25 #include "llvm/CodeGen/MachineFunctionPass.h"
26 #include "llvm/CodeGen/MachineInstrBuilder.h"
27 #include "llvm/Target/TargetFrameLowering.h"
28 #include "llvm/Target/TargetRegisterInfo.h"
29 #include "llvm/Support/CommandLine.h"
30 #include "llvm/Support/raw_ostream.h" // FIXME: for debug only. remove!
34 VerifyARMPseudo("verify-arm-pseudo-expand", cl::Hidden,
35 cl::desc("Verify machine code after expanding ARM pseudos"));
38 class ARMExpandPseudo : public MachineFunctionPass {
41 ARMExpandPseudo() : MachineFunctionPass(ID) {}
43 const ARMBaseInstrInfo *TII;
44 const TargetRegisterInfo *TRI;
45 const ARMSubtarget *STI;
48 virtual bool runOnMachineFunction(MachineFunction &Fn);
50 virtual const char *getPassName() const {
51 return "ARM pseudo instruction expansion pass";
55 void TransferImpOps(MachineInstr &OldMI,
56 MachineInstrBuilder &UseMI, MachineInstrBuilder &DefMI);
57 bool ExpandMI(MachineBasicBlock &MBB,
58 MachineBasicBlock::iterator MBBI);
59 bool ExpandMBB(MachineBasicBlock &MBB);
60 void ExpandVLD(MachineBasicBlock::iterator &MBBI);
61 void ExpandVST(MachineBasicBlock::iterator &MBBI);
62 void ExpandLaneOp(MachineBasicBlock::iterator &MBBI);
63 void ExpandVTBL(MachineBasicBlock::iterator &MBBI,
64 unsigned Opc, bool IsExt, unsigned NumRegs);
65 void ExpandMOV32BitImm(MachineBasicBlock &MBB,
66 MachineBasicBlock::iterator &MBBI);
68 char ARMExpandPseudo::ID = 0;
71 /// TransferImpOps - Transfer implicit operands on the pseudo instruction to
72 /// the instructions created from the expansion.
73 void ARMExpandPseudo::TransferImpOps(MachineInstr &OldMI,
74 MachineInstrBuilder &UseMI,
75 MachineInstrBuilder &DefMI) {
76 const MCInstrDesc &Desc = OldMI.getDesc();
77 for (unsigned i = Desc.getNumOperands(), e = OldMI.getNumOperands();
79 const MachineOperand &MO = OldMI.getOperand(i);
80 assert(MO.isReg() && MO.getReg());
89 // Constants for register spacing in NEON load/store instructions.
90 // For quad-register load-lane and store-lane pseudo instructors, the
91 // spacing is initially assumed to be EvenDblSpc, and that is changed to
92 // OddDblSpc depending on the lane number operand.
99 // Entries for NEON load/store information table. The table is sorted by
100 // PseudoOpc for fast binary-search lookups.
101 struct NEONLdStTableEntry {
106 NEONRegSpacing RegSpacing;
107 unsigned char NumRegs; // D registers loaded or stored
108 unsigned char RegElts; // elements per D register; used for lane ops
109 // FIXME: Temporary flag to denote whether the real instruction takes
110 // a single register (like the encoding) or all of the registers in
111 // the list (like the asm syntax and the isel DAG). When all definitions
112 // are converted to take only the single encoded register, this will
114 bool copyAllListRegs;
116 // Comparison methods for binary search of the table.
117 bool operator<(const NEONLdStTableEntry &TE) const {
118 return PseudoOpc < TE.PseudoOpc;
120 friend bool operator<(const NEONLdStTableEntry &TE, unsigned PseudoOpc) {
121 return TE.PseudoOpc < PseudoOpc;
123 friend bool LLVM_ATTRIBUTE_UNUSED operator<(unsigned PseudoOpc,
124 const NEONLdStTableEntry &TE) {
125 return PseudoOpc < TE.PseudoOpc;
130 static const NEONLdStTableEntry NEONLdStTable[] = {
131 { ARM::VLD1DUPq16Pseudo, ARM::VLD1DUPq16, true, false, SingleSpc, 2, 4,true},
132 { ARM::VLD1DUPq16Pseudo_UPD, ARM::VLD1DUPq16_UPD, true, true, SingleSpc, 2, 4,true},
133 { ARM::VLD1DUPq32Pseudo, ARM::VLD1DUPq32, true, false, SingleSpc, 2, 2,true},
134 { ARM::VLD1DUPq32Pseudo_UPD, ARM::VLD1DUPq32_UPD, true, true, SingleSpc, 2, 2,true},
135 { ARM::VLD1DUPq8Pseudo, ARM::VLD1DUPq8, true, false, SingleSpc, 2, 8,true},
136 { ARM::VLD1DUPq8Pseudo_UPD, ARM::VLD1DUPq8_UPD, true, true, SingleSpc, 2, 8,true},
138 { ARM::VLD1LNq16Pseudo, ARM::VLD1LNd16, true, false, EvenDblSpc, 1, 4 ,true},
139 { ARM::VLD1LNq16Pseudo_UPD, ARM::VLD1LNd16_UPD, true, true, EvenDblSpc, 1, 4 ,true},
140 { ARM::VLD1LNq32Pseudo, ARM::VLD1LNd32, true, false, EvenDblSpc, 1, 2 ,true},
141 { ARM::VLD1LNq32Pseudo_UPD, ARM::VLD1LNd32_UPD, true, true, EvenDblSpc, 1, 2 ,true},
142 { ARM::VLD1LNq8Pseudo, ARM::VLD1LNd8, true, false, EvenDblSpc, 1, 8 ,true},
143 { ARM::VLD1LNq8Pseudo_UPD, ARM::VLD1LNd8_UPD, true, true, EvenDblSpc, 1, 8 ,true},
145 { ARM::VLD1d64QPseudo, ARM::VLD1d64Q, true, false, SingleSpc, 4, 1 ,false},
146 { ARM::VLD1d64QPseudo_UPD, ARM::VLD1d64Q_UPD, true, true, SingleSpc, 4, 1 ,false},
147 { ARM::VLD1d64TPseudo, ARM::VLD1d64T, true, false, SingleSpc, 3, 1 ,false},
148 { ARM::VLD1d64TPseudo_UPD, ARM::VLD1d64T_UPD, true, true, SingleSpc, 3, 1 ,false},
150 { ARM::VLD1q16Pseudo, ARM::VLD1q16, true, false, SingleSpc, 2, 4 ,false},
151 { ARM::VLD1q16Pseudo_UPD, ARM::VLD1q16_UPD, true, true, SingleSpc, 2, 4 ,false},
152 { ARM::VLD1q32Pseudo, ARM::VLD1q32, true, false, SingleSpc, 2, 2 ,false},
153 { ARM::VLD1q32Pseudo_UPD, ARM::VLD1q32_UPD, true, true, SingleSpc, 2, 2 ,false},
154 { ARM::VLD1q64Pseudo, ARM::VLD1q64, true, false, SingleSpc, 2, 1 ,false},
155 { ARM::VLD1q64Pseudo_UPD, ARM::VLD1q64_UPD, true, true, SingleSpc, 2, 1 ,false},
156 { ARM::VLD1q8Pseudo, ARM::VLD1q8, true, false, SingleSpc, 2, 8 ,false},
157 { ARM::VLD1q8Pseudo_UPD, ARM::VLD1q8_UPD, true, true, SingleSpc, 2, 8 ,false},
159 { ARM::VLD2DUPd16Pseudo, ARM::VLD2DUPd16, true, false, SingleSpc, 2, 4,true},
160 { ARM::VLD2DUPd16Pseudo_UPD, ARM::VLD2DUPd16_UPD, true, true, SingleSpc, 2, 4,true},
161 { ARM::VLD2DUPd32Pseudo, ARM::VLD2DUPd32, true, false, SingleSpc, 2, 2,true},
162 { ARM::VLD2DUPd32Pseudo_UPD, ARM::VLD2DUPd32_UPD, true, true, SingleSpc, 2, 2,true},
163 { ARM::VLD2DUPd8Pseudo, ARM::VLD2DUPd8, true, false, SingleSpc, 2, 8,true},
164 { ARM::VLD2DUPd8Pseudo_UPD, ARM::VLD2DUPd8_UPD, true, true, SingleSpc, 2, 8,true},
166 { ARM::VLD2LNd16Pseudo, ARM::VLD2LNd16, true, false, SingleSpc, 2, 4 ,true},
167 { ARM::VLD2LNd16Pseudo_UPD, ARM::VLD2LNd16_UPD, true, true, SingleSpc, 2, 4 ,true},
168 { ARM::VLD2LNd32Pseudo, ARM::VLD2LNd32, true, false, SingleSpc, 2, 2 ,true},
169 { ARM::VLD2LNd32Pseudo_UPD, ARM::VLD2LNd32_UPD, true, true, SingleSpc, 2, 2 ,true},
170 { ARM::VLD2LNd8Pseudo, ARM::VLD2LNd8, true, false, SingleSpc, 2, 8 ,true},
171 { ARM::VLD2LNd8Pseudo_UPD, ARM::VLD2LNd8_UPD, true, true, SingleSpc, 2, 8 ,true},
172 { ARM::VLD2LNq16Pseudo, ARM::VLD2LNq16, true, false, EvenDblSpc, 2, 4 ,true},
173 { ARM::VLD2LNq16Pseudo_UPD, ARM::VLD2LNq16_UPD, true, true, EvenDblSpc, 2, 4 ,true},
174 { ARM::VLD2LNq32Pseudo, ARM::VLD2LNq32, true, false, EvenDblSpc, 2, 2 ,true},
175 { ARM::VLD2LNq32Pseudo_UPD, ARM::VLD2LNq32_UPD, true, true, EvenDblSpc, 2, 2 ,true},
177 { ARM::VLD2d16Pseudo, ARM::VLD2d16, true, false, SingleSpc, 2, 4 ,false},
178 { ARM::VLD2d16Pseudo_UPD, ARM::VLD2d16_UPD, true, true, SingleSpc, 2, 4 ,false},
179 { ARM::VLD2d32Pseudo, ARM::VLD2d32, true, false, SingleSpc, 2, 2 ,false},
180 { ARM::VLD2d32Pseudo_UPD, ARM::VLD2d32_UPD, true, true, SingleSpc, 2, 2 ,false},
181 { ARM::VLD2d8Pseudo, ARM::VLD2d8, true, false, SingleSpc, 2, 8 ,false},
182 { ARM::VLD2d8Pseudo_UPD, ARM::VLD2d8_UPD, true, true, SingleSpc, 2, 8 ,false},
184 { ARM::VLD2q16Pseudo, ARM::VLD2q16, true, false, SingleSpc, 4, 4 ,true},
185 { ARM::VLD2q16Pseudo_UPD, ARM::VLD2q16_UPD, true, true, SingleSpc, 4, 4 ,true},
186 { ARM::VLD2q32Pseudo, ARM::VLD2q32, true, false, SingleSpc, 4, 2 ,true},
187 { ARM::VLD2q32Pseudo_UPD, ARM::VLD2q32_UPD, true, true, SingleSpc, 4, 2 ,true},
188 { ARM::VLD2q8Pseudo, ARM::VLD2q8, true, false, SingleSpc, 4, 8 ,true},
189 { ARM::VLD2q8Pseudo_UPD, ARM::VLD2q8_UPD, true, true, SingleSpc, 4, 8 ,true},
191 { ARM::VLD3DUPd16Pseudo, ARM::VLD3DUPd16, true, false, SingleSpc, 3, 4,true},
192 { ARM::VLD3DUPd16Pseudo_UPD, ARM::VLD3DUPd16_UPD, true, true, SingleSpc, 3, 4,true},
193 { ARM::VLD3DUPd32Pseudo, ARM::VLD3DUPd32, true, false, SingleSpc, 3, 2,true},
194 { ARM::VLD3DUPd32Pseudo_UPD, ARM::VLD3DUPd32_UPD, true, true, SingleSpc, 3, 2,true},
195 { ARM::VLD3DUPd8Pseudo, ARM::VLD3DUPd8, true, false, SingleSpc, 3, 8,true},
196 { ARM::VLD3DUPd8Pseudo_UPD, ARM::VLD3DUPd8_UPD, true, true, SingleSpc, 3, 8,true},
198 { ARM::VLD3LNd16Pseudo, ARM::VLD3LNd16, true, false, SingleSpc, 3, 4 ,true},
199 { ARM::VLD3LNd16Pseudo_UPD, ARM::VLD3LNd16_UPD, true, true, SingleSpc, 3, 4 ,true},
200 { ARM::VLD3LNd32Pseudo, ARM::VLD3LNd32, true, false, SingleSpc, 3, 2 ,true},
201 { ARM::VLD3LNd32Pseudo_UPD, ARM::VLD3LNd32_UPD, true, true, SingleSpc, 3, 2 ,true},
202 { ARM::VLD3LNd8Pseudo, ARM::VLD3LNd8, true, false, SingleSpc, 3, 8 ,true},
203 { ARM::VLD3LNd8Pseudo_UPD, ARM::VLD3LNd8_UPD, true, true, SingleSpc, 3, 8 ,true},
204 { ARM::VLD3LNq16Pseudo, ARM::VLD3LNq16, true, false, EvenDblSpc, 3, 4 ,true},
205 { ARM::VLD3LNq16Pseudo_UPD, ARM::VLD3LNq16_UPD, true, true, EvenDblSpc, 3, 4 ,true},
206 { ARM::VLD3LNq32Pseudo, ARM::VLD3LNq32, true, false, EvenDblSpc, 3, 2 ,true},
207 { ARM::VLD3LNq32Pseudo_UPD, ARM::VLD3LNq32_UPD, true, true, EvenDblSpc, 3, 2 ,true},
209 { ARM::VLD3d16Pseudo, ARM::VLD3d16, true, false, SingleSpc, 3, 4 ,true},
210 { ARM::VLD3d16Pseudo_UPD, ARM::VLD3d16_UPD, true, true, SingleSpc, 3, 4 ,true},
211 { ARM::VLD3d32Pseudo, ARM::VLD3d32, true, false, SingleSpc, 3, 2 ,true},
212 { ARM::VLD3d32Pseudo_UPD, ARM::VLD3d32_UPD, true, true, SingleSpc, 3, 2 ,true},
213 { ARM::VLD3d8Pseudo, ARM::VLD3d8, true, false, SingleSpc, 3, 8 ,true},
214 { ARM::VLD3d8Pseudo_UPD, ARM::VLD3d8_UPD, true, true, SingleSpc, 3, 8 ,true},
216 { ARM::VLD3q16Pseudo_UPD, ARM::VLD3q16_UPD, true, true, EvenDblSpc, 3, 4 ,true},
217 { ARM::VLD3q16oddPseudo, ARM::VLD3q16, true, false, OddDblSpc, 3, 4 ,true},
218 { ARM::VLD3q16oddPseudo_UPD, ARM::VLD3q16_UPD, true, true, OddDblSpc, 3, 4 ,true},
219 { ARM::VLD3q32Pseudo_UPD, ARM::VLD3q32_UPD, true, true, EvenDblSpc, 3, 2 ,true},
220 { ARM::VLD3q32oddPseudo, ARM::VLD3q32, true, false, OddDblSpc, 3, 2 ,true},
221 { ARM::VLD3q32oddPseudo_UPD, ARM::VLD3q32_UPD, true, true, OddDblSpc, 3, 2 ,true},
222 { ARM::VLD3q8Pseudo_UPD, ARM::VLD3q8_UPD, true, true, EvenDblSpc, 3, 8 ,true},
223 { ARM::VLD3q8oddPseudo, ARM::VLD3q8, true, false, OddDblSpc, 3, 8 ,true},
224 { ARM::VLD3q8oddPseudo_UPD, ARM::VLD3q8_UPD, true, true, OddDblSpc, 3, 8 ,true},
226 { ARM::VLD4DUPd16Pseudo, ARM::VLD4DUPd16, true, false, SingleSpc, 4, 4,true},
227 { ARM::VLD4DUPd16Pseudo_UPD, ARM::VLD4DUPd16_UPD, true, true, SingleSpc, 4, 4,true},
228 { ARM::VLD4DUPd32Pseudo, ARM::VLD4DUPd32, true, false, SingleSpc, 4, 2,true},
229 { ARM::VLD4DUPd32Pseudo_UPD, ARM::VLD4DUPd32_UPD, true, true, SingleSpc, 4, 2,true},
230 { ARM::VLD4DUPd8Pseudo, ARM::VLD4DUPd8, true, false, SingleSpc, 4, 8,true},
231 { ARM::VLD4DUPd8Pseudo_UPD, ARM::VLD4DUPd8_UPD, true, true, SingleSpc, 4, 8,true},
233 { ARM::VLD4LNd16Pseudo, ARM::VLD4LNd16, true, false, SingleSpc, 4, 4 ,true},
234 { ARM::VLD4LNd16Pseudo_UPD, ARM::VLD4LNd16_UPD, true, true, SingleSpc, 4, 4 ,true},
235 { ARM::VLD4LNd32Pseudo, ARM::VLD4LNd32, true, false, SingleSpc, 4, 2 ,true},
236 { ARM::VLD4LNd32Pseudo_UPD, ARM::VLD4LNd32_UPD, true, true, SingleSpc, 4, 2 ,true},
237 { ARM::VLD4LNd8Pseudo, ARM::VLD4LNd8, true, false, SingleSpc, 4, 8 ,true},
238 { ARM::VLD4LNd8Pseudo_UPD, ARM::VLD4LNd8_UPD, true, true, SingleSpc, 4, 8 ,true},
239 { ARM::VLD4LNq16Pseudo, ARM::VLD4LNq16, true, false, EvenDblSpc, 4, 4 ,true},
240 { ARM::VLD4LNq16Pseudo_UPD, ARM::VLD4LNq16_UPD, true, true, EvenDblSpc, 4, 4 ,true},
241 { ARM::VLD4LNq32Pseudo, ARM::VLD4LNq32, true, false, EvenDblSpc, 4, 2 ,true},
242 { ARM::VLD4LNq32Pseudo_UPD, ARM::VLD4LNq32_UPD, true, true, EvenDblSpc, 4, 2 ,true},
244 { ARM::VLD4d16Pseudo, ARM::VLD4d16, true, false, SingleSpc, 4, 4 ,true},
245 { ARM::VLD4d16Pseudo_UPD, ARM::VLD4d16_UPD, true, true, SingleSpc, 4, 4 ,true},
246 { ARM::VLD4d32Pseudo, ARM::VLD4d32, true, false, SingleSpc, 4, 2 ,true},
247 { ARM::VLD4d32Pseudo_UPD, ARM::VLD4d32_UPD, true, true, SingleSpc, 4, 2 ,true},
248 { ARM::VLD4d8Pseudo, ARM::VLD4d8, true, false, SingleSpc, 4, 8 ,true},
249 { ARM::VLD4d8Pseudo_UPD, ARM::VLD4d8_UPD, true, true, SingleSpc, 4, 8 ,true},
251 { ARM::VLD4q16Pseudo_UPD, ARM::VLD4q16_UPD, true, true, EvenDblSpc, 4, 4 ,true},
252 { ARM::VLD4q16oddPseudo, ARM::VLD4q16, true, false, OddDblSpc, 4, 4 ,true},
253 { ARM::VLD4q16oddPseudo_UPD, ARM::VLD4q16_UPD, true, true, OddDblSpc, 4, 4 ,true},
254 { ARM::VLD4q32Pseudo_UPD, ARM::VLD4q32_UPD, true, true, EvenDblSpc, 4, 2 ,true},
255 { ARM::VLD4q32oddPseudo, ARM::VLD4q32, true, false, OddDblSpc, 4, 2 ,true},
256 { ARM::VLD4q32oddPseudo_UPD, ARM::VLD4q32_UPD, true, true, OddDblSpc, 4, 2 ,true},
257 { ARM::VLD4q8Pseudo_UPD, ARM::VLD4q8_UPD, true, true, EvenDblSpc, 4, 8 ,true},
258 { ARM::VLD4q8oddPseudo, ARM::VLD4q8, true, false, OddDblSpc, 4, 8 ,true},
259 { ARM::VLD4q8oddPseudo_UPD, ARM::VLD4q8_UPD, true, true, OddDblSpc, 4, 8 ,true},
261 { ARM::VST1LNq16Pseudo, ARM::VST1LNd16, false, false, EvenDblSpc, 1, 4 ,true},
262 { ARM::VST1LNq16Pseudo_UPD, ARM::VST1LNd16_UPD,false, true, EvenDblSpc, 1, 4 ,true},
263 { ARM::VST1LNq32Pseudo, ARM::VST1LNd32, false, false, EvenDblSpc, 1, 2 ,true},
264 { ARM::VST1LNq32Pseudo_UPD, ARM::VST1LNd32_UPD,false, true, EvenDblSpc, 1, 2 ,true},
265 { ARM::VST1LNq8Pseudo, ARM::VST1LNd8, false, false, EvenDblSpc, 1, 8 ,true},
266 { ARM::VST1LNq8Pseudo_UPD, ARM::VST1LNd8_UPD, false, true, EvenDblSpc, 1, 8 ,true},
268 { ARM::VST1d64QPseudo, ARM::VST1d64Q, false, false, SingleSpc, 4, 1 ,true},
269 { ARM::VST1d64QPseudo_UPD, ARM::VST1d64Q_UPD, false, true, SingleSpc, 4, 1 ,true},
270 { ARM::VST1d64TPseudo, ARM::VST1d64T, false, false, SingleSpc, 3, 1 ,true},
271 { ARM::VST1d64TPseudo_UPD, ARM::VST1d64T_UPD, false, true, SingleSpc, 3, 1 ,true},
273 { ARM::VST1q16Pseudo, ARM::VST1q16, false, false, SingleSpc, 2, 4 ,true},
274 { ARM::VST1q16Pseudo_UPD, ARM::VST1q16_UPD, false, true, SingleSpc, 2, 4 ,true},
275 { ARM::VST1q32Pseudo, ARM::VST1q32, false, false, SingleSpc, 2, 2 ,true},
276 { ARM::VST1q32Pseudo_UPD, ARM::VST1q32_UPD, false, true, SingleSpc, 2, 2 ,true},
277 { ARM::VST1q64Pseudo, ARM::VST1q64, false, false, SingleSpc, 2, 1 ,true},
278 { ARM::VST1q64Pseudo_UPD, ARM::VST1q64_UPD, false, true, SingleSpc, 2, 1 ,true},
279 { ARM::VST1q8Pseudo, ARM::VST1q8, false, false, SingleSpc, 2, 8 ,true},
280 { ARM::VST1q8Pseudo_UPD, ARM::VST1q8_UPD, false, true, SingleSpc, 2, 8 ,true},
282 { ARM::VST2LNd16Pseudo, ARM::VST2LNd16, false, false, SingleSpc, 2, 4 ,true},
283 { ARM::VST2LNd16Pseudo_UPD, ARM::VST2LNd16_UPD, false, true, SingleSpc, 2, 4 ,true},
284 { ARM::VST2LNd32Pseudo, ARM::VST2LNd32, false, false, SingleSpc, 2, 2 ,true},
285 { ARM::VST2LNd32Pseudo_UPD, ARM::VST2LNd32_UPD, false, true, SingleSpc, 2, 2 ,true},
286 { ARM::VST2LNd8Pseudo, ARM::VST2LNd8, false, false, SingleSpc, 2, 8 ,true},
287 { ARM::VST2LNd8Pseudo_UPD, ARM::VST2LNd8_UPD, false, true, SingleSpc, 2, 8 ,true},
288 { ARM::VST2LNq16Pseudo, ARM::VST2LNq16, false, false, EvenDblSpc, 2, 4,true},
289 { ARM::VST2LNq16Pseudo_UPD, ARM::VST2LNq16_UPD, false, true, EvenDblSpc, 2, 4,true},
290 { ARM::VST2LNq32Pseudo, ARM::VST2LNq32, false, false, EvenDblSpc, 2, 2,true},
291 { ARM::VST2LNq32Pseudo_UPD, ARM::VST2LNq32_UPD, false, true, EvenDblSpc, 2, 2,true},
293 { ARM::VST2d16Pseudo, ARM::VST2d16, false, false, SingleSpc, 2, 4 ,true},
294 { ARM::VST2d16Pseudo_UPD, ARM::VST2d16_UPD, false, true, SingleSpc, 2, 4 ,true},
295 { ARM::VST2d32Pseudo, ARM::VST2d32, false, false, SingleSpc, 2, 2 ,true},
296 { ARM::VST2d32Pseudo_UPD, ARM::VST2d32_UPD, false, true, SingleSpc, 2, 2 ,true},
297 { ARM::VST2d8Pseudo, ARM::VST2d8, false, false, SingleSpc, 2, 8 ,true},
298 { ARM::VST2d8Pseudo_UPD, ARM::VST2d8_UPD, false, true, SingleSpc, 2, 8 ,true},
300 { ARM::VST2q16Pseudo, ARM::VST2q16, false, false, SingleSpc, 4, 4 ,true},
301 { ARM::VST2q16Pseudo_UPD, ARM::VST2q16_UPD, false, true, SingleSpc, 4, 4 ,true},
302 { ARM::VST2q32Pseudo, ARM::VST2q32, false, false, SingleSpc, 4, 2 ,true},
303 { ARM::VST2q32Pseudo_UPD, ARM::VST2q32_UPD, false, true, SingleSpc, 4, 2 ,true},
304 { ARM::VST2q8Pseudo, ARM::VST2q8, false, false, SingleSpc, 4, 8 ,true},
305 { ARM::VST2q8Pseudo_UPD, ARM::VST2q8_UPD, false, true, SingleSpc, 4, 8 ,true},
307 { ARM::VST3LNd16Pseudo, ARM::VST3LNd16, false, false, SingleSpc, 3, 4 ,true},
308 { ARM::VST3LNd16Pseudo_UPD, ARM::VST3LNd16_UPD, false, true, SingleSpc, 3, 4 ,true},
309 { ARM::VST3LNd32Pseudo, ARM::VST3LNd32, false, false, SingleSpc, 3, 2 ,true},
310 { ARM::VST3LNd32Pseudo_UPD, ARM::VST3LNd32_UPD, false, true, SingleSpc, 3, 2 ,true},
311 { ARM::VST3LNd8Pseudo, ARM::VST3LNd8, false, false, SingleSpc, 3, 8 ,true},
312 { ARM::VST3LNd8Pseudo_UPD, ARM::VST3LNd8_UPD, false, true, SingleSpc, 3, 8 ,true},
313 { ARM::VST3LNq16Pseudo, ARM::VST3LNq16, false, false, EvenDblSpc, 3, 4,true},
314 { ARM::VST3LNq16Pseudo_UPD, ARM::VST3LNq16_UPD, false, true, EvenDblSpc, 3, 4,true},
315 { ARM::VST3LNq32Pseudo, ARM::VST3LNq32, false, false, EvenDblSpc, 3, 2,true},
316 { ARM::VST3LNq32Pseudo_UPD, ARM::VST3LNq32_UPD, false, true, EvenDblSpc, 3, 2,true},
318 { ARM::VST3d16Pseudo, ARM::VST3d16, false, false, SingleSpc, 3, 4 ,true},
319 { ARM::VST3d16Pseudo_UPD, ARM::VST3d16_UPD, false, true, SingleSpc, 3, 4 ,true},
320 { ARM::VST3d32Pseudo, ARM::VST3d32, false, false, SingleSpc, 3, 2 ,true},
321 { ARM::VST3d32Pseudo_UPD, ARM::VST3d32_UPD, false, true, SingleSpc, 3, 2 ,true},
322 { ARM::VST3d8Pseudo, ARM::VST3d8, false, false, SingleSpc, 3, 8 ,true},
323 { ARM::VST3d8Pseudo_UPD, ARM::VST3d8_UPD, false, true, SingleSpc, 3, 8 ,true},
325 { ARM::VST3q16Pseudo_UPD, ARM::VST3q16_UPD, false, true, EvenDblSpc, 3, 4 ,true},
326 { ARM::VST3q16oddPseudo, ARM::VST3q16, false, false, OddDblSpc, 3, 4 ,true},
327 { ARM::VST3q16oddPseudo_UPD, ARM::VST3q16_UPD, false, true, OddDblSpc, 3, 4 ,true},
328 { ARM::VST3q32Pseudo_UPD, ARM::VST3q32_UPD, false, true, EvenDblSpc, 3, 2 ,true},
329 { ARM::VST3q32oddPseudo, ARM::VST3q32, false, false, OddDblSpc, 3, 2 ,true},
330 { ARM::VST3q32oddPseudo_UPD, ARM::VST3q32_UPD, false, true, OddDblSpc, 3, 2 ,true},
331 { ARM::VST3q8Pseudo_UPD, ARM::VST3q8_UPD, false, true, EvenDblSpc, 3, 8 ,true},
332 { ARM::VST3q8oddPseudo, ARM::VST3q8, false, false, OddDblSpc, 3, 8 ,true},
333 { ARM::VST3q8oddPseudo_UPD, ARM::VST3q8_UPD, false, true, OddDblSpc, 3, 8 ,true},
335 { ARM::VST4LNd16Pseudo, ARM::VST4LNd16, false, false, SingleSpc, 4, 4 ,true},
336 { ARM::VST4LNd16Pseudo_UPD, ARM::VST4LNd16_UPD, false, true, SingleSpc, 4, 4 ,true},
337 { ARM::VST4LNd32Pseudo, ARM::VST4LNd32, false, false, SingleSpc, 4, 2 ,true},
338 { ARM::VST4LNd32Pseudo_UPD, ARM::VST4LNd32_UPD, false, true, SingleSpc, 4, 2 ,true},
339 { ARM::VST4LNd8Pseudo, ARM::VST4LNd8, false, false, SingleSpc, 4, 8 ,true},
340 { ARM::VST4LNd8Pseudo_UPD, ARM::VST4LNd8_UPD, false, true, SingleSpc, 4, 8 ,true},
341 { ARM::VST4LNq16Pseudo, ARM::VST4LNq16, false, false, EvenDblSpc, 4, 4,true},
342 { ARM::VST4LNq16Pseudo_UPD, ARM::VST4LNq16_UPD, false, true, EvenDblSpc, 4, 4,true},
343 { ARM::VST4LNq32Pseudo, ARM::VST4LNq32, false, false, EvenDblSpc, 4, 2,true},
344 { ARM::VST4LNq32Pseudo_UPD, ARM::VST4LNq32_UPD, false, true, EvenDblSpc, 4, 2,true},
346 { ARM::VST4d16Pseudo, ARM::VST4d16, false, false, SingleSpc, 4, 4 ,true},
347 { ARM::VST4d16Pseudo_UPD, ARM::VST4d16_UPD, false, true, SingleSpc, 4, 4 ,true},
348 { ARM::VST4d32Pseudo, ARM::VST4d32, false, false, SingleSpc, 4, 2 ,true},
349 { ARM::VST4d32Pseudo_UPD, ARM::VST4d32_UPD, false, true, SingleSpc, 4, 2 ,true},
350 { ARM::VST4d8Pseudo, ARM::VST4d8, false, false, SingleSpc, 4, 8 ,true},
351 { ARM::VST4d8Pseudo_UPD, ARM::VST4d8_UPD, false, true, SingleSpc, 4, 8 ,true},
353 { ARM::VST4q16Pseudo_UPD, ARM::VST4q16_UPD, false, true, EvenDblSpc, 4, 4 ,true},
354 { ARM::VST4q16oddPseudo, ARM::VST4q16, false, false, OddDblSpc, 4, 4 ,true},
355 { ARM::VST4q16oddPseudo_UPD, ARM::VST4q16_UPD, false, true, OddDblSpc, 4, 4 ,true},
356 { ARM::VST4q32Pseudo_UPD, ARM::VST4q32_UPD, false, true, EvenDblSpc, 4, 2 ,true},
357 { ARM::VST4q32oddPseudo, ARM::VST4q32, false, false, OddDblSpc, 4, 2 ,true},
358 { ARM::VST4q32oddPseudo_UPD, ARM::VST4q32_UPD, false, true, OddDblSpc, 4, 2 ,true},
359 { ARM::VST4q8Pseudo_UPD, ARM::VST4q8_UPD, false, true, EvenDblSpc, 4, 8 ,true},
360 { ARM::VST4q8oddPseudo, ARM::VST4q8, false, false, OddDblSpc, 4, 8 ,true},
361 { ARM::VST4q8oddPseudo_UPD, ARM::VST4q8_UPD, false, true, OddDblSpc, 4, 8 ,true}
364 /// LookupNEONLdSt - Search the NEONLdStTable for information about a NEON
365 /// load or store pseudo instruction.
366 static const NEONLdStTableEntry *LookupNEONLdSt(unsigned Opcode) {
367 unsigned NumEntries = array_lengthof(NEONLdStTable);
370 // Make sure the table is sorted.
371 static bool TableChecked = false;
373 for (unsigned i = 0; i != NumEntries-1; ++i)
374 assert(NEONLdStTable[i] < NEONLdStTable[i+1] &&
375 "NEONLdStTable is not sorted!");
380 const NEONLdStTableEntry *I =
381 std::lower_bound(NEONLdStTable, NEONLdStTable + NumEntries, Opcode);
382 if (I != NEONLdStTable + NumEntries && I->PseudoOpc == Opcode)
387 /// GetDSubRegs - Get 4 D subregisters of a Q, QQ, or QQQQ register,
388 /// corresponding to the specified register spacing. Not all of the results
389 /// are necessarily valid, e.g., a Q register only has 2 D subregisters.
390 static void GetDSubRegs(unsigned Reg, NEONRegSpacing RegSpc,
391 const TargetRegisterInfo *TRI, unsigned &D0,
392 unsigned &D1, unsigned &D2, unsigned &D3) {
393 if (RegSpc == SingleSpc) {
394 D0 = TRI->getSubReg(Reg, ARM::dsub_0);
395 D1 = TRI->getSubReg(Reg, ARM::dsub_1);
396 D2 = TRI->getSubReg(Reg, ARM::dsub_2);
397 D3 = TRI->getSubReg(Reg, ARM::dsub_3);
398 } else if (RegSpc == EvenDblSpc) {
399 D0 = TRI->getSubReg(Reg, ARM::dsub_0);
400 D1 = TRI->getSubReg(Reg, ARM::dsub_2);
401 D2 = TRI->getSubReg(Reg, ARM::dsub_4);
402 D3 = TRI->getSubReg(Reg, ARM::dsub_6);
404 assert(RegSpc == OddDblSpc && "unknown register spacing");
405 D0 = TRI->getSubReg(Reg, ARM::dsub_1);
406 D1 = TRI->getSubReg(Reg, ARM::dsub_3);
407 D2 = TRI->getSubReg(Reg, ARM::dsub_5);
408 D3 = TRI->getSubReg(Reg, ARM::dsub_7);
412 /// ExpandVLD - Translate VLD pseudo instructions with Q, QQ or QQQQ register
413 /// operands to real VLD instructions with D register operands.
414 void ARMExpandPseudo::ExpandVLD(MachineBasicBlock::iterator &MBBI) {
415 MachineInstr &MI = *MBBI;
416 MachineBasicBlock &MBB = *MI.getParent();
418 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
419 assert(TableEntry && TableEntry->IsLoad && "NEONLdStTable lookup failed");
420 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
421 unsigned NumRegs = TableEntry->NumRegs;
423 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
424 TII->get(TableEntry->RealOpc));
427 bool DstIsDead = MI.getOperand(OpIdx).isDead();
428 unsigned DstReg = MI.getOperand(OpIdx++).getReg();
429 unsigned D0, D1, D2, D3;
430 GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
431 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead));
432 if (NumRegs > 1 && TableEntry->copyAllListRegs)
433 MIB.addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
434 if (NumRegs > 2 && TableEntry->copyAllListRegs)
435 MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
436 if (NumRegs > 3 && TableEntry->copyAllListRegs)
437 MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
439 if (TableEntry->HasWriteBack)
440 MIB.addOperand(MI.getOperand(OpIdx++));
442 // Copy the addrmode6 operands.
443 MIB.addOperand(MI.getOperand(OpIdx++));
444 MIB.addOperand(MI.getOperand(OpIdx++));
445 // Copy the am6offset operand.
446 if (TableEntry->HasWriteBack)
447 MIB.addOperand(MI.getOperand(OpIdx++));
449 // For an instruction writing double-spaced subregs, the pseudo instruction
450 // has an extra operand that is a use of the super-register. Record the
451 // operand index and skip over it.
452 unsigned SrcOpIdx = 0;
453 if (RegSpc == EvenDblSpc || RegSpc == OddDblSpc)
456 // Copy the predicate operands.
457 MIB.addOperand(MI.getOperand(OpIdx++));
458 MIB.addOperand(MI.getOperand(OpIdx++));
460 // Copy the super-register source operand used for double-spaced subregs over
461 // to the new instruction as an implicit operand.
463 MachineOperand MO = MI.getOperand(SrcOpIdx);
464 MO.setImplicit(true);
467 // Add an implicit def for the super-register.
468 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
469 TransferImpOps(MI, MIB, MIB);
471 // Transfer memoperands.
472 MIB->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
474 MI.eraseFromParent();
477 /// ExpandVST - Translate VST pseudo instructions with Q, QQ or QQQQ register
478 /// operands to real VST instructions with D register operands.
479 void ARMExpandPseudo::ExpandVST(MachineBasicBlock::iterator &MBBI) {
480 MachineInstr &MI = *MBBI;
481 MachineBasicBlock &MBB = *MI.getParent();
483 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
484 assert(TableEntry && !TableEntry->IsLoad && "NEONLdStTable lookup failed");
485 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
486 unsigned NumRegs = TableEntry->NumRegs;
488 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
489 TII->get(TableEntry->RealOpc));
491 if (TableEntry->HasWriteBack)
492 MIB.addOperand(MI.getOperand(OpIdx++));
494 // Copy the addrmode6 operands.
495 MIB.addOperand(MI.getOperand(OpIdx++));
496 MIB.addOperand(MI.getOperand(OpIdx++));
497 // Copy the am6offset operand.
498 if (TableEntry->HasWriteBack)
499 MIB.addOperand(MI.getOperand(OpIdx++));
501 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
502 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
503 unsigned D0, D1, D2, D3;
504 GetDSubRegs(SrcReg, RegSpc, TRI, D0, D1, D2, D3);
505 MIB.addReg(D0).addReg(D1);
511 // Copy the predicate operands.
512 MIB.addOperand(MI.getOperand(OpIdx++));
513 MIB.addOperand(MI.getOperand(OpIdx++));
515 if (SrcIsKill) // Add an implicit kill for the super-reg.
516 MIB->addRegisterKilled(SrcReg, TRI, true);
517 TransferImpOps(MI, MIB, MIB);
519 // Transfer memoperands.
520 MIB->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
522 MI.eraseFromParent();
525 /// ExpandLaneOp - Translate VLD*LN and VST*LN instructions with Q, QQ or QQQQ
526 /// register operands to real instructions with D register operands.
527 void ARMExpandPseudo::ExpandLaneOp(MachineBasicBlock::iterator &MBBI) {
528 MachineInstr &MI = *MBBI;
529 MachineBasicBlock &MBB = *MI.getParent();
531 const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
532 assert(TableEntry && "NEONLdStTable lookup failed");
533 NEONRegSpacing RegSpc = TableEntry->RegSpacing;
534 unsigned NumRegs = TableEntry->NumRegs;
535 unsigned RegElts = TableEntry->RegElts;
537 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
538 TII->get(TableEntry->RealOpc));
540 // The lane operand is always the 3rd from last operand, before the 2
541 // predicate operands.
542 unsigned Lane = MI.getOperand(MI.getDesc().getNumOperands() - 3).getImm();
544 // Adjust the lane and spacing as needed for Q registers.
545 assert(RegSpc != OddDblSpc && "unexpected register spacing for VLD/VST-lane");
546 if (RegSpc == EvenDblSpc && Lane >= RegElts) {
550 assert(Lane < RegElts && "out of range lane for VLD/VST-lane");
552 unsigned D0 = 0, D1 = 0, D2 = 0, D3 = 0;
554 bool DstIsDead = false;
555 if (TableEntry->IsLoad) {
556 DstIsDead = MI.getOperand(OpIdx).isDead();
557 DstReg = MI.getOperand(OpIdx++).getReg();
558 GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
559 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead));
561 MIB.addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
563 MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
565 MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
568 if (TableEntry->HasWriteBack)
569 MIB.addOperand(MI.getOperand(OpIdx++));
571 // Copy the addrmode6 operands.
572 MIB.addOperand(MI.getOperand(OpIdx++));
573 MIB.addOperand(MI.getOperand(OpIdx++));
574 // Copy the am6offset operand.
575 if (TableEntry->HasWriteBack)
576 MIB.addOperand(MI.getOperand(OpIdx++));
578 // Grab the super-register source.
579 MachineOperand MO = MI.getOperand(OpIdx++);
580 if (!TableEntry->IsLoad)
581 GetDSubRegs(MO.getReg(), RegSpc, TRI, D0, D1, D2, D3);
583 // Add the subregs as sources of the new instruction.
584 unsigned SrcFlags = (getUndefRegState(MO.isUndef()) |
585 getKillRegState(MO.isKill()));
586 MIB.addReg(D0, SrcFlags);
588 MIB.addReg(D1, SrcFlags);
590 MIB.addReg(D2, SrcFlags);
592 MIB.addReg(D3, SrcFlags);
594 // Add the lane number operand.
598 // Copy the predicate operands.
599 MIB.addOperand(MI.getOperand(OpIdx++));
600 MIB.addOperand(MI.getOperand(OpIdx++));
602 // Copy the super-register source to be an implicit source.
603 MO.setImplicit(true);
605 if (TableEntry->IsLoad)
606 // Add an implicit def for the super-register.
607 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
608 TransferImpOps(MI, MIB, MIB);
609 MI.eraseFromParent();
612 /// ExpandVTBL - Translate VTBL and VTBX pseudo instructions with Q or QQ
613 /// register operands to real instructions with D register operands.
614 void ARMExpandPseudo::ExpandVTBL(MachineBasicBlock::iterator &MBBI,
615 unsigned Opc, bool IsExt, unsigned NumRegs) {
616 MachineInstr &MI = *MBBI;
617 MachineBasicBlock &MBB = *MI.getParent();
619 MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc));
622 // Transfer the destination register operand.
623 MIB.addOperand(MI.getOperand(OpIdx++));
625 MIB.addOperand(MI.getOperand(OpIdx++));
627 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
628 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
629 unsigned D0, D1, D2, D3;
630 GetDSubRegs(SrcReg, SingleSpc, TRI, D0, D1, D2, D3);
631 MIB.addReg(D0).addReg(D1);
637 // Copy the other source register operand.
638 MIB.addOperand(MI.getOperand(OpIdx++));
640 // Copy the predicate operands.
641 MIB.addOperand(MI.getOperand(OpIdx++));
642 MIB.addOperand(MI.getOperand(OpIdx++));
644 if (SrcIsKill) // Add an implicit kill for the super-reg.
645 MIB->addRegisterKilled(SrcReg, TRI, true);
646 TransferImpOps(MI, MIB, MIB);
647 MI.eraseFromParent();
650 void ARMExpandPseudo::ExpandMOV32BitImm(MachineBasicBlock &MBB,
651 MachineBasicBlock::iterator &MBBI) {
652 MachineInstr &MI = *MBBI;
653 unsigned Opcode = MI.getOpcode();
654 unsigned PredReg = 0;
655 ARMCC::CondCodes Pred = llvm::getInstrPredicate(&MI, PredReg);
656 unsigned DstReg = MI.getOperand(0).getReg();
657 bool DstIsDead = MI.getOperand(0).isDead();
658 bool isCC = Opcode == ARM::MOVCCi32imm || Opcode == ARM::t2MOVCCi32imm;
659 const MachineOperand &MO = MI.getOperand(isCC ? 2 : 1);
660 MachineInstrBuilder LO16, HI16;
662 if (!STI->hasV6T2Ops() &&
663 (Opcode == ARM::MOVi32imm || Opcode == ARM::MOVCCi32imm)) {
664 // Expand into a movi + orr.
665 LO16 = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::MOVi), DstReg);
666 HI16 = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::ORRri))
667 .addReg(DstReg, RegState::Define | getDeadRegState(DstIsDead))
670 assert (MO.isImm() && "MOVi32imm w/ non-immediate source operand!");
671 unsigned ImmVal = (unsigned)MO.getImm();
672 unsigned SOImmValV1 = ARM_AM::getSOImmTwoPartFirst(ImmVal);
673 unsigned SOImmValV2 = ARM_AM::getSOImmTwoPartSecond(ImmVal);
674 LO16 = LO16.addImm(SOImmValV1);
675 HI16 = HI16.addImm(SOImmValV2);
676 LO16->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
677 HI16->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
678 LO16.addImm(Pred).addReg(PredReg).addReg(0);
679 HI16.addImm(Pred).addReg(PredReg).addReg(0);
680 TransferImpOps(MI, LO16, HI16);
681 MI.eraseFromParent();
685 unsigned LO16Opc = 0;
686 unsigned HI16Opc = 0;
687 if (Opcode == ARM::t2MOVi32imm || Opcode == ARM::t2MOVCCi32imm) {
688 LO16Opc = ARM::t2MOVi16;
689 HI16Opc = ARM::t2MOVTi16;
691 LO16Opc = ARM::MOVi16;
692 HI16Opc = ARM::MOVTi16;
695 LO16 = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(LO16Opc), DstReg);
696 HI16 = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(HI16Opc))
697 .addReg(DstReg, RegState::Define | getDeadRegState(DstIsDead))
701 unsigned Imm = MO.getImm();
702 unsigned Lo16 = Imm & 0xffff;
703 unsigned Hi16 = (Imm >> 16) & 0xffff;
704 LO16 = LO16.addImm(Lo16);
705 HI16 = HI16.addImm(Hi16);
707 const GlobalValue *GV = MO.getGlobal();
708 unsigned TF = MO.getTargetFlags();
709 LO16 = LO16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_LO16);
710 HI16 = HI16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_HI16);
713 LO16->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
714 HI16->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
715 LO16.addImm(Pred).addReg(PredReg);
716 HI16.addImm(Pred).addReg(PredReg);
718 TransferImpOps(MI, LO16, HI16);
719 MI.eraseFromParent();
722 bool ARMExpandPseudo::ExpandMI(MachineBasicBlock &MBB,
723 MachineBasicBlock::iterator MBBI) {
724 MachineInstr &MI = *MBBI;
725 unsigned Opcode = MI.getOpcode();
731 unsigned newOpc = Opcode == ARM::VMOVScc ? ARM::VMOVS : ARM::VMOVD;
732 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(newOpc),
733 MI.getOperand(1).getReg())
734 .addReg(MI.getOperand(2).getReg(),
735 getKillRegState(MI.getOperand(2).isKill()))
736 .addImm(MI.getOperand(3).getImm()) // 'pred'
737 .addReg(MI.getOperand(4).getReg());
739 MI.eraseFromParent();
744 unsigned Opc = AFI->isThumbFunction() ? ARM::t2MOVr : ARM::MOVr;
745 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc),
746 MI.getOperand(1).getReg())
747 .addReg(MI.getOperand(2).getReg(),
748 getKillRegState(MI.getOperand(2).isKill()))
749 .addImm(MI.getOperand(3).getImm()) // 'pred'
750 .addReg(MI.getOperand(4).getReg())
751 .addReg(0); // 's' bit
753 MI.eraseFromParent();
757 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::MOVsi),
758 (MI.getOperand(1).getReg()))
759 .addReg(MI.getOperand(2).getReg(),
760 getKillRegState(MI.getOperand(2).isKill()))
761 .addImm(MI.getOperand(3).getImm())
762 .addImm(MI.getOperand(4).getImm()) // 'pred'
763 .addReg(MI.getOperand(5).getReg())
764 .addReg(0); // 's' bit
766 MI.eraseFromParent();
771 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::MOVsr),
772 (MI.getOperand(1).getReg()))
773 .addReg(MI.getOperand(2).getReg(),
774 getKillRegState(MI.getOperand(2).isKill()))
775 .addReg(MI.getOperand(3).getReg(),
776 getKillRegState(MI.getOperand(3).isKill()))
777 .addImm(MI.getOperand(4).getImm())
778 .addImm(MI.getOperand(5).getImm()) // 'pred'
779 .addReg(MI.getOperand(6).getReg())
780 .addReg(0); // 's' bit
782 MI.eraseFromParent();
785 case ARM::MOVCCi16: {
786 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::MOVi16),
787 MI.getOperand(1).getReg())
788 .addImm(MI.getOperand(2).getImm())
789 .addImm(MI.getOperand(3).getImm()) // 'pred'
790 .addReg(MI.getOperand(4).getReg());
792 MI.eraseFromParent();
797 unsigned Opc = AFI->isThumbFunction() ? ARM::t2MOVi : ARM::MOVi;
798 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc),
799 MI.getOperand(1).getReg())
800 .addImm(MI.getOperand(2).getImm())
801 .addImm(MI.getOperand(3).getImm()) // 'pred'
802 .addReg(MI.getOperand(4).getReg())
803 .addReg(0); // 's' bit
805 MI.eraseFromParent();
809 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::MVNi),
810 MI.getOperand(1).getReg())
811 .addImm(MI.getOperand(2).getImm())
812 .addImm(MI.getOperand(3).getImm()) // 'pred'
813 .addReg(MI.getOperand(4).getReg())
814 .addReg(0); // 's' bit
816 MI.eraseFromParent();
819 case ARM::Int_eh_sjlj_dispatchsetup: {
820 MachineFunction &MF = *MI.getParent()->getParent();
821 const ARMBaseInstrInfo *AII =
822 static_cast<const ARMBaseInstrInfo*>(TII);
823 const ARMBaseRegisterInfo &RI = AII->getRegisterInfo();
824 // For functions using a base pointer, we rematerialize it (via the frame
825 // pointer) here since eh.sjlj.setjmp and eh.sjlj.longjmp don't do it
826 // for us. Otherwise, expand to nothing.
827 if (RI.hasBasePointer(MF)) {
828 int32_t NumBytes = AFI->getFramePtrSpillOffset();
829 unsigned FramePtr = RI.getFrameRegister(MF);
830 assert(MF.getTarget().getFrameLowering()->hasFP(MF) &&
831 "base pointer without frame pointer?");
833 if (AFI->isThumb2Function()) {
834 llvm::emitT2RegPlusImmediate(MBB, MBBI, MI.getDebugLoc(), ARM::R6,
835 FramePtr, -NumBytes, ARMCC::AL, 0, *TII);
836 } else if (AFI->isThumbFunction()) {
837 llvm::emitThumbRegPlusImmediate(MBB, MBBI, MI.getDebugLoc(), ARM::R6,
838 FramePtr, -NumBytes, *TII, RI);
840 llvm::emitARMRegPlusImmediate(MBB, MBBI, MI.getDebugLoc(), ARM::R6,
841 FramePtr, -NumBytes, ARMCC::AL, 0,
844 // If there's dynamic realignment, adjust for it.
845 if (RI.needsStackRealignment(MF)) {
846 MachineFrameInfo *MFI = MF.getFrameInfo();
847 unsigned MaxAlign = MFI->getMaxAlignment();
848 assert (!AFI->isThumb1OnlyFunction());
849 // Emit bic r6, r6, MaxAlign
850 unsigned bicOpc = AFI->isThumbFunction() ?
851 ARM::t2BICri : ARM::BICri;
852 AddDefaultCC(AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
853 TII->get(bicOpc), ARM::R6)
854 .addReg(ARM::R6, RegState::Kill)
855 .addImm(MaxAlign-1)));
859 MI.eraseFromParent();
863 case ARM::MOVsrl_flag:
864 case ARM::MOVsra_flag: {
865 // These are just fancy MOVs insructions.
866 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::MOVsi),
867 MI.getOperand(0).getReg())
868 .addOperand(MI.getOperand(1))
869 .addImm(ARM_AM::getSORegOpc((Opcode == ARM::MOVsrl_flag ?
870 ARM_AM::lsr : ARM_AM::asr),
872 .addReg(ARM::CPSR, RegState::Define);
873 MI.eraseFromParent();
877 // This encodes as "MOVs Rd, Rm, rrx
878 MachineInstrBuilder MIB =
879 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),TII->get(ARM::MOVsi),
880 MI.getOperand(0).getReg())
881 .addOperand(MI.getOperand(1))
882 .addImm(ARM_AM::getSORegOpc(ARM_AM::rrx, 0)))
884 TransferImpOps(MI, MIB, MIB);
885 MI.eraseFromParent();
890 MachineInstrBuilder MIB =
891 BuildMI(MBB, MBBI, MI.getDebugLoc(),
892 TII->get(Opcode == ARM::tTPsoft ? ARM::tBL : ARM::BL))
893 .addExternalSymbol("__aeabi_read_tp", 0);
895 MIB->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
896 TransferImpOps(MI, MIB, MIB);
897 MI.eraseFromParent();
900 case ARM::tLDRpci_pic:
901 case ARM::t2LDRpci_pic: {
902 unsigned NewLdOpc = (Opcode == ARM::tLDRpci_pic)
903 ? ARM::tLDRpci : ARM::t2LDRpci;
904 unsigned DstReg = MI.getOperand(0).getReg();
905 bool DstIsDead = MI.getOperand(0).isDead();
906 MachineInstrBuilder MIB1 =
907 AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
908 TII->get(NewLdOpc), DstReg)
909 .addOperand(MI.getOperand(1)));
910 MIB1->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
911 MachineInstrBuilder MIB2 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
912 TII->get(ARM::tPICADD))
913 .addReg(DstReg, RegState::Define | getDeadRegState(DstIsDead))
915 .addOperand(MI.getOperand(2));
916 TransferImpOps(MI, MIB1, MIB2);
917 MI.eraseFromParent();
921 case ARM::MOV_ga_dyn:
922 case ARM::MOV_ga_pcrel:
923 case ARM::MOV_ga_pcrel_ldr:
924 case ARM::t2MOV_ga_dyn:
925 case ARM::t2MOV_ga_pcrel: {
926 // Expand into movw + movw. Also "add pc" / ldr [pc] in PIC mode.
927 unsigned LabelId = AFI->createPICLabelUId();
928 unsigned DstReg = MI.getOperand(0).getReg();
929 bool DstIsDead = MI.getOperand(0).isDead();
930 const MachineOperand &MO1 = MI.getOperand(1);
931 const GlobalValue *GV = MO1.getGlobal();
932 unsigned TF = MO1.getTargetFlags();
933 bool isARM = (Opcode != ARM::t2MOV_ga_pcrel && Opcode!=ARM::t2MOV_ga_dyn);
934 bool isPIC = (Opcode != ARM::MOV_ga_dyn && Opcode != ARM::t2MOV_ga_dyn);
935 unsigned LO16Opc = isARM ? ARM::MOVi16_ga_pcrel : ARM::t2MOVi16_ga_pcrel;
936 unsigned HI16Opc = isARM ? ARM::MOVTi16_ga_pcrel :ARM::t2MOVTi16_ga_pcrel;
937 unsigned LO16TF = isPIC
938 ? ARMII::MO_LO16_NONLAZY_PIC : ARMII::MO_LO16_NONLAZY;
939 unsigned HI16TF = isPIC
940 ? ARMII::MO_HI16_NONLAZY_PIC : ARMII::MO_HI16_NONLAZY;
941 unsigned PICAddOpc = isARM
942 ? (Opcode == ARM::MOV_ga_pcrel_ldr ? ARM::PICLDR : ARM::PICADD)
944 MachineInstrBuilder MIB1 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
945 TII->get(LO16Opc), DstReg)
946 .addGlobalAddress(GV, MO1.getOffset(), TF | LO16TF)
948 MachineInstrBuilder MIB2 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
949 TII->get(HI16Opc), DstReg)
951 .addGlobalAddress(GV, MO1.getOffset(), TF | HI16TF)
954 TransferImpOps(MI, MIB1, MIB2);
955 MI.eraseFromParent();
959 MachineInstrBuilder MIB3 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
961 .addReg(DstReg, RegState::Define | getDeadRegState(DstIsDead))
962 .addReg(DstReg).addImm(LabelId);
964 AddDefaultPred(MIB3);
965 if (Opcode == ARM::MOV_ga_pcrel_ldr)
966 MIB2->setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
968 TransferImpOps(MI, MIB1, MIB3);
969 MI.eraseFromParent();
974 case ARM::MOVCCi32imm:
975 case ARM::t2MOVi32imm:
976 case ARM::t2MOVCCi32imm:
977 ExpandMOV32BitImm(MBB, MBBI);
981 unsigned NewOpc = ARM::VLDMDIA;
982 MachineInstrBuilder MIB =
983 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(NewOpc));
986 // Grab the Q register destination.
987 bool DstIsDead = MI.getOperand(OpIdx).isDead();
988 unsigned DstReg = MI.getOperand(OpIdx++).getReg();
990 // Copy the source register.
991 MIB.addOperand(MI.getOperand(OpIdx++));
993 // Copy the predicate operands.
994 MIB.addOperand(MI.getOperand(OpIdx++));
995 MIB.addOperand(MI.getOperand(OpIdx++));
997 // Add the destination operands (D subregs).
998 unsigned D0 = TRI->getSubReg(DstReg, ARM::dsub_0);
999 unsigned D1 = TRI->getSubReg(DstReg, ARM::dsub_1);
1000 MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
1001 .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
1003 // Add an implicit def for the super-register.
1004 MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
1005 TransferImpOps(MI, MIB, MIB);
1006 MI.eraseFromParent();
1010 case ARM::VSTMQIA: {
1011 unsigned NewOpc = ARM::VSTMDIA;
1012 MachineInstrBuilder MIB =
1013 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(NewOpc));
1016 // Grab the Q register source.
1017 bool SrcIsKill = MI.getOperand(OpIdx).isKill();
1018 unsigned SrcReg = MI.getOperand(OpIdx++).getReg();
1020 // Copy the destination register.
1021 MIB.addOperand(MI.getOperand(OpIdx++));
1023 // Copy the predicate operands.
1024 MIB.addOperand(MI.getOperand(OpIdx++));
1025 MIB.addOperand(MI.getOperand(OpIdx++));
1027 // Add the source operands (D subregs).
1028 unsigned D0 = TRI->getSubReg(SrcReg, ARM::dsub_0);
1029 unsigned D1 = TRI->getSubReg(SrcReg, ARM::dsub_1);
1030 MIB.addReg(D0).addReg(D1);
1032 if (SrcIsKill) // Add an implicit kill for the Q register.
1033 MIB->addRegisterKilled(SrcReg, TRI, true);
1035 TransferImpOps(MI, MIB, MIB);
1036 MI.eraseFromParent();
1041 unsigned NewOpc = Opcode == ARM::VDUPfqf ? ARM::VDUPLN32q :
1043 MachineInstrBuilder MIB =
1044 BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(NewOpc));
1046 unsigned SrcReg = MI.getOperand(1).getReg();
1047 unsigned Lane = getARMRegisterNumbering(SrcReg) & 1;
1048 unsigned DReg = TRI->getMatchingSuperReg(SrcReg,
1049 Lane & 1 ? ARM::ssub_1 : ARM::ssub_0,
1050 &ARM::DPR_VFP2RegClass);
1051 // The lane is [0,1] for the containing DReg superregister.
1052 // Copy the dst/src register operands.
1053 MIB.addOperand(MI.getOperand(OpIdx++));
1056 // Add the lane select operand.
1058 // Add the predicate operands.
1059 MIB.addOperand(MI.getOperand(OpIdx++));
1060 MIB.addOperand(MI.getOperand(OpIdx++));
1062 TransferImpOps(MI, MIB, MIB);
1063 MI.eraseFromParent();
1067 case ARM::VLD1q8Pseudo:
1068 case ARM::VLD1q16Pseudo:
1069 case ARM::VLD1q32Pseudo:
1070 case ARM::VLD1q64Pseudo:
1071 case ARM::VLD1q8Pseudo_UPD:
1072 case ARM::VLD1q16Pseudo_UPD:
1073 case ARM::VLD1q32Pseudo_UPD:
1074 case ARM::VLD1q64Pseudo_UPD:
1075 case ARM::VLD2d8Pseudo:
1076 case ARM::VLD2d16Pseudo:
1077 case ARM::VLD2d32Pseudo:
1078 case ARM::VLD2q8Pseudo:
1079 case ARM::VLD2q16Pseudo:
1080 case ARM::VLD2q32Pseudo:
1081 case ARM::VLD2d8Pseudo_UPD:
1082 case ARM::VLD2d16Pseudo_UPD:
1083 case ARM::VLD2d32Pseudo_UPD:
1084 case ARM::VLD2q8Pseudo_UPD:
1085 case ARM::VLD2q16Pseudo_UPD:
1086 case ARM::VLD2q32Pseudo_UPD:
1087 case ARM::VLD3d8Pseudo:
1088 case ARM::VLD3d16Pseudo:
1089 case ARM::VLD3d32Pseudo:
1090 case ARM::VLD1d64TPseudo:
1091 case ARM::VLD3d8Pseudo_UPD:
1092 case ARM::VLD3d16Pseudo_UPD:
1093 case ARM::VLD3d32Pseudo_UPD:
1094 case ARM::VLD1d64TPseudo_UPD:
1095 case ARM::VLD3q8Pseudo_UPD:
1096 case ARM::VLD3q16Pseudo_UPD:
1097 case ARM::VLD3q32Pseudo_UPD:
1098 case ARM::VLD3q8oddPseudo:
1099 case ARM::VLD3q16oddPseudo:
1100 case ARM::VLD3q32oddPseudo:
1101 case ARM::VLD3q8oddPseudo_UPD:
1102 case ARM::VLD3q16oddPseudo_UPD:
1103 case ARM::VLD3q32oddPseudo_UPD:
1104 case ARM::VLD4d8Pseudo:
1105 case ARM::VLD4d16Pseudo:
1106 case ARM::VLD4d32Pseudo:
1107 case ARM::VLD1d64QPseudo:
1108 case ARM::VLD4d8Pseudo_UPD:
1109 case ARM::VLD4d16Pseudo_UPD:
1110 case ARM::VLD4d32Pseudo_UPD:
1111 case ARM::VLD1d64QPseudo_UPD:
1112 case ARM::VLD4q8Pseudo_UPD:
1113 case ARM::VLD4q16Pseudo_UPD:
1114 case ARM::VLD4q32Pseudo_UPD:
1115 case ARM::VLD4q8oddPseudo:
1116 case ARM::VLD4q16oddPseudo:
1117 case ARM::VLD4q32oddPseudo:
1118 case ARM::VLD4q8oddPseudo_UPD:
1119 case ARM::VLD4q16oddPseudo_UPD:
1120 case ARM::VLD4q32oddPseudo_UPD:
1121 case ARM::VLD1DUPq8Pseudo:
1122 case ARM::VLD1DUPq16Pseudo:
1123 case ARM::VLD1DUPq32Pseudo:
1124 case ARM::VLD1DUPq8Pseudo_UPD:
1125 case ARM::VLD1DUPq16Pseudo_UPD:
1126 case ARM::VLD1DUPq32Pseudo_UPD:
1127 case ARM::VLD2DUPd8Pseudo:
1128 case ARM::VLD2DUPd16Pseudo:
1129 case ARM::VLD2DUPd32Pseudo:
1130 case ARM::VLD2DUPd8Pseudo_UPD:
1131 case ARM::VLD2DUPd16Pseudo_UPD:
1132 case ARM::VLD2DUPd32Pseudo_UPD:
1133 case ARM::VLD3DUPd8Pseudo:
1134 case ARM::VLD3DUPd16Pseudo:
1135 case ARM::VLD3DUPd32Pseudo:
1136 case ARM::VLD3DUPd8Pseudo_UPD:
1137 case ARM::VLD3DUPd16Pseudo_UPD:
1138 case ARM::VLD3DUPd32Pseudo_UPD:
1139 case ARM::VLD4DUPd8Pseudo:
1140 case ARM::VLD4DUPd16Pseudo:
1141 case ARM::VLD4DUPd32Pseudo:
1142 case ARM::VLD4DUPd8Pseudo_UPD:
1143 case ARM::VLD4DUPd16Pseudo_UPD:
1144 case ARM::VLD4DUPd32Pseudo_UPD:
1148 case ARM::VST1q8Pseudo:
1149 case ARM::VST1q16Pseudo:
1150 case ARM::VST1q32Pseudo:
1151 case ARM::VST1q64Pseudo:
1152 case ARM::VST1q8Pseudo_UPD:
1153 case ARM::VST1q16Pseudo_UPD:
1154 case ARM::VST1q32Pseudo_UPD:
1155 case ARM::VST1q64Pseudo_UPD:
1156 case ARM::VST2d8Pseudo:
1157 case ARM::VST2d16Pseudo:
1158 case ARM::VST2d32Pseudo:
1159 case ARM::VST2q8Pseudo:
1160 case ARM::VST2q16Pseudo:
1161 case ARM::VST2q32Pseudo:
1162 case ARM::VST2d8Pseudo_UPD:
1163 case ARM::VST2d16Pseudo_UPD:
1164 case ARM::VST2d32Pseudo_UPD:
1165 case ARM::VST2q8Pseudo_UPD:
1166 case ARM::VST2q16Pseudo_UPD:
1167 case ARM::VST2q32Pseudo_UPD:
1168 case ARM::VST3d8Pseudo:
1169 case ARM::VST3d16Pseudo:
1170 case ARM::VST3d32Pseudo:
1171 case ARM::VST1d64TPseudo:
1172 case ARM::VST3d8Pseudo_UPD:
1173 case ARM::VST3d16Pseudo_UPD:
1174 case ARM::VST3d32Pseudo_UPD:
1175 case ARM::VST1d64TPseudo_UPD:
1176 case ARM::VST3q8Pseudo_UPD:
1177 case ARM::VST3q16Pseudo_UPD:
1178 case ARM::VST3q32Pseudo_UPD:
1179 case ARM::VST3q8oddPseudo:
1180 case ARM::VST3q16oddPseudo:
1181 case ARM::VST3q32oddPseudo:
1182 case ARM::VST3q8oddPseudo_UPD:
1183 case ARM::VST3q16oddPseudo_UPD:
1184 case ARM::VST3q32oddPseudo_UPD:
1185 case ARM::VST4d8Pseudo:
1186 case ARM::VST4d16Pseudo:
1187 case ARM::VST4d32Pseudo:
1188 case ARM::VST1d64QPseudo:
1189 case ARM::VST4d8Pseudo_UPD:
1190 case ARM::VST4d16Pseudo_UPD:
1191 case ARM::VST4d32Pseudo_UPD:
1192 case ARM::VST1d64QPseudo_UPD:
1193 case ARM::VST4q8Pseudo_UPD:
1194 case ARM::VST4q16Pseudo_UPD:
1195 case ARM::VST4q32Pseudo_UPD:
1196 case ARM::VST4q8oddPseudo:
1197 case ARM::VST4q16oddPseudo:
1198 case ARM::VST4q32oddPseudo:
1199 case ARM::VST4q8oddPseudo_UPD:
1200 case ARM::VST4q16oddPseudo_UPD:
1201 case ARM::VST4q32oddPseudo_UPD:
1205 case ARM::VLD1LNq8Pseudo:
1206 case ARM::VLD1LNq16Pseudo:
1207 case ARM::VLD1LNq32Pseudo:
1208 case ARM::VLD1LNq8Pseudo_UPD:
1209 case ARM::VLD1LNq16Pseudo_UPD:
1210 case ARM::VLD1LNq32Pseudo_UPD:
1211 case ARM::VLD2LNd8Pseudo:
1212 case ARM::VLD2LNd16Pseudo:
1213 case ARM::VLD2LNd32Pseudo:
1214 case ARM::VLD2LNq16Pseudo:
1215 case ARM::VLD2LNq32Pseudo:
1216 case ARM::VLD2LNd8Pseudo_UPD:
1217 case ARM::VLD2LNd16Pseudo_UPD:
1218 case ARM::VLD2LNd32Pseudo_UPD:
1219 case ARM::VLD2LNq16Pseudo_UPD:
1220 case ARM::VLD2LNq32Pseudo_UPD:
1221 case ARM::VLD3LNd8Pseudo:
1222 case ARM::VLD3LNd16Pseudo:
1223 case ARM::VLD3LNd32Pseudo:
1224 case ARM::VLD3LNq16Pseudo:
1225 case ARM::VLD3LNq32Pseudo:
1226 case ARM::VLD3LNd8Pseudo_UPD:
1227 case ARM::VLD3LNd16Pseudo_UPD:
1228 case ARM::VLD3LNd32Pseudo_UPD:
1229 case ARM::VLD3LNq16Pseudo_UPD:
1230 case ARM::VLD3LNq32Pseudo_UPD:
1231 case ARM::VLD4LNd8Pseudo:
1232 case ARM::VLD4LNd16Pseudo:
1233 case ARM::VLD4LNd32Pseudo:
1234 case ARM::VLD4LNq16Pseudo:
1235 case ARM::VLD4LNq32Pseudo:
1236 case ARM::VLD4LNd8Pseudo_UPD:
1237 case ARM::VLD4LNd16Pseudo_UPD:
1238 case ARM::VLD4LNd32Pseudo_UPD:
1239 case ARM::VLD4LNq16Pseudo_UPD:
1240 case ARM::VLD4LNq32Pseudo_UPD:
1241 case ARM::VST1LNq8Pseudo:
1242 case ARM::VST1LNq16Pseudo:
1243 case ARM::VST1LNq32Pseudo:
1244 case ARM::VST1LNq8Pseudo_UPD:
1245 case ARM::VST1LNq16Pseudo_UPD:
1246 case ARM::VST1LNq32Pseudo_UPD:
1247 case ARM::VST2LNd8Pseudo:
1248 case ARM::VST2LNd16Pseudo:
1249 case ARM::VST2LNd32Pseudo:
1250 case ARM::VST2LNq16Pseudo:
1251 case ARM::VST2LNq32Pseudo:
1252 case ARM::VST2LNd8Pseudo_UPD:
1253 case ARM::VST2LNd16Pseudo_UPD:
1254 case ARM::VST2LNd32Pseudo_UPD:
1255 case ARM::VST2LNq16Pseudo_UPD:
1256 case ARM::VST2LNq32Pseudo_UPD:
1257 case ARM::VST3LNd8Pseudo:
1258 case ARM::VST3LNd16Pseudo:
1259 case ARM::VST3LNd32Pseudo:
1260 case ARM::VST3LNq16Pseudo:
1261 case ARM::VST3LNq32Pseudo:
1262 case ARM::VST3LNd8Pseudo_UPD:
1263 case ARM::VST3LNd16Pseudo_UPD:
1264 case ARM::VST3LNd32Pseudo_UPD:
1265 case ARM::VST3LNq16Pseudo_UPD:
1266 case ARM::VST3LNq32Pseudo_UPD:
1267 case ARM::VST4LNd8Pseudo:
1268 case ARM::VST4LNd16Pseudo:
1269 case ARM::VST4LNd32Pseudo:
1270 case ARM::VST4LNq16Pseudo:
1271 case ARM::VST4LNq32Pseudo:
1272 case ARM::VST4LNd8Pseudo_UPD:
1273 case ARM::VST4LNd16Pseudo_UPD:
1274 case ARM::VST4LNd32Pseudo_UPD:
1275 case ARM::VST4LNq16Pseudo_UPD:
1276 case ARM::VST4LNq32Pseudo_UPD:
1280 case ARM::VTBL2Pseudo: ExpandVTBL(MBBI, ARM::VTBL2, false, 2); return true;
1281 case ARM::VTBL3Pseudo: ExpandVTBL(MBBI, ARM::VTBL3, false, 3); return true;
1282 case ARM::VTBL4Pseudo: ExpandVTBL(MBBI, ARM::VTBL4, false, 4); return true;
1283 case ARM::VTBX2Pseudo: ExpandVTBL(MBBI, ARM::VTBX2, true, 2); return true;
1284 case ARM::VTBX3Pseudo: ExpandVTBL(MBBI, ARM::VTBX3, true, 3); return true;
1285 case ARM::VTBX4Pseudo: ExpandVTBL(MBBI, ARM::VTBX4, true, 4); return true;
1291 bool ARMExpandPseudo::ExpandMBB(MachineBasicBlock &MBB) {
1292 bool Modified = false;
1294 MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
1296 MachineBasicBlock::iterator NMBBI = llvm::next(MBBI);
1297 Modified |= ExpandMI(MBB, MBBI);
1304 bool ARMExpandPseudo::runOnMachineFunction(MachineFunction &MF) {
1305 const TargetMachine &TM = MF.getTarget();
1306 TII = static_cast<const ARMBaseInstrInfo*>(TM.getInstrInfo());
1307 TRI = TM.getRegisterInfo();
1308 STI = &TM.getSubtarget<ARMSubtarget>();
1309 AFI = MF.getInfo<ARMFunctionInfo>();
1311 bool Modified = false;
1312 for (MachineFunction::iterator MFI = MF.begin(), E = MF.end(); MFI != E;
1314 Modified |= ExpandMBB(*MFI);
1315 if (VerifyARMPseudo)
1316 MF.verify(this, "After expanding ARM pseudo instructions.");
1320 /// createARMExpandPseudoPass - returns an instance of the pseudo instruction
1322 FunctionPass *llvm::createARMExpandPseudoPass() {
1323 return new ARMExpandPseudo();