38535dc66508e141c5c33ad76e1ed05f460a439f
[oota-llvm.git] / lib / Target / ARM / ARMExpandPseudoInsts.cpp
1 //===-- ARMExpandPseudoInsts.cpp - Expand pseudo instructions -----*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
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.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #define DEBUG_TYPE "arm-pseudo"
18 #include "ARM.h"
19 #include "ARMBaseInstrInfo.h"
20 #include "llvm/CodeGen/MachineFunctionPass.h"
21 #include "llvm/CodeGen/MachineInstrBuilder.h"
22 #include "llvm/Target/TargetRegisterInfo.h"
23 using namespace llvm;
24
25 namespace {
26   class ARMExpandPseudo : public MachineFunctionPass {
27   public:
28     static char ID;
29     ARMExpandPseudo() : MachineFunctionPass(ID) {}
30
31     const TargetInstrInfo *TII;
32     const TargetRegisterInfo *TRI;
33
34     virtual bool runOnMachineFunction(MachineFunction &Fn);
35
36     virtual const char *getPassName() const {
37       return "ARM pseudo instruction expansion pass";
38     }
39
40   private:
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   };
48   char ARMExpandPseudo::ID = 0;
49 }
50
51 /// TransferImpOps - Transfer implicit operands on the pseudo instruction to
52 /// the instructions created from the expansion.
53 void ARMExpandPseudo::TransferImpOps(MachineInstr &OldMI,
54                                      MachineInstrBuilder &UseMI,
55                                      MachineInstrBuilder &DefMI) {
56   const TargetInstrDesc &Desc = OldMI.getDesc();
57   for (unsigned i = Desc.getNumOperands(), e = OldMI.getNumOperands();
58        i != e; ++i) {
59     const MachineOperand &MO = OldMI.getOperand(i);
60     assert(MO.isReg() && MO.getReg());
61     if (MO.isUse())
62       UseMI.addOperand(MO);
63     else
64       DefMI.addOperand(MO);
65   }
66 }
67
68 namespace {
69   // Constants for register spacing in NEON load/store instructions.
70   // For quad-register load-lane and store-lane pseudo instructors, the
71   // spacing is initially assumed to be EvenDblSpc, and that is changed to
72   // OddDblSpc depending on the lane number operand.
73   enum NEONRegSpacing {
74     SingleSpc,
75     EvenDblSpc,
76     OddDblSpc
77   };
78
79   // Entries for NEON load/store information table.  The table is sorted by
80   // PseudoOpc for fast binary-search lookups.
81   struct NEONLdStTableEntry {
82     unsigned PseudoOpc;
83     unsigned RealOpc;
84     bool IsLoad;
85     bool HasWriteBack;
86     NEONRegSpacing RegSpacing;
87     unsigned char NumRegs; // D registers loaded or stored
88     unsigned char RegElts; // elements per D register; used for lane ops
89
90     // Comparison methods for binary search of the table.
91     bool operator<(const NEONLdStTableEntry &TE) const {
92       return PseudoOpc < TE.PseudoOpc;
93     }
94     friend bool operator<(const NEONLdStTableEntry &TE, unsigned PseudoOpc) {
95       return TE.PseudoOpc < PseudoOpc;
96     }
97     friend bool ATTRIBUTE_UNUSED operator<(unsigned PseudoOpc,
98                                            const NEONLdStTableEntry &TE) {
99       return PseudoOpc < TE.PseudoOpc;
100     }
101   };
102 }
103
104 static const NEONLdStTableEntry NEONLdStTable[] = {
105 { ARM::VLD1d64QPseudo,      ARM::VLD1d64Q,     true,  false, SingleSpc,  4, 1 },
106 { ARM::VLD1d64QPseudo_UPD,  ARM::VLD1d64Q_UPD, true,  true,  SingleSpc,  4, 1 },
107 { ARM::VLD1d64TPseudo,      ARM::VLD1d64T,     true,  false, SingleSpc,  3, 1 },
108 { ARM::VLD1d64TPseudo_UPD,  ARM::VLD1d64T_UPD, true,  true,  SingleSpc,  3, 1 },
109
110 { ARM::VLD1q16Pseudo,       ARM::VLD1q16,      true,  false, SingleSpc,  2, 4 },
111 { ARM::VLD1q16Pseudo_UPD,   ARM::VLD1q16_UPD,  true,  true,  SingleSpc,  2, 4 },
112 { ARM::VLD1q32Pseudo,       ARM::VLD1q32,      true,  false, SingleSpc,  2, 2 },
113 { ARM::VLD1q32Pseudo_UPD,   ARM::VLD1q32_UPD,  true,  true,  SingleSpc,  2, 2 },
114 { ARM::VLD1q64Pseudo,       ARM::VLD1q64,      true,  false, SingleSpc,  2, 1 },
115 { ARM::VLD1q64Pseudo_UPD,   ARM::VLD1q64_UPD,  true,  true,  SingleSpc,  2, 1 },
116 { ARM::VLD1q8Pseudo,        ARM::VLD1q8,       true,  false, SingleSpc,  2, 8 },
117 { ARM::VLD1q8Pseudo_UPD,    ARM::VLD1q8_UPD,   true,  true,  SingleSpc,  2, 8 },
118
119 { ARM::VLD2LNd16Pseudo,     ARM::VLD2LNd16,     true, false, SingleSpc,  2, 4 },
120 { ARM::VLD2LNd16Pseudo_UPD, ARM::VLD2LNd16_UPD, true, true,  SingleSpc,  2, 4 },
121 { ARM::VLD2LNd32Pseudo,     ARM::VLD2LNd32,     true, false, SingleSpc,  2, 2 },
122 { ARM::VLD2LNd32Pseudo_UPD, ARM::VLD2LNd32_UPD, true, true,  SingleSpc,  2, 2 },
123 { ARM::VLD2LNd8Pseudo,      ARM::VLD2LNd8,      true, false, SingleSpc,  2, 8 },
124 { ARM::VLD2LNd8Pseudo_UPD,  ARM::VLD2LNd8_UPD,  true, true,  SingleSpc,  2, 8 },
125 { ARM::VLD2LNq16Pseudo,     ARM::VLD2LNq16,     true, false, EvenDblSpc, 2, 4 },
126 { ARM::VLD2LNq16Pseudo_UPD, ARM::VLD2LNq16_UPD, true, true,  EvenDblSpc, 2, 4 },
127 { ARM::VLD2LNq32Pseudo,     ARM::VLD2LNq32,     true, false, EvenDblSpc, 2, 2 },
128 { ARM::VLD2LNq32Pseudo_UPD, ARM::VLD2LNq32_UPD, true, true,  EvenDblSpc, 2, 2 },
129
130 { ARM::VLD2d16Pseudo,       ARM::VLD2d16,      true,  false, SingleSpc,  2, 4 },
131 { ARM::VLD2d16Pseudo_UPD,   ARM::VLD2d16_UPD,  true,  true,  SingleSpc,  2, 4 },
132 { ARM::VLD2d32Pseudo,       ARM::VLD2d32,      true,  false, SingleSpc,  2, 2 },
133 { ARM::VLD2d32Pseudo_UPD,   ARM::VLD2d32_UPD,  true,  true,  SingleSpc,  2, 2 },
134 { ARM::VLD2d8Pseudo,        ARM::VLD2d8,       true,  false, SingleSpc,  2, 8 },
135 { ARM::VLD2d8Pseudo_UPD,    ARM::VLD2d8_UPD,   true,  true,  SingleSpc,  2, 8 },
136
137 { ARM::VLD2q16Pseudo,       ARM::VLD2q16,      true,  false, SingleSpc,  4, 4 },
138 { ARM::VLD2q16Pseudo_UPD,   ARM::VLD2q16_UPD,  true,  true,  SingleSpc,  4, 4 },
139 { ARM::VLD2q32Pseudo,       ARM::VLD2q32,      true,  false, SingleSpc,  4, 2 },
140 { ARM::VLD2q32Pseudo_UPD,   ARM::VLD2q32_UPD,  true,  true,  SingleSpc,  4, 2 },
141 { ARM::VLD2q8Pseudo,        ARM::VLD2q8,       true,  false, SingleSpc,  4, 8 },
142 { ARM::VLD2q8Pseudo_UPD,    ARM::VLD2q8_UPD,   true,  true,  SingleSpc,  4, 8 },
143
144 { ARM::VLD3LNd16Pseudo,     ARM::VLD3LNd16,     true, false, SingleSpc,  3, 4 },
145 { ARM::VLD3LNd16Pseudo_UPD, ARM::VLD3LNd16_UPD, true, true,  SingleSpc,  3, 4 },
146 { ARM::VLD3LNd32Pseudo,     ARM::VLD3LNd32,     true, false, SingleSpc,  3, 2 },
147 { ARM::VLD3LNd32Pseudo_UPD, ARM::VLD3LNd32_UPD, true, true,  SingleSpc,  3, 2 },
148 { ARM::VLD3LNd8Pseudo,      ARM::VLD3LNd8,      true, false, SingleSpc,  3, 8 },
149 { ARM::VLD3LNd8Pseudo_UPD,  ARM::VLD3LNd8_UPD,  true, true,  SingleSpc,  3, 8 },
150 { ARM::VLD3LNq16Pseudo,     ARM::VLD3LNq16,     true, false, EvenDblSpc, 3, 4 },
151 { ARM::VLD3LNq16Pseudo_UPD, ARM::VLD3LNq16_UPD, true, true,  EvenDblSpc, 3, 4 },
152 { ARM::VLD3LNq32Pseudo,     ARM::VLD3LNq32,     true, false, EvenDblSpc, 3, 2 },
153 { ARM::VLD3LNq32Pseudo_UPD, ARM::VLD3LNq32_UPD, true, true,  EvenDblSpc, 3, 2 },
154
155 { ARM::VLD3d16Pseudo,       ARM::VLD3d16,      true,  false, SingleSpc,  3, 4 },
156 { ARM::VLD3d16Pseudo_UPD,   ARM::VLD3d16_UPD,  true,  true,  SingleSpc,  3, 4 },
157 { ARM::VLD3d32Pseudo,       ARM::VLD3d32,      true,  false, SingleSpc,  3, 2 },
158 { ARM::VLD3d32Pseudo_UPD,   ARM::VLD3d32_UPD,  true,  true,  SingleSpc,  3, 2 },
159 { ARM::VLD3d8Pseudo,        ARM::VLD3d8,       true,  false, SingleSpc,  3, 8 },
160 { ARM::VLD3d8Pseudo_UPD,    ARM::VLD3d8_UPD,   true,  true,  SingleSpc,  3, 8 },
161
162 { ARM::VLD3q16Pseudo_UPD,    ARM::VLD3q16_UPD, true,  true,  EvenDblSpc, 3, 4 },
163 { ARM::VLD3q16oddPseudo_UPD, ARM::VLD3q16_UPD, true,  true,  OddDblSpc,  3, 4 },
164 { ARM::VLD3q32Pseudo_UPD,    ARM::VLD3q32_UPD, true,  true,  EvenDblSpc, 3, 2 },
165 { ARM::VLD3q32oddPseudo_UPD, ARM::VLD3q32_UPD, true,  true,  OddDblSpc,  3, 2 },
166 { ARM::VLD3q8Pseudo_UPD,     ARM::VLD3q8_UPD,  true,  true,  EvenDblSpc, 3, 8 },
167 { ARM::VLD3q8oddPseudo_UPD,  ARM::VLD3q8_UPD,  true,  true,  OddDblSpc,  3, 8 },
168
169 { ARM::VLD4LNd16Pseudo,     ARM::VLD4LNd16,     true, false, SingleSpc,  4, 4 },
170 { ARM::VLD4LNd16Pseudo_UPD, ARM::VLD4LNd16_UPD, true, true,  SingleSpc,  4, 4 },
171 { ARM::VLD4LNd32Pseudo,     ARM::VLD4LNd32,     true, false, SingleSpc,  4, 2 },
172 { ARM::VLD4LNd32Pseudo_UPD, ARM::VLD4LNd32_UPD, true, true,  SingleSpc,  4, 2 },
173 { ARM::VLD4LNd8Pseudo,      ARM::VLD4LNd8,      true, false, SingleSpc,  4, 8 },
174 { ARM::VLD4LNd8Pseudo_UPD,  ARM::VLD4LNd8_UPD,  true, true,  SingleSpc,  4, 8 },
175 { ARM::VLD4LNq16Pseudo,     ARM::VLD4LNq16,     true, false, EvenDblSpc, 4, 4 },
176 { ARM::VLD4LNq16Pseudo_UPD, ARM::VLD4LNq16_UPD, true, true,  EvenDblSpc, 4, 4 },
177 { ARM::VLD4LNq32Pseudo,     ARM::VLD4LNq32,     true, false, EvenDblSpc, 4, 2 },
178 { ARM::VLD4LNq32Pseudo_UPD, ARM::VLD4LNq32_UPD, true, true,  EvenDblSpc, 4, 2 },
179
180 { ARM::VLD4d16Pseudo,       ARM::VLD4d16,      true,  false, SingleSpc,  4, 4 },
181 { ARM::VLD4d16Pseudo_UPD,   ARM::VLD4d16_UPD,  true,  true,  SingleSpc,  4, 4 },
182 { ARM::VLD4d32Pseudo,       ARM::VLD4d32,      true,  false, SingleSpc,  4, 2 },
183 { ARM::VLD4d32Pseudo_UPD,   ARM::VLD4d32_UPD,  true,  true,  SingleSpc,  4, 2 },
184 { ARM::VLD4d8Pseudo,        ARM::VLD4d8,       true,  false, SingleSpc,  4, 8 },
185 { ARM::VLD4d8Pseudo_UPD,    ARM::VLD4d8_UPD,   true,  true,  SingleSpc,  4, 8 },
186
187 { ARM::VLD4q16Pseudo_UPD,    ARM::VLD4q16_UPD, true,  true,  EvenDblSpc, 4, 4 },
188 { ARM::VLD4q16oddPseudo_UPD, ARM::VLD4q16_UPD, true,  true,  OddDblSpc,  4, 4 },
189 { ARM::VLD4q32Pseudo_UPD,    ARM::VLD4q32_UPD, true,  true,  EvenDblSpc, 4, 2 },
190 { ARM::VLD4q32oddPseudo_UPD, ARM::VLD4q32_UPD, true,  true,  OddDblSpc,  4, 2 },
191 { ARM::VLD4q8Pseudo_UPD,     ARM::VLD4q8_UPD,  true,  true,  EvenDblSpc, 4, 8 },
192 { ARM::VLD4q8oddPseudo_UPD,  ARM::VLD4q8_UPD,  true,  true,  OddDblSpc,  4, 8 },
193
194 { ARM::VST1d64QPseudo,      ARM::VST1d64Q,     false, false, SingleSpc,  4, 1 },
195 { ARM::VST1d64QPseudo_UPD,  ARM::VST1d64Q_UPD, false, true,  SingleSpc,  4, 1 },
196 { ARM::VST1d64TPseudo,      ARM::VST1d64T,     false, false, SingleSpc,  3, 1 },
197 { ARM::VST1d64TPseudo_UPD,  ARM::VST1d64T_UPD, false, true,  SingleSpc,  3, 1 },
198
199 { ARM::VST1q16Pseudo,       ARM::VST1q16,      false, false, SingleSpc,  2, 4 },
200 { ARM::VST1q16Pseudo_UPD,   ARM::VST1q16_UPD,  false, true,  SingleSpc,  2, 4 },
201 { ARM::VST1q32Pseudo,       ARM::VST1q32,      false, false, SingleSpc,  2, 2 },
202 { ARM::VST1q32Pseudo_UPD,   ARM::VST1q32_UPD,  false, true,  SingleSpc,  2, 2 },
203 { ARM::VST1q64Pseudo,       ARM::VST1q64,      false, false, SingleSpc,  2, 1 },
204 { ARM::VST1q64Pseudo_UPD,   ARM::VST1q64_UPD,  false, true,  SingleSpc,  2, 1 },
205 { ARM::VST1q8Pseudo,        ARM::VST1q8,       false, false, SingleSpc,  2, 8 },
206 { ARM::VST1q8Pseudo_UPD,    ARM::VST1q8_UPD,   false, true,  SingleSpc,  2, 8 },
207
208 { ARM::VST2LNd16Pseudo,     ARM::VST2LNd16,     false, false, SingleSpc, 2, 4 },
209 { ARM::VST2LNd16Pseudo_UPD, ARM::VST2LNd16_UPD, false, true,  SingleSpc, 2, 4 },
210 { ARM::VST2LNd32Pseudo,     ARM::VST2LNd32,     false, false, SingleSpc, 2, 2 },
211 { ARM::VST2LNd32Pseudo_UPD, ARM::VST2LNd32_UPD, false, true,  SingleSpc, 2, 2 },
212 { ARM::VST2LNd8Pseudo,      ARM::VST2LNd8,      false, false, SingleSpc, 2, 8 },
213 { ARM::VST2LNd8Pseudo_UPD,  ARM::VST2LNd8_UPD,  false, true,  SingleSpc, 2, 8 },
214 { ARM::VST2LNq16Pseudo,     ARM::VST2LNq16,     false, false, EvenDblSpc, 2, 4},
215 { ARM::VST2LNq16Pseudo_UPD, ARM::VST2LNq16_UPD, false, true,  EvenDblSpc, 2, 4},
216 { ARM::VST2LNq32Pseudo,     ARM::VST2LNq32,     false, false, EvenDblSpc, 2, 2},
217 { ARM::VST2LNq32Pseudo_UPD, ARM::VST2LNq32_UPD, false, true,  EvenDblSpc, 2, 2},
218
219 { ARM::VST2d16Pseudo,       ARM::VST2d16,      false, false, SingleSpc,  2, 4 },
220 { ARM::VST2d16Pseudo_UPD,   ARM::VST2d16_UPD,  false, true,  SingleSpc,  2, 4 },
221 { ARM::VST2d32Pseudo,       ARM::VST2d32,      false, false, SingleSpc,  2, 2 },
222 { ARM::VST2d32Pseudo_UPD,   ARM::VST2d32_UPD,  false, true,  SingleSpc,  2, 2 },
223 { ARM::VST2d8Pseudo,        ARM::VST2d8,       false, false, SingleSpc,  2, 8 },
224 { ARM::VST2d8Pseudo_UPD,    ARM::VST2d8_UPD,   false, true,  SingleSpc,  2, 8 },
225
226 { ARM::VST2q16Pseudo,       ARM::VST2q16,      false, false, SingleSpc,  4, 4 },
227 { ARM::VST2q16Pseudo_UPD,   ARM::VST2q16_UPD,  false, true,  SingleSpc,  4, 4 },
228 { ARM::VST2q32Pseudo,       ARM::VST2q32,      false, false, SingleSpc,  4, 2 },
229 { ARM::VST2q32Pseudo_UPD,   ARM::VST2q32_UPD,  false, true,  SingleSpc,  4, 2 },
230 { ARM::VST2q8Pseudo,        ARM::VST2q8,       false, false, SingleSpc,  4, 8 },
231 { ARM::VST2q8Pseudo_UPD,    ARM::VST2q8_UPD,   false, true,  SingleSpc,  4, 8 },
232
233 { ARM::VST3LNd16Pseudo,     ARM::VST3LNd16,     false, false, SingleSpc, 3, 4 },
234 { ARM::VST3LNd16Pseudo_UPD, ARM::VST3LNd16_UPD, false, true,  SingleSpc, 3, 4 },
235 { ARM::VST3LNd32Pseudo,     ARM::VST3LNd32,     false, false, SingleSpc, 3, 2 },
236 { ARM::VST3LNd32Pseudo_UPD, ARM::VST3LNd32_UPD, false, true,  SingleSpc, 3, 2 },
237 { ARM::VST3LNd8Pseudo,      ARM::VST3LNd8,      false, false, SingleSpc, 3, 8 },
238 { ARM::VST3LNd8Pseudo_UPD,  ARM::VST3LNd8_UPD,  false, true,  SingleSpc, 3, 8 },
239 { ARM::VST3LNq16Pseudo,     ARM::VST3LNq16,     false, false, EvenDblSpc, 3, 4},
240 { ARM::VST3LNq16Pseudo_UPD, ARM::VST3LNq16_UPD, false, true,  EvenDblSpc, 3, 4},
241 { ARM::VST3LNq32Pseudo,     ARM::VST3LNq32,     false, false, EvenDblSpc, 3, 2},
242 { ARM::VST3LNq32Pseudo_UPD, ARM::VST3LNq32_UPD, false, true,  EvenDblSpc, 3, 2},
243
244 { ARM::VST3d16Pseudo,       ARM::VST3d16,      false, false, SingleSpc,  3, 4 },
245 { ARM::VST3d16Pseudo_UPD,   ARM::VST3d16_UPD,  false, true,  SingleSpc,  3, 4 },
246 { ARM::VST3d32Pseudo,       ARM::VST3d32,      false, false, SingleSpc,  3, 2 },
247 { ARM::VST3d32Pseudo_UPD,   ARM::VST3d32_UPD,  false, true,  SingleSpc,  3, 2 },
248 { ARM::VST3d8Pseudo,        ARM::VST3d8,       false, false, SingleSpc,  3, 8 },
249 { ARM::VST3d8Pseudo_UPD,    ARM::VST3d8_UPD,   false, true,  SingleSpc,  3, 8 },
250
251 { ARM::VST3q16Pseudo_UPD,    ARM::VST3q16_UPD, false, true,  EvenDblSpc, 3, 4 },
252 { ARM::VST3q16oddPseudo_UPD, ARM::VST3q16_UPD, false, true,  OddDblSpc,  3, 4 },
253 { ARM::VST3q32Pseudo_UPD,    ARM::VST3q32_UPD, false, true,  EvenDblSpc, 3, 2 },
254 { ARM::VST3q32oddPseudo_UPD, ARM::VST3q32_UPD, false, true,  OddDblSpc,  3, 2 },
255 { ARM::VST3q8Pseudo_UPD,     ARM::VST3q8_UPD,  false, true,  EvenDblSpc, 3, 8 },
256 { ARM::VST3q8oddPseudo_UPD,  ARM::VST3q8_UPD,  false, true,  OddDblSpc,  3, 8 },
257
258 { ARM::VST4LNd16Pseudo,     ARM::VST4LNd16,     false, false, SingleSpc, 4, 4 },
259 { ARM::VST4LNd16Pseudo_UPD, ARM::VST4LNd16_UPD, false, true,  SingleSpc, 4, 4 },
260 { ARM::VST4LNd32Pseudo,     ARM::VST4LNd32,     false, false, SingleSpc, 4, 2 },
261 { ARM::VST4LNd32Pseudo_UPD, ARM::VST4LNd32_UPD, false, true,  SingleSpc, 4, 2 },
262 { ARM::VST4LNd8Pseudo,      ARM::VST4LNd8,      false, false, SingleSpc, 4, 8 },
263 { ARM::VST4LNd8Pseudo_UPD,  ARM::VST4LNd8_UPD,  false, true,  SingleSpc, 4, 8 },
264 { ARM::VST4LNq16Pseudo,     ARM::VST4LNq16,     false, false, EvenDblSpc, 4, 4},
265 { ARM::VST4LNq16Pseudo_UPD, ARM::VST4LNq16_UPD, false, true,  EvenDblSpc, 4, 4},
266 { ARM::VST4LNq32Pseudo,     ARM::VST4LNq32,     false, false, EvenDblSpc, 4, 2},
267 { ARM::VST4LNq32Pseudo_UPD, ARM::VST4LNq32_UPD, false, true,  EvenDblSpc, 4, 2},
268
269 { ARM::VST4d16Pseudo,       ARM::VST4d16,      false, false, SingleSpc,  4, 4 },
270 { ARM::VST4d16Pseudo_UPD,   ARM::VST4d16_UPD,  false, true,  SingleSpc,  4, 4 },
271 { ARM::VST4d32Pseudo,       ARM::VST4d32,      false, false, SingleSpc,  4, 2 },
272 { ARM::VST4d32Pseudo_UPD,   ARM::VST4d32_UPD,  false, true,  SingleSpc,  4, 2 },
273 { ARM::VST4d8Pseudo,        ARM::VST4d8,       false, false, SingleSpc,  4, 8 },
274 { ARM::VST4d8Pseudo_UPD,    ARM::VST4d8_UPD,   false, true,  SingleSpc,  4, 8 },
275
276 { ARM::VST4q16Pseudo_UPD,    ARM::VST4q16_UPD, false, true,  EvenDblSpc, 4, 4 },
277 { ARM::VST4q16oddPseudo_UPD, ARM::VST4q16_UPD, false, true,  OddDblSpc,  4, 4 },
278 { ARM::VST4q32Pseudo_UPD,    ARM::VST4q32_UPD, false, true,  EvenDblSpc, 4, 2 },
279 { ARM::VST4q32oddPseudo_UPD, ARM::VST4q32_UPD, false, true,  OddDblSpc,  4, 2 },
280 { ARM::VST4q8Pseudo_UPD,     ARM::VST4q8_UPD,  false, true,  EvenDblSpc, 4, 8 },
281 { ARM::VST4q8oddPseudo_UPD , ARM::VST4q8_UPD,  false, true,  OddDblSpc,  4, 8 }
282 };
283
284 /// LookupNEONLdSt - Search the NEONLdStTable for information about a NEON
285 /// load or store pseudo instruction.
286 static const NEONLdStTableEntry *LookupNEONLdSt(unsigned Opcode) {
287   unsigned NumEntries = array_lengthof(NEONLdStTable);
288
289 #ifndef NDEBUG
290   // Make sure the table is sorted.
291   static bool TableChecked = false;
292   if (!TableChecked) {
293     for (unsigned i = 0; i != NumEntries-1; ++i)
294       assert(NEONLdStTable[i] < NEONLdStTable[i+1] &&
295              "NEONLdStTable is not sorted!");
296     TableChecked = true;
297   }
298 #endif
299
300   const NEONLdStTableEntry *I =
301     std::lower_bound(NEONLdStTable, NEONLdStTable + NumEntries, Opcode);
302   if (I != NEONLdStTable + NumEntries && I->PseudoOpc == Opcode)
303     return I;
304   return NULL;
305 }
306
307 /// GetDSubRegs - Get 4 D subregisters of a Q, QQ, or QQQQ register,
308 /// corresponding to the specified register spacing.  Not all of the results
309 /// are necessarily valid, e.g., a Q register only has 2 D subregisters.
310 static void GetDSubRegs(unsigned Reg, NEONRegSpacing RegSpc,
311                         const TargetRegisterInfo *TRI, unsigned &D0,
312                         unsigned &D1, unsigned &D2, unsigned &D3) {
313   if (RegSpc == SingleSpc) {
314     D0 = TRI->getSubReg(Reg, ARM::dsub_0);
315     D1 = TRI->getSubReg(Reg, ARM::dsub_1);
316     D2 = TRI->getSubReg(Reg, ARM::dsub_2);
317     D3 = TRI->getSubReg(Reg, ARM::dsub_3);
318   } else if (RegSpc == EvenDblSpc) {
319     D0 = TRI->getSubReg(Reg, ARM::dsub_0);
320     D1 = TRI->getSubReg(Reg, ARM::dsub_2);
321     D2 = TRI->getSubReg(Reg, ARM::dsub_4);
322     D3 = TRI->getSubReg(Reg, ARM::dsub_6);
323   } else {
324     assert(RegSpc == OddDblSpc && "unknown register spacing");
325     D0 = TRI->getSubReg(Reg, ARM::dsub_1);
326     D1 = TRI->getSubReg(Reg, ARM::dsub_3);
327     D2 = TRI->getSubReg(Reg, ARM::dsub_5);
328     D3 = TRI->getSubReg(Reg, ARM::dsub_7);
329   } 
330 }
331
332 /// ExpandVLD - Translate VLD pseudo instructions with Q, QQ or QQQQ register
333 /// operands to real VLD instructions with D register operands.
334 void ARMExpandPseudo::ExpandVLD(MachineBasicBlock::iterator &MBBI) {
335   MachineInstr &MI = *MBBI;
336   MachineBasicBlock &MBB = *MI.getParent();
337
338   const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
339   assert(TableEntry && TableEntry->IsLoad && "NEONLdStTable lookup failed");
340   NEONRegSpacing RegSpc = TableEntry->RegSpacing;
341   unsigned NumRegs = TableEntry->NumRegs;
342
343   MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
344                                     TII->get(TableEntry->RealOpc));
345   unsigned OpIdx = 0;
346
347   bool DstIsDead = MI.getOperand(OpIdx).isDead();
348   unsigned DstReg = MI.getOperand(OpIdx++).getReg();
349   unsigned D0, D1, D2, D3;
350   GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
351   MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
352     .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
353   if (NumRegs > 2)
354     MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
355   if (NumRegs > 3)
356     MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
357
358   if (TableEntry->HasWriteBack)
359     MIB.addOperand(MI.getOperand(OpIdx++));
360
361   // Copy the addrmode6 operands.
362   MIB.addOperand(MI.getOperand(OpIdx++));
363   MIB.addOperand(MI.getOperand(OpIdx++));
364   // Copy the am6offset operand.
365   if (TableEntry->HasWriteBack)
366     MIB.addOperand(MI.getOperand(OpIdx++));
367
368   MIB = AddDefaultPred(MIB);
369   // For an instruction writing double-spaced subregs, the pseudo instruction
370   // has an extra operand that is a use of the super-register.  Copy that over
371   // to the new instruction as an implicit operand.
372   if (RegSpc == EvenDblSpc || RegSpc == OddDblSpc) {
373     MachineOperand MO = MI.getOperand(OpIdx);
374     MO.setImplicit(true);
375     MIB.addOperand(MO);
376   }
377   // Add an implicit def for the super-register.
378   MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
379   TransferImpOps(MI, MIB, MIB);
380   MI.eraseFromParent();
381 }
382
383 /// ExpandVST - Translate VST pseudo instructions with Q, QQ or QQQQ register
384 /// operands to real VST instructions with D register operands.
385 void ARMExpandPseudo::ExpandVST(MachineBasicBlock::iterator &MBBI) {
386   MachineInstr &MI = *MBBI;
387   MachineBasicBlock &MBB = *MI.getParent();
388
389   const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
390   assert(TableEntry && !TableEntry->IsLoad && "NEONLdStTable lookup failed");
391   NEONRegSpacing RegSpc = TableEntry->RegSpacing;
392   unsigned NumRegs = TableEntry->NumRegs;
393
394   MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
395                                     TII->get(TableEntry->RealOpc));
396   unsigned OpIdx = 0;
397   if (TableEntry->HasWriteBack)
398     MIB.addOperand(MI.getOperand(OpIdx++));
399
400   // Copy the addrmode6 operands.
401   MIB.addOperand(MI.getOperand(OpIdx++));
402   MIB.addOperand(MI.getOperand(OpIdx++));
403   // Copy the am6offset operand.
404   if (TableEntry->HasWriteBack)
405     MIB.addOperand(MI.getOperand(OpIdx++));
406
407   bool SrcIsKill = MI.getOperand(OpIdx).isKill();
408   unsigned SrcReg = MI.getOperand(OpIdx).getReg();
409   unsigned D0, D1, D2, D3;
410   GetDSubRegs(SrcReg, RegSpc, TRI, D0, D1, D2, D3);
411   MIB.addReg(D0).addReg(D1);
412   if (NumRegs > 2)
413     MIB.addReg(D2);
414   if (NumRegs > 3)
415     MIB.addReg(D3);
416   MIB = AddDefaultPred(MIB);
417   TransferImpOps(MI, MIB, MIB);
418   if (SrcIsKill)
419     // Add an implicit kill for the super-reg.
420     (*MIB).addRegisterKilled(SrcReg, TRI, true);
421   MI.eraseFromParent();
422 }
423
424 /// ExpandLaneOp - Translate VLD*LN and VST*LN instructions with Q, QQ or QQQQ
425 /// register operands to real instructions with D register operands.
426 void ARMExpandPseudo::ExpandLaneOp(MachineBasicBlock::iterator &MBBI) {
427   MachineInstr &MI = *MBBI;
428   MachineBasicBlock &MBB = *MI.getParent();
429
430   const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode());
431   assert(TableEntry && "NEONLdStTable lookup failed");
432   NEONRegSpacing RegSpc = TableEntry->RegSpacing;
433   unsigned NumRegs = TableEntry->NumRegs;
434   unsigned RegElts = TableEntry->RegElts;
435
436   MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(),
437                                     TII->get(TableEntry->RealOpc));
438   unsigned OpIdx = 0;
439   // The lane operand is always the 3rd from last operand, before the 2
440   // predicate operands.
441   unsigned Lane = MI.getOperand(MI.getDesc().getNumOperands() - 3).getImm();
442
443   // Adjust the lane and spacing as needed for Q registers.
444   assert(RegSpc != OddDblSpc && "unexpected register spacing for VLD/VST-lane");
445   if (RegSpc == EvenDblSpc && Lane >= RegElts) {
446     RegSpc = OddDblSpc;
447     Lane -= RegElts;
448   }
449   assert(Lane < RegElts && "out of range lane for VLD/VST-lane");
450
451   unsigned DstReg, D0, D1, D2, D3;
452   bool DstIsDead;
453   if (TableEntry->IsLoad) {
454     DstIsDead = MI.getOperand(OpIdx).isDead();
455     DstReg = MI.getOperand(OpIdx++).getReg();
456     GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3);
457     MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead))
458       .addReg(D1, RegState::Define | getDeadRegState(DstIsDead));
459     if (NumRegs > 2)
460       MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead));
461     if (NumRegs > 3)
462       MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead));
463   }
464
465   if (TableEntry->HasWriteBack)
466     MIB.addOperand(MI.getOperand(OpIdx++));
467
468   // Copy the addrmode6 operands.
469   MIB.addOperand(MI.getOperand(OpIdx++));
470   MIB.addOperand(MI.getOperand(OpIdx++));
471   // Copy the am6offset operand.
472   if (TableEntry->HasWriteBack)
473     MIB.addOperand(MI.getOperand(OpIdx++));
474
475   // Grab the super-register source.
476   MachineOperand MO = MI.getOperand(OpIdx++);
477   if (!TableEntry->IsLoad)
478     GetDSubRegs(MO.getReg(), RegSpc, TRI, D0, D1, D2, D3);
479
480   // Add the subregs as sources of the new instruction.
481   unsigned SrcFlags = (getUndefRegState(MO.isUndef()) |
482                        getKillRegState(MO.isKill()));
483   MIB.addReg(D0, SrcFlags).addReg(D1, SrcFlags);
484   if (NumRegs > 2)
485     MIB.addReg(D2, SrcFlags);
486   if (NumRegs > 3)
487     MIB.addReg(D3, SrcFlags);
488
489   // Add the lane number operand.
490   MIB.addImm(Lane);
491
492   MIB = AddDefaultPred(MIB);
493   // Copy the super-register source to be an implicit source.
494   MO.setImplicit(true);
495   MIB.addOperand(MO);
496   if (TableEntry->IsLoad)
497     // Add an implicit def for the super-register.
498     MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead));
499   TransferImpOps(MI, MIB, MIB);
500   MI.eraseFromParent();
501 }
502
503 bool ARMExpandPseudo::ExpandMBB(MachineBasicBlock &MBB) {
504   bool Modified = false;
505
506   MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
507   while (MBBI != E) {
508     MachineInstr &MI = *MBBI;
509     MachineBasicBlock::iterator NMBBI = llvm::next(MBBI);
510
511     bool ModifiedOp = true;
512     unsigned Opcode = MI.getOpcode();
513     switch (Opcode) {
514     default:
515       ModifiedOp = false;
516       break;
517
518     case ARM::tLDRpci_pic: 
519     case ARM::t2LDRpci_pic: {
520       unsigned NewLdOpc = (Opcode == ARM::tLDRpci_pic)
521         ? ARM::tLDRpci : ARM::t2LDRpci;
522       unsigned DstReg = MI.getOperand(0).getReg();
523       bool DstIsDead = MI.getOperand(0).isDead();
524       MachineInstrBuilder MIB1 =
525         AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
526                                TII->get(NewLdOpc), DstReg)
527                        .addOperand(MI.getOperand(1)));
528       (*MIB1).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
529       MachineInstrBuilder MIB2 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
530                                          TII->get(ARM::tPICADD))
531         .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead))
532         .addReg(DstReg)
533         .addOperand(MI.getOperand(2));
534       TransferImpOps(MI, MIB1, MIB2);
535       MI.eraseFromParent();
536       break;
537     }
538
539     case ARM::MOVi32imm:
540     case ARM::t2MOVi32imm: {
541       unsigned PredReg = 0;
542       ARMCC::CondCodes Pred = llvm::getInstrPredicate(&MI, PredReg);
543       unsigned DstReg = MI.getOperand(0).getReg();
544       bool DstIsDead = MI.getOperand(0).isDead();
545       const MachineOperand &MO = MI.getOperand(1);
546       MachineInstrBuilder LO16, HI16;
547
548       LO16 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
549                      TII->get(Opcode == ARM::MOVi32imm ?
550                               ARM::MOVi16 : ARM::t2MOVi16),
551                      DstReg);
552       HI16 = BuildMI(MBB, MBBI, MI.getDebugLoc(),
553                      TII->get(Opcode == ARM::MOVi32imm ?
554                               ARM::MOVTi16 : ARM::t2MOVTi16))
555         .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead))
556         .addReg(DstReg);
557
558       if (MO.isImm()) {
559         unsigned Imm = MO.getImm();
560         unsigned Lo16 = Imm & 0xffff;
561         unsigned Hi16 = (Imm >> 16) & 0xffff;
562         LO16 = LO16.addImm(Lo16);
563         HI16 = HI16.addImm(Hi16);
564       } else {
565         const GlobalValue *GV = MO.getGlobal();
566         unsigned TF = MO.getTargetFlags();
567         LO16 = LO16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_LO16);
568         HI16 = HI16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_HI16);
569       }
570       (*LO16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
571       (*HI16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end());
572       LO16.addImm(Pred).addReg(PredReg);
573       HI16.addImm(Pred).addReg(PredReg);
574       TransferImpOps(MI, LO16, HI16);
575       MI.eraseFromParent();
576       break;
577     }
578
579     case ARM::VMOVQQ: {
580       unsigned DstReg = MI.getOperand(0).getReg();
581       bool DstIsDead = MI.getOperand(0).isDead();
582       unsigned EvenDst = TRI->getSubReg(DstReg, ARM::qsub_0);
583       unsigned OddDst  = TRI->getSubReg(DstReg, ARM::qsub_1);
584       unsigned SrcReg = MI.getOperand(1).getReg();
585       bool SrcIsKill = MI.getOperand(1).isKill();
586       unsigned EvenSrc = TRI->getSubReg(SrcReg, ARM::qsub_0);
587       unsigned OddSrc  = TRI->getSubReg(SrcReg, ARM::qsub_1);
588       MachineInstrBuilder Even =
589         AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
590                                TII->get(ARM::VMOVQ))
591                      .addReg(EvenDst,
592                              getDefRegState(true) | getDeadRegState(DstIsDead))
593                      .addReg(EvenSrc, getKillRegState(SrcIsKill)));
594       MachineInstrBuilder Odd =
595         AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(),
596                                TII->get(ARM::VMOVQ))
597                      .addReg(OddDst,
598                              getDefRegState(true) | getDeadRegState(DstIsDead))
599                      .addReg(OddSrc, getKillRegState(SrcIsKill)));
600       TransferImpOps(MI, Even, Odd);
601       MI.eraseFromParent();
602     }
603
604     case ARM::VLD1q8Pseudo:
605     case ARM::VLD1q16Pseudo:
606     case ARM::VLD1q32Pseudo:
607     case ARM::VLD1q64Pseudo:
608     case ARM::VLD1q8Pseudo_UPD:
609     case ARM::VLD1q16Pseudo_UPD:
610     case ARM::VLD1q32Pseudo_UPD:
611     case ARM::VLD1q64Pseudo_UPD:
612     case ARM::VLD2d8Pseudo:
613     case ARM::VLD2d16Pseudo:
614     case ARM::VLD2d32Pseudo:
615     case ARM::VLD2q8Pseudo:
616     case ARM::VLD2q16Pseudo:
617     case ARM::VLD2q32Pseudo:
618     case ARM::VLD2d8Pseudo_UPD:
619     case ARM::VLD2d16Pseudo_UPD:
620     case ARM::VLD2d32Pseudo_UPD:
621     case ARM::VLD2q8Pseudo_UPD:
622     case ARM::VLD2q16Pseudo_UPD:
623     case ARM::VLD2q32Pseudo_UPD:
624     case ARM::VLD3d8Pseudo:
625     case ARM::VLD3d16Pseudo:
626     case ARM::VLD3d32Pseudo:
627     case ARM::VLD1d64TPseudo:
628     case ARM::VLD3d8Pseudo_UPD:
629     case ARM::VLD3d16Pseudo_UPD:
630     case ARM::VLD3d32Pseudo_UPD:
631     case ARM::VLD1d64TPseudo_UPD:
632     case ARM::VLD3q8Pseudo_UPD:
633     case ARM::VLD3q16Pseudo_UPD:
634     case ARM::VLD3q32Pseudo_UPD:
635     case ARM::VLD3q8oddPseudo_UPD:
636     case ARM::VLD3q16oddPseudo_UPD:
637     case ARM::VLD3q32oddPseudo_UPD:
638     case ARM::VLD4d8Pseudo:
639     case ARM::VLD4d16Pseudo:
640     case ARM::VLD4d32Pseudo:
641     case ARM::VLD1d64QPseudo:
642     case ARM::VLD4d8Pseudo_UPD:
643     case ARM::VLD4d16Pseudo_UPD:
644     case ARM::VLD4d32Pseudo_UPD:
645     case ARM::VLD1d64QPseudo_UPD:
646     case ARM::VLD4q8Pseudo_UPD:
647     case ARM::VLD4q16Pseudo_UPD:
648     case ARM::VLD4q32Pseudo_UPD:
649     case ARM::VLD4q8oddPseudo_UPD:
650     case ARM::VLD4q16oddPseudo_UPD:
651     case ARM::VLD4q32oddPseudo_UPD:
652       ExpandVLD(MBBI);
653       break;
654
655     case ARM::VST1q8Pseudo:
656     case ARM::VST1q16Pseudo:
657     case ARM::VST1q32Pseudo:
658     case ARM::VST1q64Pseudo:
659     case ARM::VST1q8Pseudo_UPD:
660     case ARM::VST1q16Pseudo_UPD:
661     case ARM::VST1q32Pseudo_UPD:
662     case ARM::VST1q64Pseudo_UPD:
663     case ARM::VST2d8Pseudo:
664     case ARM::VST2d16Pseudo:
665     case ARM::VST2d32Pseudo:
666     case ARM::VST2q8Pseudo:
667     case ARM::VST2q16Pseudo:
668     case ARM::VST2q32Pseudo:
669     case ARM::VST2d8Pseudo_UPD:
670     case ARM::VST2d16Pseudo_UPD:
671     case ARM::VST2d32Pseudo_UPD:
672     case ARM::VST2q8Pseudo_UPD:
673     case ARM::VST2q16Pseudo_UPD:
674     case ARM::VST2q32Pseudo_UPD:
675     case ARM::VST3d8Pseudo:
676     case ARM::VST3d16Pseudo:
677     case ARM::VST3d32Pseudo:
678     case ARM::VST1d64TPseudo:
679     case ARM::VST3d8Pseudo_UPD:
680     case ARM::VST3d16Pseudo_UPD:
681     case ARM::VST3d32Pseudo_UPD:
682     case ARM::VST1d64TPseudo_UPD:
683     case ARM::VST3q8Pseudo_UPD:
684     case ARM::VST3q16Pseudo_UPD:
685     case ARM::VST3q32Pseudo_UPD:
686     case ARM::VST3q8oddPseudo_UPD:
687     case ARM::VST3q16oddPseudo_UPD:
688     case ARM::VST3q32oddPseudo_UPD:
689     case ARM::VST4d8Pseudo:
690     case ARM::VST4d16Pseudo:
691     case ARM::VST4d32Pseudo:
692     case ARM::VST1d64QPseudo:
693     case ARM::VST4d8Pseudo_UPD:
694     case ARM::VST4d16Pseudo_UPD:
695     case ARM::VST4d32Pseudo_UPD:
696     case ARM::VST1d64QPseudo_UPD:
697     case ARM::VST4q8Pseudo_UPD:
698     case ARM::VST4q16Pseudo_UPD:
699     case ARM::VST4q32Pseudo_UPD:
700     case ARM::VST4q8oddPseudo_UPD:
701     case ARM::VST4q16oddPseudo_UPD:
702     case ARM::VST4q32oddPseudo_UPD:
703       ExpandVST(MBBI);
704       break;
705
706     case ARM::VLD2LNd8Pseudo:
707     case ARM::VLD2LNd16Pseudo:
708     case ARM::VLD2LNd32Pseudo:
709     case ARM::VLD2LNq16Pseudo:
710     case ARM::VLD2LNq32Pseudo:
711     case ARM::VLD2LNd8Pseudo_UPD:
712     case ARM::VLD2LNd16Pseudo_UPD:
713     case ARM::VLD2LNd32Pseudo_UPD:
714     case ARM::VLD2LNq16Pseudo_UPD:
715     case ARM::VLD2LNq32Pseudo_UPD:
716     case ARM::VLD3LNd8Pseudo:
717     case ARM::VLD3LNd16Pseudo:
718     case ARM::VLD3LNd32Pseudo:
719     case ARM::VLD3LNq16Pseudo:
720     case ARM::VLD3LNq32Pseudo:
721     case ARM::VLD3LNd8Pseudo_UPD:
722     case ARM::VLD3LNd16Pseudo_UPD:
723     case ARM::VLD3LNd32Pseudo_UPD:
724     case ARM::VLD3LNq16Pseudo_UPD:
725     case ARM::VLD3LNq32Pseudo_UPD:
726     case ARM::VLD4LNd8Pseudo:
727     case ARM::VLD4LNd16Pseudo:
728     case ARM::VLD4LNd32Pseudo:
729     case ARM::VLD4LNq16Pseudo:
730     case ARM::VLD4LNq32Pseudo:
731     case ARM::VLD4LNd8Pseudo_UPD:
732     case ARM::VLD4LNd16Pseudo_UPD:
733     case ARM::VLD4LNd32Pseudo_UPD:
734     case ARM::VLD4LNq16Pseudo_UPD:
735     case ARM::VLD4LNq32Pseudo_UPD:
736     case ARM::VST2LNd8Pseudo:
737     case ARM::VST2LNd16Pseudo:
738     case ARM::VST2LNd32Pseudo:
739     case ARM::VST2LNq16Pseudo:
740     case ARM::VST2LNq32Pseudo:
741     case ARM::VST2LNd8Pseudo_UPD:
742     case ARM::VST2LNd16Pseudo_UPD:
743     case ARM::VST2LNd32Pseudo_UPD:
744     case ARM::VST2LNq16Pseudo_UPD:
745     case ARM::VST2LNq32Pseudo_UPD:
746     case ARM::VST3LNd8Pseudo:
747     case ARM::VST3LNd16Pseudo:
748     case ARM::VST3LNd32Pseudo:
749     case ARM::VST3LNq16Pseudo:
750     case ARM::VST3LNq32Pseudo:
751     case ARM::VST3LNd8Pseudo_UPD:
752     case ARM::VST3LNd16Pseudo_UPD:
753     case ARM::VST3LNd32Pseudo_UPD:
754     case ARM::VST3LNq16Pseudo_UPD:
755     case ARM::VST3LNq32Pseudo_UPD:
756     case ARM::VST4LNd8Pseudo:
757     case ARM::VST4LNd16Pseudo:
758     case ARM::VST4LNd32Pseudo:
759     case ARM::VST4LNq16Pseudo:
760     case ARM::VST4LNq32Pseudo:
761     case ARM::VST4LNd8Pseudo_UPD:
762     case ARM::VST4LNd16Pseudo_UPD:
763     case ARM::VST4LNd32Pseudo_UPD:
764     case ARM::VST4LNq16Pseudo_UPD:
765     case ARM::VST4LNq32Pseudo_UPD:
766       ExpandLaneOp(MBBI);
767       break;
768     }
769
770     if (ModifiedOp)
771       Modified = true;
772     MBBI = NMBBI;
773   }
774
775   return Modified;
776 }
777
778 bool ARMExpandPseudo::runOnMachineFunction(MachineFunction &MF) {
779   TII = MF.getTarget().getInstrInfo();
780   TRI = MF.getTarget().getRegisterInfo();
781
782   bool Modified = false;
783   for (MachineFunction::iterator MFI = MF.begin(), E = MF.end(); MFI != E;
784        ++MFI)
785     Modified |= ExpandMBB(*MFI);
786   return Modified;
787 }
788
789 /// createARMExpandPseudoPass - returns an instance of the pseudo instruction
790 /// expansion pass.
791 FunctionPass *llvm::createARMExpandPseudoPass() {
792   return new ARMExpandPseudo();
793 }