Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 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 | // |
Bob Wilson | 656edcf | 2010-09-08 23:39:54 +0000 | [diff] [blame] | 10 | // This file contains a pass that expands pseudo instructions into target |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 11 | // instructions to allow proper scheduling, if-conversion, and other late |
| 12 | // optimizations. This pass should be run after register allocation but before |
Bob Wilson | 656edcf | 2010-09-08 23:39:54 +0000 | [diff] [blame] | 13 | // the post-regalloc scheduling pass. |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 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" |
Chris Lattner | 4dbbe34 | 2010-07-20 21:17:29 +0000 | [diff] [blame] | 22 | #include "llvm/Target/TargetRegisterInfo.h" |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 23 | using namespace llvm; |
| 24 | |
| 25 | namespace { |
| 26 | class ARMExpandPseudo : public MachineFunctionPass { |
| 27 | public: |
| 28 | static char ID; |
Owen Anderson | 90c579d | 2010-08-06 18:33:48 +0000 | [diff] [blame] | 29 | ARMExpandPseudo() : MachineFunctionPass(ID) {} |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 30 | |
| 31 | const TargetInstrInfo *TII; |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 32 | const TargetRegisterInfo *TRI; |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 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: |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 41 | void TransferImpOps(MachineInstr &OldMI, |
| 42 | MachineInstrBuilder &UseMI, MachineInstrBuilder &DefMI); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 43 | bool ExpandMBB(MachineBasicBlock &MBB); |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 44 | void ExpandVLD(MachineBasicBlock::iterator &MBBI); |
| 45 | void ExpandVST(MachineBasicBlock::iterator &MBBI); |
| 46 | void ExpandLaneOp(MachineBasicBlock::iterator &MBBI); |
Bob Wilson | bd916c5 | 2010-09-13 23:55:10 +0000 | [diff] [blame] | 47 | void ExpandVTBL(MachineBasicBlock::iterator &MBBI, |
| 48 | unsigned Opc, bool IsExt, unsigned NumRegs); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 49 | }; |
| 50 | char ARMExpandPseudo::ID = 0; |
| 51 | } |
| 52 | |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 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(); |
| 60 | i != e; ++i) { |
| 61 | const MachineOperand &MO = OldMI.getOperand(i); |
| 62 | assert(MO.isReg() && MO.getReg()); |
| 63 | if (MO.isUse()) |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 64 | UseMI.addOperand(MO); |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 65 | else |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 66 | DefMI.addOperand(MO); |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 67 | } |
| 68 | } |
| 69 | |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 70 | namespace { |
| 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. |
| 75 | enum NEONRegSpacing { |
| 76 | SingleSpc, |
| 77 | EvenDblSpc, |
| 78 | OddDblSpc |
| 79 | }; |
| 80 | |
| 81 | // Entries for NEON load/store information table. The table is sorted by |
| 82 | // PseudoOpc for fast binary-search lookups. |
| 83 | struct NEONLdStTableEntry { |
| 84 | unsigned PseudoOpc; |
| 85 | unsigned RealOpc; |
| 86 | bool IsLoad; |
| 87 | bool HasWriteBack; |
| 88 | NEONRegSpacing RegSpacing; |
| 89 | unsigned char NumRegs; // D registers loaded or stored |
| 90 | unsigned char RegElts; // elements per D register; used for lane ops |
| 91 | |
| 92 | // Comparison methods for binary search of the table. |
| 93 | bool operator<(const NEONLdStTableEntry &TE) const { |
| 94 | return PseudoOpc < TE.PseudoOpc; |
| 95 | } |
| 96 | friend bool operator<(const NEONLdStTableEntry &TE, unsigned PseudoOpc) { |
| 97 | return TE.PseudoOpc < PseudoOpc; |
| 98 | } |
| 99 | friend bool ATTRIBUTE_UNUSED operator<(unsigned PseudoOpc, |
| 100 | const NEONLdStTableEntry &TE) { |
| 101 | return PseudoOpc < TE.PseudoOpc; |
| 102 | } |
| 103 | }; |
| 104 | } |
| 105 | |
| 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 }, |
| 111 | |
| 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 }, |
| 120 | |
| 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 }, |
| 131 | |
| 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 }, |
| 138 | |
| 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 }, |
| 145 | |
| 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 }, |
| 156 | |
| 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 }, |
| 163 | |
| 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 }, |
| 170 | |
| 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 }, |
| 181 | |
| 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 }, |
| 188 | |
| 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 }, |
| 195 | |
| 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 }, |
| 200 | |
| 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 }, |
| 209 | |
| 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}, |
| 220 | |
| 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 }, |
| 227 | |
| 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 }, |
| 234 | |
| 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}, |
| 245 | |
| 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 }, |
| 252 | |
| 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 }, |
| 259 | |
| 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}, |
| 270 | |
| 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 }, |
| 277 | |
| 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 } |
| 284 | }; |
| 285 | |
| 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); |
| 290 | |
| 291 | #ifndef NDEBUG |
| 292 | // Make sure the table is sorted. |
| 293 | static bool TableChecked = false; |
| 294 | if (!TableChecked) { |
| 295 | for (unsigned i = 0; i != NumEntries-1; ++i) |
| 296 | assert(NEONLdStTable[i] < NEONLdStTable[i+1] && |
| 297 | "NEONLdStTable is not sorted!"); |
| 298 | TableChecked = true; |
| 299 | } |
| 300 | #endif |
| 301 | |
| 302 | const NEONLdStTableEntry *I = |
| 303 | std::lower_bound(NEONLdStTable, NEONLdStTable + NumEntries, Opcode); |
| 304 | if (I != NEONLdStTable + NumEntries && I->PseudoOpc == Opcode) |
| 305 | return I; |
| 306 | return NULL; |
| 307 | } |
| 308 | |
| 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); |
| 325 | } else { |
| 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); |
Bob Wilson | bd916c5 | 2010-09-13 23:55:10 +0000 | [diff] [blame] | 331 | } |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 332 | } |
| 333 | |
Bob Wilson | 82a9c84 | 2010-09-02 16:17:29 +0000 | [diff] [blame] | 334 | /// ExpandVLD - Translate VLD pseudo instructions with Q, QQ or QQQQ register |
| 335 | /// operands to real VLD instructions with D register operands. |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 336 | void ARMExpandPseudo::ExpandVLD(MachineBasicBlock::iterator &MBBI) { |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 337 | MachineInstr &MI = *MBBI; |
| 338 | MachineBasicBlock &MBB = *MI.getParent(); |
| 339 | |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 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; |
| 344 | |
| 345 | MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 346 | TII->get(TableEntry->RealOpc)); |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 347 | unsigned OpIdx = 0; |
| 348 | |
| 349 | bool DstIsDead = MI.getOperand(OpIdx).isDead(); |
| 350 | unsigned DstReg = MI.getOperand(OpIdx++).getReg(); |
| 351 | unsigned D0, D1, D2, D3; |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 352 | GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3); |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 353 | MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead)) |
| 354 | .addReg(D1, RegState::Define | getDeadRegState(DstIsDead)); |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 355 | if (NumRegs > 2) |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 356 | MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead)); |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 357 | if (NumRegs > 3) |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 358 | MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead)); |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 359 | |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 360 | if (TableEntry->HasWriteBack) |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 361 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 362 | |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 363 | // Copy the addrmode6 operands. |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 364 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 365 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 366 | // Copy the am6offset operand. |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 367 | if (TableEntry->HasWriteBack) |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 368 | MIB.addOperand(MI.getOperand(OpIdx++)); |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 369 | |
| 370 | MIB = AddDefaultPred(MIB); |
Bob Wilson | 19d644d | 2010-09-09 00:38:32 +0000 | [diff] [blame] | 371 | // For an instruction writing double-spaced subregs, the pseudo instruction |
| 372 | // has an extra operand that is a use of the super-register. Copy that over |
| 373 | // to the new instruction as an implicit operand. |
| 374 | if (RegSpc == EvenDblSpc || RegSpc == OddDblSpc) { |
| 375 | MachineOperand MO = MI.getOperand(OpIdx); |
| 376 | MO.setImplicit(true); |
| 377 | MIB.addOperand(MO); |
| 378 | } |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 379 | // Add an implicit def for the super-register. |
| 380 | MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead)); |
Bob Wilson | 19d644d | 2010-09-09 00:38:32 +0000 | [diff] [blame] | 381 | TransferImpOps(MI, MIB, MIB); |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 382 | MI.eraseFromParent(); |
| 383 | } |
| 384 | |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 385 | /// ExpandVST - Translate VST pseudo instructions with Q, QQ or QQQQ register |
| 386 | /// operands to real VST instructions with D register operands. |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 387 | void ARMExpandPseudo::ExpandVST(MachineBasicBlock::iterator &MBBI) { |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 388 | MachineInstr &MI = *MBBI; |
| 389 | MachineBasicBlock &MBB = *MI.getParent(); |
| 390 | |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 391 | const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode()); |
| 392 | assert(TableEntry && !TableEntry->IsLoad && "NEONLdStTable lookup failed"); |
| 393 | NEONRegSpacing RegSpc = TableEntry->RegSpacing; |
| 394 | unsigned NumRegs = TableEntry->NumRegs; |
| 395 | |
| 396 | MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 397 | TII->get(TableEntry->RealOpc)); |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 398 | unsigned OpIdx = 0; |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 399 | if (TableEntry->HasWriteBack) |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 400 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 401 | |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 402 | // Copy the addrmode6 operands. |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 403 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 404 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 405 | // Copy the am6offset operand. |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 406 | if (TableEntry->HasWriteBack) |
Bob Wilson | 63569c9 | 2010-09-09 00:15:32 +0000 | [diff] [blame] | 407 | MIB.addOperand(MI.getOperand(OpIdx++)); |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 408 | |
| 409 | bool SrcIsKill = MI.getOperand(OpIdx).isKill(); |
| 410 | unsigned SrcReg = MI.getOperand(OpIdx).getReg(); |
| 411 | unsigned D0, D1, D2, D3; |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 412 | GetDSubRegs(SrcReg, RegSpc, TRI, D0, D1, D2, D3); |
Bob Wilson | 7e70197 | 2010-08-30 18:10:48 +0000 | [diff] [blame] | 413 | MIB.addReg(D0).addReg(D1); |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 414 | if (NumRegs > 2) |
Bob Wilson | 7e70197 | 2010-08-30 18:10:48 +0000 | [diff] [blame] | 415 | MIB.addReg(D2); |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 416 | if (NumRegs > 3) |
Bob Wilson | 7e70197 | 2010-08-30 18:10:48 +0000 | [diff] [blame] | 417 | MIB.addReg(D3); |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 418 | MIB = AddDefaultPred(MIB); |
Bob Wilson | 7e70197 | 2010-08-30 18:10:48 +0000 | [diff] [blame] | 419 | if (SrcIsKill) |
| 420 | // Add an implicit kill for the super-reg. |
| 421 | (*MIB).addRegisterKilled(SrcReg, TRI, true); |
Bob Wilson | bd916c5 | 2010-09-13 23:55:10 +0000 | [diff] [blame] | 422 | TransferImpOps(MI, MIB, MIB); |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 423 | MI.eraseFromParent(); |
| 424 | } |
| 425 | |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 426 | /// ExpandLaneOp - Translate VLD*LN and VST*LN instructions with Q, QQ or QQQQ |
| 427 | /// register operands to real instructions with D register operands. |
| 428 | void ARMExpandPseudo::ExpandLaneOp(MachineBasicBlock::iterator &MBBI) { |
| 429 | MachineInstr &MI = *MBBI; |
| 430 | MachineBasicBlock &MBB = *MI.getParent(); |
| 431 | |
| 432 | const NEONLdStTableEntry *TableEntry = LookupNEONLdSt(MI.getOpcode()); |
| 433 | assert(TableEntry && "NEONLdStTable lookup failed"); |
| 434 | NEONRegSpacing RegSpc = TableEntry->RegSpacing; |
| 435 | unsigned NumRegs = TableEntry->NumRegs; |
| 436 | unsigned RegElts = TableEntry->RegElts; |
| 437 | |
| 438 | MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 439 | TII->get(TableEntry->RealOpc)); |
| 440 | unsigned OpIdx = 0; |
| 441 | // The lane operand is always the 3rd from last operand, before the 2 |
| 442 | // predicate operands. |
| 443 | unsigned Lane = MI.getOperand(MI.getDesc().getNumOperands() - 3).getImm(); |
| 444 | |
| 445 | // Adjust the lane and spacing as needed for Q registers. |
| 446 | assert(RegSpc != OddDblSpc && "unexpected register spacing for VLD/VST-lane"); |
| 447 | if (RegSpc == EvenDblSpc && Lane >= RegElts) { |
| 448 | RegSpc = OddDblSpc; |
| 449 | Lane -= RegElts; |
| 450 | } |
| 451 | assert(Lane < RegElts && "out of range lane for VLD/VST-lane"); |
| 452 | |
Bob Wilson | fe3ac08 | 2010-09-14 21:12:05 +0000 | [diff] [blame] | 453 | unsigned D0, D1, D2, D3; |
| 454 | unsigned DstReg = 0; |
| 455 | bool DstIsDead = false; |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 456 | if (TableEntry->IsLoad) { |
| 457 | DstIsDead = MI.getOperand(OpIdx).isDead(); |
| 458 | DstReg = MI.getOperand(OpIdx++).getReg(); |
| 459 | GetDSubRegs(DstReg, RegSpc, TRI, D0, D1, D2, D3); |
| 460 | MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead)) |
| 461 | .addReg(D1, RegState::Define | getDeadRegState(DstIsDead)); |
| 462 | if (NumRegs > 2) |
| 463 | MIB.addReg(D2, RegState::Define | getDeadRegState(DstIsDead)); |
| 464 | if (NumRegs > 3) |
| 465 | MIB.addReg(D3, RegState::Define | getDeadRegState(DstIsDead)); |
| 466 | } |
| 467 | |
| 468 | if (TableEntry->HasWriteBack) |
| 469 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 470 | |
| 471 | // Copy the addrmode6 operands. |
| 472 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 473 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 474 | // Copy the am6offset operand. |
| 475 | if (TableEntry->HasWriteBack) |
| 476 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 477 | |
| 478 | // Grab the super-register source. |
| 479 | MachineOperand MO = MI.getOperand(OpIdx++); |
| 480 | if (!TableEntry->IsLoad) |
| 481 | GetDSubRegs(MO.getReg(), RegSpc, TRI, D0, D1, D2, D3); |
| 482 | |
| 483 | // Add the subregs as sources of the new instruction. |
| 484 | unsigned SrcFlags = (getUndefRegState(MO.isUndef()) | |
| 485 | getKillRegState(MO.isKill())); |
| 486 | MIB.addReg(D0, SrcFlags).addReg(D1, SrcFlags); |
| 487 | if (NumRegs > 2) |
| 488 | MIB.addReg(D2, SrcFlags); |
| 489 | if (NumRegs > 3) |
| 490 | MIB.addReg(D3, SrcFlags); |
| 491 | |
| 492 | // Add the lane number operand. |
| 493 | MIB.addImm(Lane); |
| 494 | |
| 495 | MIB = AddDefaultPred(MIB); |
| 496 | // Copy the super-register source to be an implicit source. |
| 497 | MO.setImplicit(true); |
| 498 | MIB.addOperand(MO); |
| 499 | if (TableEntry->IsLoad) |
| 500 | // Add an implicit def for the super-register. |
| 501 | MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead)); |
| 502 | TransferImpOps(MI, MIB, MIB); |
| 503 | MI.eraseFromParent(); |
| 504 | } |
| 505 | |
Bob Wilson | bd916c5 | 2010-09-13 23:55:10 +0000 | [diff] [blame] | 506 | /// ExpandVTBL - Translate VTBL and VTBX pseudo instructions with Q or QQ |
| 507 | /// register operands to real instructions with D register operands. |
| 508 | void ARMExpandPseudo::ExpandVTBL(MachineBasicBlock::iterator &MBBI, |
| 509 | unsigned Opc, bool IsExt, unsigned NumRegs) { |
| 510 | MachineInstr &MI = *MBBI; |
| 511 | MachineBasicBlock &MBB = *MI.getParent(); |
| 512 | |
| 513 | MachineInstrBuilder MIB = BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(Opc)); |
| 514 | unsigned OpIdx = 0; |
| 515 | |
| 516 | // Transfer the destination register operand. |
| 517 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 518 | if (IsExt) |
| 519 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 520 | |
| 521 | bool SrcIsKill = MI.getOperand(OpIdx).isKill(); |
| 522 | unsigned SrcReg = MI.getOperand(OpIdx++).getReg(); |
| 523 | unsigned D0, D1, D2, D3; |
| 524 | GetDSubRegs(SrcReg, SingleSpc, TRI, D0, D1, D2, D3); |
| 525 | MIB.addReg(D0).addReg(D1); |
| 526 | if (NumRegs > 2) |
| 527 | MIB.addReg(D2); |
| 528 | if (NumRegs > 3) |
| 529 | MIB.addReg(D3); |
| 530 | |
| 531 | // Copy the other source register operand. |
| 532 | MIB.addOperand(MI.getOperand(OpIdx)); |
| 533 | |
| 534 | MIB = AddDefaultPred(MIB); |
| 535 | if (SrcIsKill) |
| 536 | // Add an implicit kill for the super-reg. |
| 537 | (*MIB).addRegisterKilled(SrcReg, TRI, true); |
| 538 | TransferImpOps(MI, MIB, MIB); |
| 539 | MI.eraseFromParent(); |
| 540 | } |
| 541 | |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 542 | bool ARMExpandPseudo::ExpandMBB(MachineBasicBlock &MBB) { |
| 543 | bool Modified = false; |
| 544 | |
| 545 | MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end(); |
| 546 | while (MBBI != E) { |
| 547 | MachineInstr &MI = *MBBI; |
Chris Lattner | 7896c9f | 2009-12-03 00:50:42 +0000 | [diff] [blame] | 548 | MachineBasicBlock::iterator NMBBI = llvm::next(MBBI); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 549 | |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 550 | bool ModifiedOp = true; |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 551 | unsigned Opcode = MI.getOpcode(); |
| 552 | switch (Opcode) { |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 553 | default: |
| 554 | ModifiedOp = false; |
| 555 | break; |
| 556 | |
Bob Wilson | bd916c5 | 2010-09-13 23:55:10 +0000 | [diff] [blame] | 557 | case ARM::tLDRpci_pic: |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 558 | case ARM::t2LDRpci_pic: { |
| 559 | unsigned NewLdOpc = (Opcode == ARM::tLDRpci_pic) |
| 560 | ? ARM::tLDRpci : ARM::t2LDRpci; |
| 561 | unsigned DstReg = MI.getOperand(0).getReg(); |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 562 | bool DstIsDead = MI.getOperand(0).isDead(); |
| 563 | MachineInstrBuilder MIB1 = |
| 564 | AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 565 | TII->get(NewLdOpc), DstReg) |
| 566 | .addOperand(MI.getOperand(1))); |
| 567 | (*MIB1).setMemRefs(MI.memoperands_begin(), MI.memoperands_end()); |
| 568 | MachineInstrBuilder MIB2 = BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 569 | TII->get(ARM::tPICADD)) |
| 570 | .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead)) |
| 571 | .addReg(DstReg) |
| 572 | .addOperand(MI.getOperand(2)); |
| 573 | TransferImpOps(MI, MIB1, MIB2); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 574 | MI.eraseFromParent(); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 575 | break; |
| 576 | } |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 577 | |
Anton Korobeynikov | 6d1e29d | 2010-08-30 22:50:36 +0000 | [diff] [blame] | 578 | case ARM::MOVi32imm: |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 579 | case ARM::t2MOVi32imm: { |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 580 | unsigned PredReg = 0; |
| 581 | ARMCC::CondCodes Pred = llvm::getInstrPredicate(&MI, PredReg); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 582 | unsigned DstReg = MI.getOperand(0).getReg(); |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 583 | bool DstIsDead = MI.getOperand(0).isDead(); |
| 584 | const MachineOperand &MO = MI.getOperand(1); |
| 585 | MachineInstrBuilder LO16, HI16; |
Anton Korobeynikov | 5cdc3a9 | 2009-11-24 00:44:37 +0000 | [diff] [blame] | 586 | |
Anton Korobeynikov | 6d1e29d | 2010-08-30 22:50:36 +0000 | [diff] [blame] | 587 | LO16 = BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 588 | TII->get(Opcode == ARM::MOVi32imm ? |
| 589 | ARM::MOVi16 : ARM::t2MOVi16), |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 590 | DstReg); |
Anton Korobeynikov | 6d1e29d | 2010-08-30 22:50:36 +0000 | [diff] [blame] | 591 | HI16 = BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 592 | TII->get(Opcode == ARM::MOVi32imm ? |
| 593 | ARM::MOVTi16 : ARM::t2MOVTi16)) |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 594 | .addReg(DstReg, getDefRegState(true) | getDeadRegState(DstIsDead)) |
| 595 | .addReg(DstReg); |
Anton Korobeynikov | 5cdc3a9 | 2009-11-24 00:44:37 +0000 | [diff] [blame] | 596 | |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 597 | if (MO.isImm()) { |
| 598 | unsigned Imm = MO.getImm(); |
| 599 | unsigned Lo16 = Imm & 0xffff; |
| 600 | unsigned Hi16 = (Imm >> 16) & 0xffff; |
| 601 | LO16 = LO16.addImm(Lo16); |
| 602 | HI16 = HI16.addImm(Hi16); |
| 603 | } else { |
| 604 | const GlobalValue *GV = MO.getGlobal(); |
| 605 | unsigned TF = MO.getTargetFlags(); |
| 606 | LO16 = LO16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_LO16); |
| 607 | HI16 = HI16.addGlobalAddress(GV, MO.getOffset(), TF | ARMII::MO_HI16); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 608 | } |
Evan Cheng | 4313007 | 2010-05-12 23:13:12 +0000 | [diff] [blame] | 609 | (*LO16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end()); |
| 610 | (*HI16).setMemRefs(MI.memoperands_begin(), MI.memoperands_end()); |
| 611 | LO16.addImm(Pred).addReg(PredReg); |
| 612 | HI16.addImm(Pred).addReg(PredReg); |
| 613 | TransferImpOps(MI, LO16, HI16); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 614 | MI.eraseFromParent(); |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 615 | break; |
| 616 | } |
| 617 | |
| 618 | case ARM::VMOVQQ: { |
| 619 | unsigned DstReg = MI.getOperand(0).getReg(); |
| 620 | bool DstIsDead = MI.getOperand(0).isDead(); |
Jakob Stoklund Olesen | 558661d | 2010-05-24 16:54:32 +0000 | [diff] [blame] | 621 | unsigned EvenDst = TRI->getSubReg(DstReg, ARM::qsub_0); |
| 622 | unsigned OddDst = TRI->getSubReg(DstReg, ARM::qsub_1); |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 623 | unsigned SrcReg = MI.getOperand(1).getReg(); |
| 624 | bool SrcIsKill = MI.getOperand(1).isKill(); |
Jakob Stoklund Olesen | 558661d | 2010-05-24 16:54:32 +0000 | [diff] [blame] | 625 | unsigned EvenSrc = TRI->getSubReg(SrcReg, ARM::qsub_0); |
| 626 | unsigned OddSrc = TRI->getSubReg(SrcReg, ARM::qsub_1); |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 627 | MachineInstrBuilder Even = |
| 628 | AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 629 | TII->get(ARM::VMOVQ)) |
Jim Grosbach | 18f30e6 | 2010-06-02 21:53:11 +0000 | [diff] [blame] | 630 | .addReg(EvenDst, |
| 631 | getDefRegState(true) | getDeadRegState(DstIsDead)) |
| 632 | .addReg(EvenSrc, getKillRegState(SrcIsKill))); |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 633 | MachineInstrBuilder Odd = |
| 634 | AddDefaultPred(BuildMI(MBB, MBBI, MI.getDebugLoc(), |
| 635 | TII->get(ARM::VMOVQ)) |
Jim Grosbach | 18f30e6 | 2010-06-02 21:53:11 +0000 | [diff] [blame] | 636 | .addReg(OddDst, |
| 637 | getDefRegState(true) | getDeadRegState(DstIsDead)) |
| 638 | .addReg(OddSrc, getKillRegState(SrcIsKill))); |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 639 | TransferImpOps(MI, Even, Odd); |
| 640 | MI.eraseFromParent(); |
Bob Wilson | ea606bb | 2010-09-16 00:31:32 +0000 | [diff] [blame^] | 641 | break; |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 642 | } |
| 643 | |
Bob Wilson | 9d4ebc0 | 2010-09-16 00:31:02 +0000 | [diff] [blame] | 644 | case ARM::VLDMQ: { |
| 645 | MachineInstrBuilder MIB = |
| 646 | BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::VLDMD)); |
| 647 | unsigned OpIdx = 0; |
| 648 | // Grab the Q register destination. |
| 649 | bool DstIsDead = MI.getOperand(OpIdx).isDead(); |
| 650 | unsigned DstReg = MI.getOperand(OpIdx++).getReg(); |
| 651 | // Copy the addrmode4 operands. |
| 652 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 653 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 654 | // Copy the predicate operands. |
| 655 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 656 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 657 | // Add the destination operands (D subregs). |
| 658 | unsigned D0 = TRI->getSubReg(DstReg, ARM::dsub_0); |
| 659 | unsigned D1 = TRI->getSubReg(DstReg, ARM::dsub_1); |
| 660 | MIB.addReg(D0, RegState::Define | getDeadRegState(DstIsDead)) |
| 661 | .addReg(D1, RegState::Define | getDeadRegState(DstIsDead)); |
| 662 | // Add an implicit def for the super-register. |
| 663 | MIB.addReg(DstReg, RegState::ImplicitDefine | getDeadRegState(DstIsDead)); |
| 664 | TransferImpOps(MI, MIB, MIB); |
| 665 | MI.eraseFromParent(); |
| 666 | break; |
| 667 | } |
| 668 | |
| 669 | case ARM::VSTMQ: { |
| 670 | MachineInstrBuilder MIB = |
| 671 | BuildMI(MBB, MBBI, MI.getDebugLoc(), TII->get(ARM::VSTMD)); |
| 672 | unsigned OpIdx = 0; |
| 673 | // Grab the Q register source. |
| 674 | bool SrcIsKill = MI.getOperand(OpIdx).isKill(); |
| 675 | unsigned SrcReg = MI.getOperand(OpIdx++).getReg(); |
| 676 | // Copy the addrmode4 operands. |
| 677 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 678 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 679 | // Copy the predicate operands. |
| 680 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 681 | MIB.addOperand(MI.getOperand(OpIdx++)); |
| 682 | // Add the source operands (D subregs). |
| 683 | unsigned D0 = TRI->getSubReg(SrcReg, ARM::dsub_0); |
| 684 | unsigned D1 = TRI->getSubReg(SrcReg, ARM::dsub_1); |
| 685 | MIB.addReg(D0).addReg(D1); |
| 686 | if (SrcIsKill) |
| 687 | // Add an implicit kill for the Q register. |
| 688 | (*MIB).addRegisterKilled(SrcReg, TRI, true); |
| 689 | TransferImpOps(MI, MIB, MIB); |
| 690 | MI.eraseFromParent(); |
| 691 | break; |
| 692 | } |
| 693 | |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 694 | case ARM::VLD1q8Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 695 | case ARM::VLD1q16Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 696 | case ARM::VLD1q32Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 697 | case ARM::VLD1q64Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 698 | case ARM::VLD1q8Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 699 | case ARM::VLD1q16Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 700 | case ARM::VLD1q32Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 701 | case ARM::VLD1q64Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 702 | case ARM::VLD2d8Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 703 | case ARM::VLD2d16Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 704 | case ARM::VLD2d32Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 705 | case ARM::VLD2q8Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 706 | case ARM::VLD2q16Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 707 | case ARM::VLD2q32Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 708 | case ARM::VLD2d8Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 709 | case ARM::VLD2d16Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 710 | case ARM::VLD2d32Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 711 | case ARM::VLD2q8Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 712 | case ARM::VLD2q16Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 713 | case ARM::VLD2q32Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 714 | case ARM::VLD3d8Pseudo: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 715 | case ARM::VLD3d16Pseudo: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 716 | case ARM::VLD3d32Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 717 | case ARM::VLD1d64TPseudo: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 718 | case ARM::VLD3d8Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 719 | case ARM::VLD3d16Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 720 | case ARM::VLD3d32Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 721 | case ARM::VLD1d64TPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 722 | case ARM::VLD3q8Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 723 | case ARM::VLD3q16Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 724 | case ARM::VLD3q32Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 725 | case ARM::VLD3q8oddPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 726 | case ARM::VLD3q16oddPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 727 | case ARM::VLD3q32oddPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 728 | case ARM::VLD4d8Pseudo: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 729 | case ARM::VLD4d16Pseudo: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 730 | case ARM::VLD4d32Pseudo: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 731 | case ARM::VLD1d64QPseudo: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 732 | case ARM::VLD4d8Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 733 | case ARM::VLD4d16Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 734 | case ARM::VLD4d32Pseudo_UPD: |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 735 | case ARM::VLD1d64QPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 736 | case ARM::VLD4q8Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 737 | case ARM::VLD4q16Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 738 | case ARM::VLD4q32Pseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 739 | case ARM::VLD4q8oddPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 740 | case ARM::VLD4q16oddPseudo_UPD: |
Bob Wilson | f572191 | 2010-09-03 18:16:02 +0000 | [diff] [blame] | 741 | case ARM::VLD4q32oddPseudo_UPD: |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 742 | ExpandVLD(MBBI); |
| 743 | break; |
Bob Wilson | ffde080 | 2010-09-02 16:00:54 +0000 | [diff] [blame] | 744 | |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 745 | case ARM::VST1q8Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 746 | case ARM::VST1q16Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 747 | case ARM::VST1q32Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 748 | case ARM::VST1q64Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 749 | case ARM::VST1q8Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 750 | case ARM::VST1q16Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 751 | case ARM::VST1q32Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 752 | case ARM::VST1q64Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 753 | case ARM::VST2d8Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 754 | case ARM::VST2d16Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 755 | case ARM::VST2d32Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 756 | case ARM::VST2q8Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 757 | case ARM::VST2q16Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 758 | case ARM::VST2q32Pseudo: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 759 | case ARM::VST2d8Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 760 | case ARM::VST2d16Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 761 | case ARM::VST2d32Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 762 | case ARM::VST2q8Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 763 | case ARM::VST2q16Pseudo_UPD: |
Bob Wilson | e5ce4f6 | 2010-08-28 05:12:57 +0000 | [diff] [blame] | 764 | case ARM::VST2q32Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 765 | case ARM::VST3d8Pseudo: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 766 | case ARM::VST3d16Pseudo: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 767 | case ARM::VST3d32Pseudo: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 768 | case ARM::VST1d64TPseudo: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 769 | case ARM::VST3d8Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 770 | case ARM::VST3d16Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 771 | case ARM::VST3d32Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 772 | case ARM::VST1d64TPseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 773 | case ARM::VST3q8Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 774 | case ARM::VST3q16Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 775 | case ARM::VST3q32Pseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 776 | case ARM::VST3q8oddPseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 777 | case ARM::VST3q16oddPseudo_UPD: |
Bob Wilson | 01ba461 | 2010-08-26 18:51:29 +0000 | [diff] [blame] | 778 | case ARM::VST3q32oddPseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 779 | case ARM::VST4d8Pseudo: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 780 | case ARM::VST4d16Pseudo: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 781 | case ARM::VST4d32Pseudo: |
Bob Wilson | 70e48b2 | 2010-08-26 05:33:30 +0000 | [diff] [blame] | 782 | case ARM::VST1d64QPseudo: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 783 | case ARM::VST4d8Pseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 784 | case ARM::VST4d16Pseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 785 | case ARM::VST4d32Pseudo_UPD: |
Bob Wilson | 70e48b2 | 2010-08-26 05:33:30 +0000 | [diff] [blame] | 786 | case ARM::VST1d64QPseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 787 | case ARM::VST4q8Pseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 788 | case ARM::VST4q16Pseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 789 | case ARM::VST4q32Pseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 790 | case ARM::VST4q8oddPseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 791 | case ARM::VST4q16oddPseudo_UPD: |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 792 | case ARM::VST4q32oddPseudo_UPD: |
Bob Wilson | 8466fa1 | 2010-09-13 23:01:35 +0000 | [diff] [blame] | 793 | ExpandVST(MBBI); |
| 794 | break; |
| 795 | |
| 796 | case ARM::VLD2LNd8Pseudo: |
| 797 | case ARM::VLD2LNd16Pseudo: |
| 798 | case ARM::VLD2LNd32Pseudo: |
| 799 | case ARM::VLD2LNq16Pseudo: |
| 800 | case ARM::VLD2LNq32Pseudo: |
| 801 | case ARM::VLD2LNd8Pseudo_UPD: |
| 802 | case ARM::VLD2LNd16Pseudo_UPD: |
| 803 | case ARM::VLD2LNd32Pseudo_UPD: |
| 804 | case ARM::VLD2LNq16Pseudo_UPD: |
| 805 | case ARM::VLD2LNq32Pseudo_UPD: |
| 806 | case ARM::VLD3LNd8Pseudo: |
| 807 | case ARM::VLD3LNd16Pseudo: |
| 808 | case ARM::VLD3LNd32Pseudo: |
| 809 | case ARM::VLD3LNq16Pseudo: |
| 810 | case ARM::VLD3LNq32Pseudo: |
| 811 | case ARM::VLD3LNd8Pseudo_UPD: |
| 812 | case ARM::VLD3LNd16Pseudo_UPD: |
| 813 | case ARM::VLD3LNd32Pseudo_UPD: |
| 814 | case ARM::VLD3LNq16Pseudo_UPD: |
| 815 | case ARM::VLD3LNq32Pseudo_UPD: |
| 816 | case ARM::VLD4LNd8Pseudo: |
| 817 | case ARM::VLD4LNd16Pseudo: |
| 818 | case ARM::VLD4LNd32Pseudo: |
| 819 | case ARM::VLD4LNq16Pseudo: |
| 820 | case ARM::VLD4LNq32Pseudo: |
| 821 | case ARM::VLD4LNd8Pseudo_UPD: |
| 822 | case ARM::VLD4LNd16Pseudo_UPD: |
| 823 | case ARM::VLD4LNd32Pseudo_UPD: |
| 824 | case ARM::VLD4LNq16Pseudo_UPD: |
| 825 | case ARM::VLD4LNq32Pseudo_UPD: |
| 826 | case ARM::VST2LNd8Pseudo: |
| 827 | case ARM::VST2LNd16Pseudo: |
| 828 | case ARM::VST2LNd32Pseudo: |
| 829 | case ARM::VST2LNq16Pseudo: |
| 830 | case ARM::VST2LNq32Pseudo: |
| 831 | case ARM::VST2LNd8Pseudo_UPD: |
| 832 | case ARM::VST2LNd16Pseudo_UPD: |
| 833 | case ARM::VST2LNd32Pseudo_UPD: |
| 834 | case ARM::VST2LNq16Pseudo_UPD: |
| 835 | case ARM::VST2LNq32Pseudo_UPD: |
| 836 | case ARM::VST3LNd8Pseudo: |
| 837 | case ARM::VST3LNd16Pseudo: |
| 838 | case ARM::VST3LNd32Pseudo: |
| 839 | case ARM::VST3LNq16Pseudo: |
| 840 | case ARM::VST3LNq32Pseudo: |
| 841 | case ARM::VST3LNd8Pseudo_UPD: |
| 842 | case ARM::VST3LNd16Pseudo_UPD: |
| 843 | case ARM::VST3LNd32Pseudo_UPD: |
| 844 | case ARM::VST3LNq16Pseudo_UPD: |
| 845 | case ARM::VST3LNq32Pseudo_UPD: |
| 846 | case ARM::VST4LNd8Pseudo: |
| 847 | case ARM::VST4LNd16Pseudo: |
| 848 | case ARM::VST4LNd32Pseudo: |
| 849 | case ARM::VST4LNq16Pseudo: |
| 850 | case ARM::VST4LNq32Pseudo: |
| 851 | case ARM::VST4LNd8Pseudo_UPD: |
| 852 | case ARM::VST4LNd16Pseudo_UPD: |
| 853 | case ARM::VST4LNd32Pseudo_UPD: |
| 854 | case ARM::VST4LNq16Pseudo_UPD: |
| 855 | case ARM::VST4LNq32Pseudo_UPD: |
| 856 | ExpandLaneOp(MBBI); |
| 857 | break; |
Bob Wilson | bd916c5 | 2010-09-13 23:55:10 +0000 | [diff] [blame] | 858 | |
| 859 | case ARM::VTBL2Pseudo: |
| 860 | ExpandVTBL(MBBI, ARM::VTBL2, false, 2); break; |
| 861 | case ARM::VTBL3Pseudo: |
| 862 | ExpandVTBL(MBBI, ARM::VTBL3, false, 3); break; |
| 863 | case ARM::VTBL4Pseudo: |
| 864 | ExpandVTBL(MBBI, ARM::VTBL4, false, 4); break; |
| 865 | case ARM::VTBX2Pseudo: |
| 866 | ExpandVTBL(MBBI, ARM::VTBX2, true, 2); break; |
| 867 | case ARM::VTBX3Pseudo: |
| 868 | ExpandVTBL(MBBI, ARM::VTBX3, true, 3); break; |
| 869 | case ARM::VTBX4Pseudo: |
| 870 | ExpandVTBL(MBBI, ARM::VTBX4, true, 4); break; |
Bob Wilson | 709d592 | 2010-08-25 23:27:42 +0000 | [diff] [blame] | 871 | } |
| 872 | |
| 873 | if (ModifiedOp) |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 874 | Modified = true; |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 875 | MBBI = NMBBI; |
| 876 | } |
| 877 | |
| 878 | return Modified; |
| 879 | } |
| 880 | |
| 881 | bool ARMExpandPseudo::runOnMachineFunction(MachineFunction &MF) { |
| 882 | TII = MF.getTarget().getInstrInfo(); |
Evan Cheng | d929f77 | 2010-05-13 00:17:02 +0000 | [diff] [blame] | 883 | TRI = MF.getTarget().getRegisterInfo(); |
Evan Cheng | b9803a8 | 2009-11-06 23:52:48 +0000 | [diff] [blame] | 884 | |
| 885 | bool Modified = false; |
| 886 | for (MachineFunction::iterator MFI = MF.begin(), E = MF.end(); MFI != E; |
| 887 | ++MFI) |
| 888 | Modified |= ExpandMBB(*MFI); |
| 889 | return Modified; |
| 890 | } |
| 891 | |
| 892 | /// createARMExpandPseudoPass - returns an instance of the pseudo instruction |
| 893 | /// expansion pass. |
| 894 | FunctionPass *llvm::createARMExpandPseudoPass() { |
| 895 | return new ARMExpandPseudo(); |
| 896 | } |