Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- HexagonInstrInfo.cpp - Hexagon Instruction Information ------------===// |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 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 the Hexagon implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 14 | #include "HexagonInstrInfo.h" |
Craig Topper | 79aa341 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 15 | #include "HexagonRegisterInfo.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 16 | #include "HexagonSubtarget.h" |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 17 | #include "Hexagon.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 18 | #include "llvm/ADT/STLExtras.h" |
| 19 | #include "llvm/ADT/SmallVector.h" |
Benjamin Kramer | f3fd7ee | 2012-02-06 10:19:29 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/DFAPacketizer.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 21 | #include "llvm/CodeGen/MachineInstrBuilder.h" |
| 22 | #include "llvm/CodeGen/MachineRegisterInfo.h" |
| 23 | #include "llvm/CodeGen/MachineFrameInfo.h" |
| 24 | #include "llvm/CodeGen/MachineMemOperand.h" |
| 25 | #include "llvm/CodeGen/PseudoSourceValue.h" |
Benjamin Kramer | f3fd7ee | 2012-02-06 10:19:29 +0000 | [diff] [blame] | 26 | #include "llvm/Support/MathExtras.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 27 | #define GET_INSTRINFO_CTOR |
| 28 | #include "HexagonGenInstrInfo.inc" |
Andrew Trick | ee498d3 | 2012-02-01 22:13:57 +0000 | [diff] [blame] | 29 | #include "HexagonGenDFAPacketizer.inc" |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 30 | #include "HexagonConstExtInfo.h" |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 31 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 32 | using namespace llvm; |
| 33 | |
| 34 | /// |
| 35 | /// Constants for Hexagon instructions. |
| 36 | /// |
| 37 | const int Hexagon_MEMW_OFFSET_MAX = 4095; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 38 | const int Hexagon_MEMW_OFFSET_MIN = -4096; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 39 | const int Hexagon_MEMD_OFFSET_MAX = 8191; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 40 | const int Hexagon_MEMD_OFFSET_MIN = -8192; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 41 | const int Hexagon_MEMH_OFFSET_MAX = 2047; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 42 | const int Hexagon_MEMH_OFFSET_MIN = -2048; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 43 | const int Hexagon_MEMB_OFFSET_MAX = 1023; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 44 | const int Hexagon_MEMB_OFFSET_MIN = -1024; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 45 | const int Hexagon_ADDI_OFFSET_MAX = 32767; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 46 | const int Hexagon_ADDI_OFFSET_MIN = -32768; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 47 | const int Hexagon_MEMD_AUTOINC_MAX = 56; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 48 | const int Hexagon_MEMD_AUTOINC_MIN = -64; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 49 | const int Hexagon_MEMW_AUTOINC_MAX = 28; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 50 | const int Hexagon_MEMW_AUTOINC_MIN = -32; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 51 | const int Hexagon_MEMH_AUTOINC_MAX = 14; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 52 | const int Hexagon_MEMH_AUTOINC_MIN = -16; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 53 | const int Hexagon_MEMB_AUTOINC_MAX = 7; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 54 | const int Hexagon_MEMB_AUTOINC_MIN = -8; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 55 | |
| 56 | |
| 57 | HexagonInstrInfo::HexagonInstrInfo(HexagonSubtarget &ST) |
| 58 | : HexagonGenInstrInfo(Hexagon::ADJCALLSTACKDOWN, Hexagon::ADJCALLSTACKUP), |
| 59 | RI(ST, *this), Subtarget(ST) { |
| 60 | } |
| 61 | |
| 62 | |
| 63 | /// isLoadFromStackSlot - If the specified machine instruction is a direct |
| 64 | /// load from a stack slot, return the virtual or physical register number of |
| 65 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 66 | /// not, return 0. This predicate must return 0 if the instruction has |
| 67 | /// any side effects other than loading from the stack slot. |
| 68 | unsigned HexagonInstrInfo::isLoadFromStackSlot(const MachineInstr *MI, |
| 69 | int &FrameIndex) const { |
| 70 | |
| 71 | |
| 72 | switch (MI->getOpcode()) { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 73 | default: break; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 74 | case Hexagon::LDriw: |
| 75 | case Hexagon::LDrid: |
| 76 | case Hexagon::LDrih: |
| 77 | case Hexagon::LDrib: |
| 78 | case Hexagon::LDriub: |
| 79 | if (MI->getOperand(2).isFI() && |
| 80 | MI->getOperand(1).isImm() && (MI->getOperand(1).getImm() == 0)) { |
| 81 | FrameIndex = MI->getOperand(2).getIndex(); |
| 82 | return MI->getOperand(0).getReg(); |
| 83 | } |
| 84 | break; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 85 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 86 | return 0; |
| 87 | } |
| 88 | |
| 89 | |
| 90 | /// isStoreToStackSlot - If the specified machine instruction is a direct |
| 91 | /// store to a stack slot, return the virtual or physical register number of |
| 92 | /// the source reg along with the FrameIndex of the loaded stack slot. If |
| 93 | /// not, return 0. This predicate must return 0 if the instruction has |
| 94 | /// any side effects other than storing to the stack slot. |
| 95 | unsigned HexagonInstrInfo::isStoreToStackSlot(const MachineInstr *MI, |
| 96 | int &FrameIndex) const { |
| 97 | switch (MI->getOpcode()) { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 98 | default: break; |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 99 | case Hexagon::STriw_indexed: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 100 | case Hexagon::STriw: |
| 101 | case Hexagon::STrid: |
| 102 | case Hexagon::STrih: |
| 103 | case Hexagon::STrib: |
| 104 | if (MI->getOperand(2).isFI() && |
| 105 | MI->getOperand(1).isImm() && (MI->getOperand(1).getImm() == 0)) { |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 106 | FrameIndex = MI->getOperand(0).getIndex(); |
| 107 | return MI->getOperand(2).getReg(); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 108 | } |
| 109 | break; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 110 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 111 | return 0; |
| 112 | } |
| 113 | |
| 114 | |
| 115 | unsigned |
| 116 | HexagonInstrInfo::InsertBranch(MachineBasicBlock &MBB,MachineBasicBlock *TBB, |
| 117 | MachineBasicBlock *FBB, |
| 118 | const SmallVectorImpl<MachineOperand> &Cond, |
| 119 | DebugLoc DL) const{ |
| 120 | |
| 121 | int BOpc = Hexagon::JMP; |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 122 | int BccOpc = Hexagon::JMP_c; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 123 | |
| 124 | assert(TBB && "InsertBranch must not be told to insert a fallthrough"); |
| 125 | |
| 126 | int regPos = 0; |
| 127 | // Check if ReverseBranchCondition has asked to reverse this branch |
| 128 | // If we want to reverse the branch an odd number of times, we want |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 129 | // JMP_cNot. |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 130 | if (!Cond.empty() && Cond[0].isImm() && Cond[0].getImm() == 0) { |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 131 | BccOpc = Hexagon::JMP_cNot; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 132 | regPos = 1; |
| 133 | } |
| 134 | |
| 135 | if (FBB == 0) { |
| 136 | if (Cond.empty()) { |
| 137 | // Due to a bug in TailMerging/CFG Optimization, we need to add a |
| 138 | // special case handling of a predicated jump followed by an |
| 139 | // unconditional jump. If not, Tail Merging and CFG Optimization go |
| 140 | // into an infinite loop. |
| 141 | MachineBasicBlock *NewTBB, *NewFBB; |
| 142 | SmallVector<MachineOperand, 4> Cond; |
| 143 | MachineInstr *Term = MBB.getFirstTerminator(); |
| 144 | if (isPredicated(Term) && !AnalyzeBranch(MBB, NewTBB, NewFBB, Cond, |
| 145 | false)) { |
| 146 | MachineBasicBlock *NextBB = |
| 147 | llvm::next(MachineFunction::iterator(&MBB)); |
| 148 | if (NewTBB == NextBB) { |
| 149 | ReverseBranchCondition(Cond); |
| 150 | RemoveBranch(MBB); |
| 151 | return InsertBranch(MBB, TBB, 0, Cond, DL); |
| 152 | } |
| 153 | } |
| 154 | BuildMI(&MBB, DL, get(BOpc)).addMBB(TBB); |
| 155 | } else { |
| 156 | BuildMI(&MBB, DL, |
| 157 | get(BccOpc)).addReg(Cond[regPos].getReg()).addMBB(TBB); |
| 158 | } |
| 159 | return 1; |
| 160 | } |
| 161 | |
| 162 | BuildMI(&MBB, DL, get(BccOpc)).addReg(Cond[regPos].getReg()).addMBB(TBB); |
| 163 | BuildMI(&MBB, DL, get(BOpc)).addMBB(FBB); |
| 164 | |
| 165 | return 2; |
| 166 | } |
| 167 | |
| 168 | |
| 169 | bool HexagonInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, |
| 170 | MachineBasicBlock *&TBB, |
| 171 | MachineBasicBlock *&FBB, |
| 172 | SmallVectorImpl<MachineOperand> &Cond, |
| 173 | bool AllowModify) const { |
Benjamin Kramer | 51b49c5 | 2012-05-13 15:13:22 +0000 | [diff] [blame^] | 174 | TBB = NULL; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 175 | FBB = NULL; |
| 176 | |
| 177 | // If the block has no terminators, it just falls into the block after it. |
| 178 | MachineBasicBlock::iterator I = MBB.end(); |
| 179 | if (I == MBB.begin()) |
| 180 | return false; |
| 181 | |
| 182 | // A basic block may looks like this: |
| 183 | // |
| 184 | // [ insn |
| 185 | // EH_LABEL |
| 186 | // insn |
| 187 | // insn |
| 188 | // insn |
| 189 | // EH_LABEL |
| 190 | // insn ] |
| 191 | // |
| 192 | // It has two succs but does not have a terminator |
| 193 | // Don't know how to handle it. |
| 194 | do { |
| 195 | --I; |
| 196 | if (I->isEHLabel()) |
| 197 | return true; |
| 198 | } while (I != MBB.begin()); |
| 199 | |
| 200 | I = MBB.end(); |
| 201 | --I; |
| 202 | |
| 203 | while (I->isDebugValue()) { |
| 204 | if (I == MBB.begin()) |
| 205 | return false; |
| 206 | --I; |
| 207 | } |
| 208 | if (!isUnpredicatedTerminator(I)) |
| 209 | return false; |
| 210 | |
| 211 | // Get the last instruction in the block. |
| 212 | MachineInstr *LastInst = I; |
| 213 | |
| 214 | // If there is only one terminator instruction, process it. |
| 215 | if (I == MBB.begin() || !isUnpredicatedTerminator(--I)) { |
| 216 | if (LastInst->getOpcode() == Hexagon::JMP) { |
| 217 | TBB = LastInst->getOperand(0).getMBB(); |
| 218 | return false; |
| 219 | } |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 220 | if (LastInst->getOpcode() == Hexagon::JMP_c) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 221 | // Block ends with fall-through true condbranch. |
| 222 | TBB = LastInst->getOperand(1).getMBB(); |
| 223 | Cond.push_back(LastInst->getOperand(0)); |
| 224 | return false; |
| 225 | } |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 226 | if (LastInst->getOpcode() == Hexagon::JMP_cNot) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 227 | // Block ends with fall-through false condbranch. |
| 228 | TBB = LastInst->getOperand(1).getMBB(); |
| 229 | Cond.push_back(MachineOperand::CreateImm(0)); |
| 230 | Cond.push_back(LastInst->getOperand(0)); |
| 231 | return false; |
| 232 | } |
| 233 | // Otherwise, don't know what this is. |
| 234 | return true; |
| 235 | } |
| 236 | |
| 237 | // Get the instruction before it if it's a terminator. |
| 238 | MachineInstr *SecondLastInst = I; |
| 239 | |
| 240 | // If there are three terminators, we don't know what sort of block this is. |
| 241 | if (SecondLastInst && I != MBB.begin() && |
| 242 | isUnpredicatedTerminator(--I)) |
| 243 | return true; |
| 244 | |
| 245 | // If the block ends with Hexagon::BRCOND and Hexagon:JMP, handle it. |
| 246 | if (((SecondLastInst->getOpcode() == Hexagon::BRCOND) || |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 247 | (SecondLastInst->getOpcode() == Hexagon::JMP_c)) && |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 248 | LastInst->getOpcode() == Hexagon::JMP) { |
| 249 | TBB = SecondLastInst->getOperand(1).getMBB(); |
| 250 | Cond.push_back(SecondLastInst->getOperand(0)); |
| 251 | FBB = LastInst->getOperand(0).getMBB(); |
| 252 | return false; |
| 253 | } |
| 254 | |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 255 | // If the block ends with Hexagon::JMP_cNot and Hexagon:JMP, handle it. |
| 256 | if ((SecondLastInst->getOpcode() == Hexagon::JMP_cNot) && |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 257 | LastInst->getOpcode() == Hexagon::JMP) { |
| 258 | TBB = SecondLastInst->getOperand(1).getMBB(); |
| 259 | Cond.push_back(MachineOperand::CreateImm(0)); |
| 260 | Cond.push_back(SecondLastInst->getOperand(0)); |
| 261 | FBB = LastInst->getOperand(0).getMBB(); |
| 262 | return false; |
| 263 | } |
| 264 | |
| 265 | // If the block ends with two Hexagon:JMPs, handle it. The second one is not |
| 266 | // executed, so remove it. |
| 267 | if (SecondLastInst->getOpcode() == Hexagon::JMP && |
| 268 | LastInst->getOpcode() == Hexagon::JMP) { |
| 269 | TBB = SecondLastInst->getOperand(0).getMBB(); |
| 270 | I = LastInst; |
| 271 | if (AllowModify) |
| 272 | I->eraseFromParent(); |
| 273 | return false; |
| 274 | } |
| 275 | |
| 276 | // Otherwise, can't handle this. |
| 277 | return true; |
| 278 | } |
| 279 | |
| 280 | |
| 281 | unsigned HexagonInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const { |
| 282 | int BOpc = Hexagon::JMP; |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 283 | int BccOpc = Hexagon::JMP_c; |
| 284 | int BccOpcNot = Hexagon::JMP_cNot; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 285 | |
| 286 | MachineBasicBlock::iterator I = MBB.end(); |
| 287 | if (I == MBB.begin()) return 0; |
| 288 | --I; |
| 289 | if (I->getOpcode() != BOpc && I->getOpcode() != BccOpc && |
| 290 | I->getOpcode() != BccOpcNot) |
| 291 | return 0; |
| 292 | |
| 293 | // Remove the branch. |
| 294 | I->eraseFromParent(); |
| 295 | |
| 296 | I = MBB.end(); |
| 297 | |
| 298 | if (I == MBB.begin()) return 1; |
| 299 | --I; |
| 300 | if (I->getOpcode() != BccOpc && I->getOpcode() != BccOpcNot) |
| 301 | return 1; |
| 302 | |
| 303 | // Remove the branch. |
| 304 | I->eraseFromParent(); |
| 305 | return 2; |
| 306 | } |
| 307 | |
| 308 | |
| 309 | void HexagonInstrInfo::copyPhysReg(MachineBasicBlock &MBB, |
| 310 | MachineBasicBlock::iterator I, DebugLoc DL, |
| 311 | unsigned DestReg, unsigned SrcReg, |
| 312 | bool KillSrc) const { |
| 313 | if (Hexagon::IntRegsRegClass.contains(SrcReg, DestReg)) { |
| 314 | BuildMI(MBB, I, DL, get(Hexagon::TFR), DestReg).addReg(SrcReg); |
| 315 | return; |
| 316 | } |
| 317 | if (Hexagon::DoubleRegsRegClass.contains(SrcReg, DestReg)) { |
| 318 | BuildMI(MBB, I, DL, get(Hexagon::TFR_64), DestReg).addReg(SrcReg); |
| 319 | return; |
| 320 | } |
| 321 | if (Hexagon::PredRegsRegClass.contains(SrcReg, DestReg)) { |
| 322 | // Map Pd = Ps to Pd = or(Ps, Ps). |
| 323 | BuildMI(MBB, I, DL, get(Hexagon::OR_pp), |
| 324 | DestReg).addReg(SrcReg).addReg(SrcReg); |
| 325 | return; |
| 326 | } |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 327 | if (Hexagon::DoubleRegsRegClass.contains(DestReg) && |
| 328 | Hexagon::IntRegsRegClass.contains(SrcReg)) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 329 | // We can have an overlap between single and double reg: r1:0 = r0. |
| 330 | if(SrcReg == RI.getSubReg(DestReg, Hexagon::subreg_loreg)) { |
| 331 | // r1:0 = r0 |
| 332 | BuildMI(MBB, I, DL, get(Hexagon::TFRI), (RI.getSubReg(DestReg, |
| 333 | Hexagon::subreg_hireg))).addImm(0); |
| 334 | } else { |
| 335 | // r1:0 = r1 or no overlap. |
| 336 | BuildMI(MBB, I, DL, get(Hexagon::TFR), (RI.getSubReg(DestReg, |
| 337 | Hexagon::subreg_loreg))).addReg(SrcReg); |
| 338 | BuildMI(MBB, I, DL, get(Hexagon::TFRI), (RI.getSubReg(DestReg, |
| 339 | Hexagon::subreg_hireg))).addImm(0); |
| 340 | } |
| 341 | return; |
| 342 | } |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 343 | if (Hexagon::CRRegsRegClass.contains(DestReg) && |
| 344 | Hexagon::IntRegsRegClass.contains(SrcReg)) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 345 | BuildMI(MBB, I, DL, get(Hexagon::TFCR), DestReg).addReg(SrcReg); |
| 346 | return; |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 347 | } |
| 348 | |
| 349 | llvm_unreachable("Unimplemented"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | |
| 353 | void HexagonInstrInfo:: |
| 354 | storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
| 355 | unsigned SrcReg, bool isKill, int FI, |
| 356 | const TargetRegisterClass *RC, |
| 357 | const TargetRegisterInfo *TRI) const { |
| 358 | |
| 359 | DebugLoc DL = MBB.findDebugLoc(I); |
| 360 | MachineFunction &MF = *MBB.getParent(); |
| 361 | MachineFrameInfo &MFI = *MF.getFrameInfo(); |
| 362 | unsigned Align = MFI.getObjectAlignment(FI); |
| 363 | |
| 364 | MachineMemOperand *MMO = |
| 365 | MF.getMachineMemOperand( |
| 366 | MachinePointerInfo(PseudoSourceValue::getFixedStack(FI)), |
| 367 | MachineMemOperand::MOStore, |
| 368 | MFI.getObjectSize(FI), |
| 369 | Align); |
| 370 | |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 371 | if (Hexagon::IntRegsRegClass.hasSubClassEq(RC)) { |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 372 | BuildMI(MBB, I, DL, get(Hexagon::STriw_indexed)) |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 373 | .addFrameIndex(FI).addImm(0) |
| 374 | .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 375 | } else if (Hexagon::DoubleRegsRegClass.hasSubClassEq(RC)) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 376 | BuildMI(MBB, I, DL, get(Hexagon::STrid)) |
| 377 | .addFrameIndex(FI).addImm(0) |
| 378 | .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 379 | } else if (Hexagon::PredRegsRegClass.hasSubClassEq(RC)) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 380 | BuildMI(MBB, I, DL, get(Hexagon::STriw_pred)) |
| 381 | .addFrameIndex(FI).addImm(0) |
| 382 | .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO); |
| 383 | } else { |
Craig Topper | bc21981 | 2012-02-07 02:50:20 +0000 | [diff] [blame] | 384 | llvm_unreachable("Unimplemented"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 385 | } |
| 386 | } |
| 387 | |
| 388 | |
| 389 | void HexagonInstrInfo::storeRegToAddr( |
| 390 | MachineFunction &MF, unsigned SrcReg, |
| 391 | bool isKill, |
| 392 | SmallVectorImpl<MachineOperand> &Addr, |
| 393 | const TargetRegisterClass *RC, |
| 394 | SmallVectorImpl<MachineInstr*> &NewMIs) const |
| 395 | { |
Craig Topper | bc21981 | 2012-02-07 02:50:20 +0000 | [diff] [blame] | 396 | llvm_unreachable("Unimplemented"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | |
| 400 | void HexagonInstrInfo:: |
| 401 | loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
| 402 | unsigned DestReg, int FI, |
| 403 | const TargetRegisterClass *RC, |
| 404 | const TargetRegisterInfo *TRI) const { |
| 405 | DebugLoc DL = MBB.findDebugLoc(I); |
| 406 | MachineFunction &MF = *MBB.getParent(); |
| 407 | MachineFrameInfo &MFI = *MF.getFrameInfo(); |
| 408 | unsigned Align = MFI.getObjectAlignment(FI); |
| 409 | |
| 410 | MachineMemOperand *MMO = |
| 411 | MF.getMachineMemOperand( |
| 412 | MachinePointerInfo(PseudoSourceValue::getFixedStack(FI)), |
| 413 | MachineMemOperand::MOLoad, |
| 414 | MFI.getObjectSize(FI), |
| 415 | Align); |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 416 | if (RC == &Hexagon::IntRegsRegClass) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 417 | BuildMI(MBB, I, DL, get(Hexagon::LDriw), DestReg) |
| 418 | .addFrameIndex(FI).addImm(0).addMemOperand(MMO); |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 419 | } else if (RC == &Hexagon::DoubleRegsRegClass) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 420 | BuildMI(MBB, I, DL, get(Hexagon::LDrid), DestReg) |
| 421 | .addFrameIndex(FI).addImm(0).addMemOperand(MMO); |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 422 | } else if (RC == &Hexagon::PredRegsRegClass) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 423 | BuildMI(MBB, I, DL, get(Hexagon::LDriw_pred), DestReg) |
| 424 | .addFrameIndex(FI).addImm(0).addMemOperand(MMO); |
| 425 | } else { |
Craig Topper | bc21981 | 2012-02-07 02:50:20 +0000 | [diff] [blame] | 426 | llvm_unreachable("Can't store this register to stack slot"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 427 | } |
| 428 | } |
| 429 | |
| 430 | |
| 431 | void HexagonInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, |
| 432 | SmallVectorImpl<MachineOperand> &Addr, |
| 433 | const TargetRegisterClass *RC, |
| 434 | SmallVectorImpl<MachineInstr*> &NewMIs) const { |
Craig Topper | bc21981 | 2012-02-07 02:50:20 +0000 | [diff] [blame] | 435 | llvm_unreachable("Unimplemented"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 436 | } |
| 437 | |
| 438 | |
| 439 | MachineInstr *HexagonInstrInfo::foldMemoryOperandImpl(MachineFunction &MF, |
| 440 | MachineInstr* MI, |
| 441 | const SmallVectorImpl<unsigned> &Ops, |
| 442 | int FI) const { |
| 443 | // Hexagon_TODO: Implement. |
| 444 | return(0); |
| 445 | } |
| 446 | |
| 447 | |
| 448 | unsigned HexagonInstrInfo::createVR(MachineFunction* MF, MVT VT) const { |
| 449 | |
| 450 | MachineRegisterInfo &RegInfo = MF->getRegInfo(); |
| 451 | const TargetRegisterClass *TRC; |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 452 | if (VT == MVT::i1) { |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 453 | TRC = &Hexagon::PredRegsRegClass; |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 454 | } else if (VT == MVT::i32 || VT == MVT::f32) { |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 455 | TRC = &Hexagon::IntRegsRegClass; |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 456 | } else if (VT == MVT::i64 || VT == MVT::f64) { |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 457 | TRC = &Hexagon::DoubleRegsRegClass; |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 458 | } else { |
Benjamin Kramer | 27baab6 | 2011-12-27 11:41:05 +0000 | [diff] [blame] | 459 | llvm_unreachable("Cannot handle this register class"); |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 460 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 461 | |
| 462 | unsigned NewReg = RegInfo.createVirtualRegister(TRC); |
| 463 | return NewReg; |
| 464 | } |
| 465 | |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 466 | bool HexagonInstrInfo::isExtendable(const MachineInstr *MI) const { |
| 467 | switch(MI->getOpcode()) { |
| 468 | default: return false; |
| 469 | // JMP_EQri |
| 470 | case Hexagon::JMP_EQriPt_nv_V4: |
| 471 | case Hexagon::JMP_EQriPnt_nv_V4: |
| 472 | case Hexagon::JMP_EQriNotPt_nv_V4: |
| 473 | case Hexagon::JMP_EQriNotPnt_nv_V4: |
Sirish Pande | 0dac391 | 2012-04-23 17:49:20 +0000 | [diff] [blame] | 474 | |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 475 | // JMP_EQri - with -1 |
| 476 | case Hexagon::JMP_EQriPtneg_nv_V4: |
| 477 | case Hexagon::JMP_EQriPntneg_nv_V4: |
| 478 | case Hexagon::JMP_EQriNotPtneg_nv_V4: |
| 479 | case Hexagon::JMP_EQriNotPntneg_nv_V4: |
| 480 | |
| 481 | // JMP_EQrr |
| 482 | case Hexagon::JMP_EQrrPt_nv_V4: |
| 483 | case Hexagon::JMP_EQrrPnt_nv_V4: |
| 484 | case Hexagon::JMP_EQrrNotPt_nv_V4: |
| 485 | case Hexagon::JMP_EQrrNotPnt_nv_V4: |
| 486 | |
| 487 | // JMP_GTri |
| 488 | case Hexagon::JMP_GTriPt_nv_V4: |
| 489 | case Hexagon::JMP_GTriPnt_nv_V4: |
| 490 | case Hexagon::JMP_GTriNotPt_nv_V4: |
| 491 | case Hexagon::JMP_GTriNotPnt_nv_V4: |
| 492 | |
| 493 | // JMP_GTri - with -1 |
| 494 | case Hexagon::JMP_GTriPtneg_nv_V4: |
| 495 | case Hexagon::JMP_GTriPntneg_nv_V4: |
| 496 | case Hexagon::JMP_GTriNotPtneg_nv_V4: |
| 497 | case Hexagon::JMP_GTriNotPntneg_nv_V4: |
| 498 | |
| 499 | // JMP_GTrr |
| 500 | case Hexagon::JMP_GTrrPt_nv_V4: |
| 501 | case Hexagon::JMP_GTrrPnt_nv_V4: |
| 502 | case Hexagon::JMP_GTrrNotPt_nv_V4: |
| 503 | case Hexagon::JMP_GTrrNotPnt_nv_V4: |
| 504 | |
| 505 | // JMP_GTrrdn |
| 506 | case Hexagon::JMP_GTrrdnPt_nv_V4: |
| 507 | case Hexagon::JMP_GTrrdnPnt_nv_V4: |
| 508 | case Hexagon::JMP_GTrrdnNotPt_nv_V4: |
| 509 | case Hexagon::JMP_GTrrdnNotPnt_nv_V4: |
| 510 | |
| 511 | // JMP_GTUri |
| 512 | case Hexagon::JMP_GTUriPt_nv_V4: |
| 513 | case Hexagon::JMP_GTUriPnt_nv_V4: |
| 514 | case Hexagon::JMP_GTUriNotPt_nv_V4: |
| 515 | case Hexagon::JMP_GTUriNotPnt_nv_V4: |
| 516 | |
| 517 | // JMP_GTUrr |
| 518 | case Hexagon::JMP_GTUrrPt_nv_V4: |
| 519 | case Hexagon::JMP_GTUrrPnt_nv_V4: |
| 520 | case Hexagon::JMP_GTUrrNotPt_nv_V4: |
| 521 | case Hexagon::JMP_GTUrrNotPnt_nv_V4: |
| 522 | |
| 523 | // JMP_GTUrrdn |
| 524 | case Hexagon::JMP_GTUrrdnPt_nv_V4: |
| 525 | case Hexagon::JMP_GTUrrdnPnt_nv_V4: |
| 526 | case Hexagon::JMP_GTUrrdnNotPt_nv_V4: |
| 527 | case Hexagon::JMP_GTUrrdnNotPnt_nv_V4: |
| 528 | |
| 529 | // TFR_FI |
| 530 | case Hexagon::TFR_FI: |
| 531 | return true; |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | bool HexagonInstrInfo::isExtended(const MachineInstr *MI) const { |
| 536 | switch(MI->getOpcode()) { |
| 537 | default: return false; |
| 538 | // JMP_EQri |
| 539 | case Hexagon::JMP_EQriPt_ie_nv_V4: |
| 540 | case Hexagon::JMP_EQriPnt_ie_nv_V4: |
| 541 | case Hexagon::JMP_EQriNotPt_ie_nv_V4: |
| 542 | case Hexagon::JMP_EQriNotPnt_ie_nv_V4: |
| 543 | |
| 544 | // JMP_EQri - with -1 |
| 545 | case Hexagon::JMP_EQriPtneg_ie_nv_V4: |
| 546 | case Hexagon::JMP_EQriPntneg_ie_nv_V4: |
| 547 | case Hexagon::JMP_EQriNotPtneg_ie_nv_V4: |
| 548 | case Hexagon::JMP_EQriNotPntneg_ie_nv_V4: |
| 549 | |
| 550 | // JMP_EQrr |
| 551 | case Hexagon::JMP_EQrrPt_ie_nv_V4: |
| 552 | case Hexagon::JMP_EQrrPnt_ie_nv_V4: |
| 553 | case Hexagon::JMP_EQrrNotPt_ie_nv_V4: |
| 554 | case Hexagon::JMP_EQrrNotPnt_ie_nv_V4: |
| 555 | |
| 556 | // JMP_GTri |
| 557 | case Hexagon::JMP_GTriPt_ie_nv_V4: |
| 558 | case Hexagon::JMP_GTriPnt_ie_nv_V4: |
| 559 | case Hexagon::JMP_GTriNotPt_ie_nv_V4: |
| 560 | case Hexagon::JMP_GTriNotPnt_ie_nv_V4: |
| 561 | |
| 562 | // JMP_GTri - with -1 |
| 563 | case Hexagon::JMP_GTriPtneg_ie_nv_V4: |
| 564 | case Hexagon::JMP_GTriPntneg_ie_nv_V4: |
| 565 | case Hexagon::JMP_GTriNotPtneg_ie_nv_V4: |
| 566 | case Hexagon::JMP_GTriNotPntneg_ie_nv_V4: |
| 567 | |
| 568 | // JMP_GTrr |
| 569 | case Hexagon::JMP_GTrrPt_ie_nv_V4: |
| 570 | case Hexagon::JMP_GTrrPnt_ie_nv_V4: |
| 571 | case Hexagon::JMP_GTrrNotPt_ie_nv_V4: |
| 572 | case Hexagon::JMP_GTrrNotPnt_ie_nv_V4: |
| 573 | |
| 574 | // JMP_GTrrdn |
| 575 | case Hexagon::JMP_GTrrdnPt_ie_nv_V4: |
| 576 | case Hexagon::JMP_GTrrdnPnt_ie_nv_V4: |
| 577 | case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4: |
| 578 | case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4: |
| 579 | |
| 580 | // JMP_GTUri |
| 581 | case Hexagon::JMP_GTUriPt_ie_nv_V4: |
| 582 | case Hexagon::JMP_GTUriPnt_ie_nv_V4: |
| 583 | case Hexagon::JMP_GTUriNotPt_ie_nv_V4: |
| 584 | case Hexagon::JMP_GTUriNotPnt_ie_nv_V4: |
| 585 | |
| 586 | // JMP_GTUrr |
| 587 | case Hexagon::JMP_GTUrrPt_ie_nv_V4: |
| 588 | case Hexagon::JMP_GTUrrPnt_ie_nv_V4: |
| 589 | case Hexagon::JMP_GTUrrNotPt_ie_nv_V4: |
| 590 | case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4: |
| 591 | |
| 592 | // JMP_GTUrrdn |
| 593 | case Hexagon::JMP_GTUrrdnPt_ie_nv_V4: |
| 594 | case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4: |
| 595 | case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4: |
| 596 | case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4: |
| 597 | |
| 598 | // V4 absolute set addressing. |
| 599 | case Hexagon::LDrid_abs_setimm_V4: |
| 600 | case Hexagon::LDriw_abs_setimm_V4: |
| 601 | case Hexagon::LDrih_abs_setimm_V4: |
| 602 | case Hexagon::LDrib_abs_setimm_V4: |
| 603 | case Hexagon::LDriuh_abs_setimm_V4: |
| 604 | case Hexagon::LDriub_abs_setimm_V4: |
| 605 | |
| 606 | case Hexagon::STrid_abs_setimm_V4: |
| 607 | case Hexagon::STrib_abs_setimm_V4: |
| 608 | case Hexagon::STrih_abs_setimm_V4: |
| 609 | case Hexagon::STriw_abs_setimm_V4: |
| 610 | |
| 611 | // V4 global address load. |
| 612 | case Hexagon::LDrid_GP_cPt_V4 : |
| 613 | case Hexagon::LDrid_GP_cNotPt_V4 : |
| 614 | case Hexagon::LDrid_GP_cdnPt_V4 : |
| 615 | case Hexagon::LDrid_GP_cdnNotPt_V4 : |
| 616 | case Hexagon::LDrib_GP_cPt_V4 : |
| 617 | case Hexagon::LDrib_GP_cNotPt_V4 : |
| 618 | case Hexagon::LDrib_GP_cdnPt_V4 : |
| 619 | case Hexagon::LDrib_GP_cdnNotPt_V4 : |
| 620 | case Hexagon::LDriub_GP_cPt_V4 : |
| 621 | case Hexagon::LDriub_GP_cNotPt_V4 : |
| 622 | case Hexagon::LDriub_GP_cdnPt_V4 : |
| 623 | case Hexagon::LDriub_GP_cdnNotPt_V4 : |
| 624 | case Hexagon::LDrih_GP_cPt_V4 : |
| 625 | case Hexagon::LDrih_GP_cNotPt_V4 : |
| 626 | case Hexagon::LDrih_GP_cdnPt_V4 : |
| 627 | case Hexagon::LDrih_GP_cdnNotPt_V4 : |
| 628 | case Hexagon::LDriuh_GP_cPt_V4 : |
| 629 | case Hexagon::LDriuh_GP_cNotPt_V4 : |
| 630 | case Hexagon::LDriuh_GP_cdnPt_V4 : |
| 631 | case Hexagon::LDriuh_GP_cdnNotPt_V4 : |
| 632 | case Hexagon::LDriw_GP_cPt_V4 : |
| 633 | case Hexagon::LDriw_GP_cNotPt_V4 : |
| 634 | case Hexagon::LDriw_GP_cdnPt_V4 : |
| 635 | case Hexagon::LDriw_GP_cdnNotPt_V4 : |
| 636 | case Hexagon::LDd_GP_cPt_V4 : |
| 637 | case Hexagon::LDd_GP_cNotPt_V4 : |
| 638 | case Hexagon::LDd_GP_cdnPt_V4 : |
| 639 | case Hexagon::LDd_GP_cdnNotPt_V4 : |
| 640 | case Hexagon::LDb_GP_cPt_V4 : |
| 641 | case Hexagon::LDb_GP_cNotPt_V4 : |
| 642 | case Hexagon::LDb_GP_cdnPt_V4 : |
| 643 | case Hexagon::LDb_GP_cdnNotPt_V4 : |
| 644 | case Hexagon::LDub_GP_cPt_V4 : |
| 645 | case Hexagon::LDub_GP_cNotPt_V4 : |
| 646 | case Hexagon::LDub_GP_cdnPt_V4 : |
| 647 | case Hexagon::LDub_GP_cdnNotPt_V4 : |
| 648 | case Hexagon::LDh_GP_cPt_V4 : |
| 649 | case Hexagon::LDh_GP_cNotPt_V4 : |
| 650 | case Hexagon::LDh_GP_cdnPt_V4 : |
| 651 | case Hexagon::LDh_GP_cdnNotPt_V4 : |
| 652 | case Hexagon::LDuh_GP_cPt_V4 : |
| 653 | case Hexagon::LDuh_GP_cNotPt_V4 : |
| 654 | case Hexagon::LDuh_GP_cdnPt_V4 : |
| 655 | case Hexagon::LDuh_GP_cdnNotPt_V4 : |
| 656 | case Hexagon::LDw_GP_cPt_V4 : |
| 657 | case Hexagon::LDw_GP_cNotPt_V4 : |
| 658 | case Hexagon::LDw_GP_cdnPt_V4 : |
| 659 | case Hexagon::LDw_GP_cdnNotPt_V4 : |
| 660 | |
| 661 | // V4 global address store. |
| 662 | case Hexagon::STrid_GP_cPt_V4 : |
| 663 | case Hexagon::STrid_GP_cNotPt_V4 : |
| 664 | case Hexagon::STrid_GP_cdnPt_V4 : |
| 665 | case Hexagon::STrid_GP_cdnNotPt_V4 : |
| 666 | case Hexagon::STrib_GP_cPt_V4 : |
| 667 | case Hexagon::STrib_GP_cNotPt_V4 : |
| 668 | case Hexagon::STrib_GP_cdnPt_V4 : |
| 669 | case Hexagon::STrib_GP_cdnNotPt_V4 : |
| 670 | case Hexagon::STrih_GP_cPt_V4 : |
| 671 | case Hexagon::STrih_GP_cNotPt_V4 : |
| 672 | case Hexagon::STrih_GP_cdnPt_V4 : |
| 673 | case Hexagon::STrih_GP_cdnNotPt_V4 : |
| 674 | case Hexagon::STriw_GP_cPt_V4 : |
| 675 | case Hexagon::STriw_GP_cNotPt_V4 : |
| 676 | case Hexagon::STriw_GP_cdnPt_V4 : |
| 677 | case Hexagon::STriw_GP_cdnNotPt_V4 : |
| 678 | case Hexagon::STd_GP_cPt_V4 : |
| 679 | case Hexagon::STd_GP_cNotPt_V4 : |
| 680 | case Hexagon::STd_GP_cdnPt_V4 : |
| 681 | case Hexagon::STd_GP_cdnNotPt_V4 : |
| 682 | case Hexagon::STb_GP_cPt_V4 : |
| 683 | case Hexagon::STb_GP_cNotPt_V4 : |
| 684 | case Hexagon::STb_GP_cdnPt_V4 : |
| 685 | case Hexagon::STb_GP_cdnNotPt_V4 : |
| 686 | case Hexagon::STh_GP_cPt_V4 : |
| 687 | case Hexagon::STh_GP_cNotPt_V4 : |
| 688 | case Hexagon::STh_GP_cdnPt_V4 : |
| 689 | case Hexagon::STh_GP_cdnNotPt_V4 : |
| 690 | case Hexagon::STw_GP_cPt_V4 : |
| 691 | case Hexagon::STw_GP_cNotPt_V4 : |
| 692 | case Hexagon::STw_GP_cdnPt_V4 : |
| 693 | case Hexagon::STw_GP_cdnNotPt_V4 : |
| 694 | |
| 695 | // V4 predicated global address new value store. |
| 696 | case Hexagon::STrib_GP_cPt_nv_V4 : |
| 697 | case Hexagon::STrib_GP_cNotPt_nv_V4 : |
| 698 | case Hexagon::STrib_GP_cdnPt_nv_V4 : |
| 699 | case Hexagon::STrib_GP_cdnNotPt_nv_V4 : |
| 700 | case Hexagon::STrih_GP_cPt_nv_V4 : |
| 701 | case Hexagon::STrih_GP_cNotPt_nv_V4 : |
| 702 | case Hexagon::STrih_GP_cdnPt_nv_V4 : |
| 703 | case Hexagon::STrih_GP_cdnNotPt_nv_V4 : |
| 704 | case Hexagon::STriw_GP_cPt_nv_V4 : |
| 705 | case Hexagon::STriw_GP_cNotPt_nv_V4 : |
| 706 | case Hexagon::STriw_GP_cdnPt_nv_V4 : |
| 707 | case Hexagon::STriw_GP_cdnNotPt_nv_V4 : |
| 708 | case Hexagon::STb_GP_cPt_nv_V4 : |
| 709 | case Hexagon::STb_GP_cNotPt_nv_V4 : |
| 710 | case Hexagon::STb_GP_cdnPt_nv_V4 : |
| 711 | case Hexagon::STb_GP_cdnNotPt_nv_V4 : |
| 712 | case Hexagon::STh_GP_cPt_nv_V4 : |
| 713 | case Hexagon::STh_GP_cNotPt_nv_V4 : |
| 714 | case Hexagon::STh_GP_cdnPt_nv_V4 : |
| 715 | case Hexagon::STh_GP_cdnNotPt_nv_V4 : |
| 716 | case Hexagon::STw_GP_cPt_nv_V4 : |
| 717 | case Hexagon::STw_GP_cNotPt_nv_V4 : |
| 718 | case Hexagon::STw_GP_cdnPt_nv_V4 : |
| 719 | case Hexagon::STw_GP_cdnNotPt_nv_V4 : |
| 720 | |
| 721 | // TFR_FI |
| 722 | case Hexagon::TFR_FI_immext_V4: |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 723 | |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 724 | // TFRI_F |
| 725 | case Hexagon::TFRI_f: |
| 726 | case Hexagon::TFRI_cPt_f: |
| 727 | case Hexagon::TFRI_cNotPt_f: |
| 728 | case Hexagon::CONST64_Float_Real: |
| 729 | return true; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 730 | } |
| 731 | } |
| 732 | |
| 733 | bool HexagonInstrInfo::isNewValueJump(const MachineInstr *MI) const { |
| 734 | switch (MI->getOpcode()) { |
| 735 | default: return false; |
| 736 | // JMP_EQri |
| 737 | case Hexagon::JMP_EQriPt_nv_V4: |
| 738 | case Hexagon::JMP_EQriPnt_nv_V4: |
| 739 | case Hexagon::JMP_EQriNotPt_nv_V4: |
| 740 | case Hexagon::JMP_EQriNotPnt_nv_V4: |
| 741 | case Hexagon::JMP_EQriPt_ie_nv_V4: |
| 742 | case Hexagon::JMP_EQriPnt_ie_nv_V4: |
| 743 | case Hexagon::JMP_EQriNotPt_ie_nv_V4: |
| 744 | case Hexagon::JMP_EQriNotPnt_ie_nv_V4: |
| 745 | |
| 746 | // JMP_EQri - with -1 |
| 747 | case Hexagon::JMP_EQriPtneg_nv_V4: |
| 748 | case Hexagon::JMP_EQriPntneg_nv_V4: |
| 749 | case Hexagon::JMP_EQriNotPtneg_nv_V4: |
| 750 | case Hexagon::JMP_EQriNotPntneg_nv_V4: |
| 751 | case Hexagon::JMP_EQriPtneg_ie_nv_V4: |
| 752 | case Hexagon::JMP_EQriPntneg_ie_nv_V4: |
| 753 | case Hexagon::JMP_EQriNotPtneg_ie_nv_V4: |
| 754 | case Hexagon::JMP_EQriNotPntneg_ie_nv_V4: |
| 755 | |
| 756 | // JMP_EQrr |
| 757 | case Hexagon::JMP_EQrrPt_nv_V4: |
| 758 | case Hexagon::JMP_EQrrPnt_nv_V4: |
| 759 | case Hexagon::JMP_EQrrNotPt_nv_V4: |
| 760 | case Hexagon::JMP_EQrrNotPnt_nv_V4: |
| 761 | case Hexagon::JMP_EQrrPt_ie_nv_V4: |
| 762 | case Hexagon::JMP_EQrrPnt_ie_nv_V4: |
| 763 | case Hexagon::JMP_EQrrNotPt_ie_nv_V4: |
| 764 | case Hexagon::JMP_EQrrNotPnt_ie_nv_V4: |
| 765 | |
| 766 | // JMP_GTri |
| 767 | case Hexagon::JMP_GTriPt_nv_V4: |
| 768 | case Hexagon::JMP_GTriPnt_nv_V4: |
| 769 | case Hexagon::JMP_GTriNotPt_nv_V4: |
| 770 | case Hexagon::JMP_GTriNotPnt_nv_V4: |
| 771 | case Hexagon::JMP_GTriPt_ie_nv_V4: |
| 772 | case Hexagon::JMP_GTriPnt_ie_nv_V4: |
| 773 | case Hexagon::JMP_GTriNotPt_ie_nv_V4: |
| 774 | case Hexagon::JMP_GTriNotPnt_ie_nv_V4: |
| 775 | |
| 776 | // JMP_GTri - with -1 |
| 777 | case Hexagon::JMP_GTriPtneg_nv_V4: |
| 778 | case Hexagon::JMP_GTriPntneg_nv_V4: |
| 779 | case Hexagon::JMP_GTriNotPtneg_nv_V4: |
| 780 | case Hexagon::JMP_GTriNotPntneg_nv_V4: |
| 781 | case Hexagon::JMP_GTriPtneg_ie_nv_V4: |
| 782 | case Hexagon::JMP_GTriPntneg_ie_nv_V4: |
| 783 | case Hexagon::JMP_GTriNotPtneg_ie_nv_V4: |
| 784 | case Hexagon::JMP_GTriNotPntneg_ie_nv_V4: |
| 785 | |
| 786 | // JMP_GTrr |
| 787 | case Hexagon::JMP_GTrrPt_nv_V4: |
| 788 | case Hexagon::JMP_GTrrPnt_nv_V4: |
| 789 | case Hexagon::JMP_GTrrNotPt_nv_V4: |
| 790 | case Hexagon::JMP_GTrrNotPnt_nv_V4: |
| 791 | case Hexagon::JMP_GTrrPt_ie_nv_V4: |
| 792 | case Hexagon::JMP_GTrrPnt_ie_nv_V4: |
| 793 | case Hexagon::JMP_GTrrNotPt_ie_nv_V4: |
| 794 | case Hexagon::JMP_GTrrNotPnt_ie_nv_V4: |
| 795 | |
| 796 | // JMP_GTrrdn |
| 797 | case Hexagon::JMP_GTrrdnPt_nv_V4: |
| 798 | case Hexagon::JMP_GTrrdnPnt_nv_V4: |
| 799 | case Hexagon::JMP_GTrrdnNotPt_nv_V4: |
| 800 | case Hexagon::JMP_GTrrdnNotPnt_nv_V4: |
| 801 | case Hexagon::JMP_GTrrdnPt_ie_nv_V4: |
| 802 | case Hexagon::JMP_GTrrdnPnt_ie_nv_V4: |
| 803 | case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4: |
| 804 | case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4: |
| 805 | |
| 806 | // JMP_GTUri |
| 807 | case Hexagon::JMP_GTUriPt_nv_V4: |
| 808 | case Hexagon::JMP_GTUriPnt_nv_V4: |
| 809 | case Hexagon::JMP_GTUriNotPt_nv_V4: |
| 810 | case Hexagon::JMP_GTUriNotPnt_nv_V4: |
| 811 | case Hexagon::JMP_GTUriPt_ie_nv_V4: |
| 812 | case Hexagon::JMP_GTUriPnt_ie_nv_V4: |
| 813 | case Hexagon::JMP_GTUriNotPt_ie_nv_V4: |
| 814 | case Hexagon::JMP_GTUriNotPnt_ie_nv_V4: |
| 815 | |
| 816 | // JMP_GTUrr |
| 817 | case Hexagon::JMP_GTUrrPt_nv_V4: |
| 818 | case Hexagon::JMP_GTUrrPnt_nv_V4: |
| 819 | case Hexagon::JMP_GTUrrNotPt_nv_V4: |
| 820 | case Hexagon::JMP_GTUrrNotPnt_nv_V4: |
| 821 | case Hexagon::JMP_GTUrrPt_ie_nv_V4: |
| 822 | case Hexagon::JMP_GTUrrPnt_ie_nv_V4: |
| 823 | case Hexagon::JMP_GTUrrNotPt_ie_nv_V4: |
| 824 | case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4: |
| 825 | |
| 826 | // JMP_GTUrrdn |
| 827 | case Hexagon::JMP_GTUrrdnPt_nv_V4: |
| 828 | case Hexagon::JMP_GTUrrdnPnt_nv_V4: |
| 829 | case Hexagon::JMP_GTUrrdnNotPt_nv_V4: |
| 830 | case Hexagon::JMP_GTUrrdnNotPnt_nv_V4: |
| 831 | case Hexagon::JMP_GTUrrdnPt_ie_nv_V4: |
| 832 | case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4: |
| 833 | case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4: |
| 834 | case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4: |
| 835 | return true; |
| 836 | } |
| 837 | } |
| 838 | |
| 839 | unsigned HexagonInstrInfo::getImmExtForm(const MachineInstr* MI) const { |
| 840 | switch(MI->getOpcode()) { |
| 841 | default: llvm_unreachable("Unknown type of instruction."); |
| 842 | // JMP_EQri |
| 843 | case Hexagon::JMP_EQriPt_nv_V4: |
| 844 | return Hexagon::JMP_EQriPt_ie_nv_V4; |
| 845 | case Hexagon::JMP_EQriNotPt_nv_V4: |
| 846 | return Hexagon::JMP_EQriNotPt_ie_nv_V4; |
| 847 | case Hexagon::JMP_EQriPnt_nv_V4: |
| 848 | return Hexagon::JMP_EQriPnt_ie_nv_V4; |
| 849 | case Hexagon::JMP_EQriNotPnt_nv_V4: |
| 850 | return Hexagon::JMP_EQriNotPnt_ie_nv_V4; |
| 851 | |
| 852 | // JMP_EQri -- with -1 |
| 853 | case Hexagon::JMP_EQriPtneg_nv_V4: |
| 854 | return Hexagon::JMP_EQriPtneg_ie_nv_V4; |
| 855 | case Hexagon::JMP_EQriNotPtneg_nv_V4: |
| 856 | return Hexagon::JMP_EQriNotPtneg_ie_nv_V4; |
| 857 | case Hexagon::JMP_EQriPntneg_nv_V4: |
| 858 | return Hexagon::JMP_EQriPntneg_ie_nv_V4; |
| 859 | case Hexagon::JMP_EQriNotPntneg_nv_V4: |
| 860 | return Hexagon::JMP_EQriNotPntneg_ie_nv_V4; |
| 861 | |
| 862 | // JMP_EQrr |
| 863 | case Hexagon::JMP_EQrrPt_nv_V4: |
| 864 | return Hexagon::JMP_EQrrPt_ie_nv_V4; |
| 865 | case Hexagon::JMP_EQrrNotPt_nv_V4: |
| 866 | return Hexagon::JMP_EQrrNotPt_ie_nv_V4; |
| 867 | case Hexagon::JMP_EQrrPnt_nv_V4: |
| 868 | return Hexagon::JMP_EQrrPnt_ie_nv_V4; |
| 869 | case Hexagon::JMP_EQrrNotPnt_nv_V4: |
| 870 | return Hexagon::JMP_EQrrNotPnt_ie_nv_V4; |
| 871 | |
| 872 | // JMP_GTri |
| 873 | case Hexagon::JMP_GTriPt_nv_V4: |
| 874 | return Hexagon::JMP_GTriPt_ie_nv_V4; |
| 875 | case Hexagon::JMP_GTriNotPt_nv_V4: |
| 876 | return Hexagon::JMP_GTriNotPt_ie_nv_V4; |
| 877 | case Hexagon::JMP_GTriPnt_nv_V4: |
| 878 | return Hexagon::JMP_GTriPnt_ie_nv_V4; |
| 879 | case Hexagon::JMP_GTriNotPnt_nv_V4: |
| 880 | return Hexagon::JMP_GTriNotPnt_ie_nv_V4; |
| 881 | |
| 882 | // JMP_GTri -- with -1 |
| 883 | case Hexagon::JMP_GTriPtneg_nv_V4: |
| 884 | return Hexagon::JMP_GTriPtneg_ie_nv_V4; |
| 885 | case Hexagon::JMP_GTriNotPtneg_nv_V4: |
| 886 | return Hexagon::JMP_GTriNotPtneg_ie_nv_V4; |
| 887 | case Hexagon::JMP_GTriPntneg_nv_V4: |
| 888 | return Hexagon::JMP_GTriPntneg_ie_nv_V4; |
| 889 | case Hexagon::JMP_GTriNotPntneg_nv_V4: |
| 890 | return Hexagon::JMP_GTriNotPntneg_ie_nv_V4; |
| 891 | |
| 892 | // JMP_GTrr |
| 893 | case Hexagon::JMP_GTrrPt_nv_V4: |
| 894 | return Hexagon::JMP_GTrrPt_ie_nv_V4; |
| 895 | case Hexagon::JMP_GTrrNotPt_nv_V4: |
| 896 | return Hexagon::JMP_GTrrNotPt_ie_nv_V4; |
| 897 | case Hexagon::JMP_GTrrPnt_nv_V4: |
| 898 | return Hexagon::JMP_GTrrPnt_ie_nv_V4; |
| 899 | case Hexagon::JMP_GTrrNotPnt_nv_V4: |
| 900 | return Hexagon::JMP_GTrrNotPnt_ie_nv_V4; |
| 901 | |
| 902 | // JMP_GTrrdn |
| 903 | case Hexagon::JMP_GTrrdnPt_nv_V4: |
| 904 | return Hexagon::JMP_GTrrdnPt_ie_nv_V4; |
| 905 | case Hexagon::JMP_GTrrdnNotPt_nv_V4: |
| 906 | return Hexagon::JMP_GTrrdnNotPt_ie_nv_V4; |
| 907 | case Hexagon::JMP_GTrrdnPnt_nv_V4: |
| 908 | return Hexagon::JMP_GTrrdnPnt_ie_nv_V4; |
| 909 | case Hexagon::JMP_GTrrdnNotPnt_nv_V4: |
| 910 | return Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4; |
| 911 | |
| 912 | // JMP_GTUri |
| 913 | case Hexagon::JMP_GTUriPt_nv_V4: |
| 914 | return Hexagon::JMP_GTUriPt_ie_nv_V4; |
| 915 | case Hexagon::JMP_GTUriNotPt_nv_V4: |
| 916 | return Hexagon::JMP_GTUriNotPt_ie_nv_V4; |
| 917 | case Hexagon::JMP_GTUriPnt_nv_V4: |
| 918 | return Hexagon::JMP_GTUriPnt_ie_nv_V4; |
| 919 | case Hexagon::JMP_GTUriNotPnt_nv_V4: |
| 920 | return Hexagon::JMP_GTUriNotPnt_ie_nv_V4; |
| 921 | |
| 922 | // JMP_GTUrr |
| 923 | case Hexagon::JMP_GTUrrPt_nv_V4: |
| 924 | return Hexagon::JMP_GTUrrPt_ie_nv_V4; |
| 925 | case Hexagon::JMP_GTUrrNotPt_nv_V4: |
| 926 | return Hexagon::JMP_GTUrrNotPt_ie_nv_V4; |
| 927 | case Hexagon::JMP_GTUrrPnt_nv_V4: |
| 928 | return Hexagon::JMP_GTUrrPnt_ie_nv_V4; |
| 929 | case Hexagon::JMP_GTUrrNotPnt_nv_V4: |
| 930 | return Hexagon::JMP_GTUrrNotPnt_ie_nv_V4; |
| 931 | |
| 932 | // JMP_GTUrrdn |
| 933 | case Hexagon::JMP_GTUrrdnPt_nv_V4: |
| 934 | return Hexagon::JMP_GTUrrdnPt_ie_nv_V4; |
| 935 | case Hexagon::JMP_GTUrrdnNotPt_nv_V4: |
| 936 | return Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4; |
| 937 | case Hexagon::JMP_GTUrrdnPnt_nv_V4: |
| 938 | return Hexagon::JMP_GTUrrdnPnt_ie_nv_V4; |
| 939 | case Hexagon::JMP_GTUrrdnNotPnt_nv_V4: |
| 940 | return Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4; |
| 941 | |
| 942 | case Hexagon::TFR_FI: |
| 943 | return Hexagon::TFR_FI_immext_V4; |
| 944 | |
| 945 | case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 : |
| 946 | case Hexagon::MEMw_ADDi_indexed_MEM_V4 : |
| 947 | case Hexagon::MEMw_SUBi_indexed_MEM_V4 : |
| 948 | case Hexagon::MEMw_ADDr_indexed_MEM_V4 : |
| 949 | case Hexagon::MEMw_SUBr_indexed_MEM_V4 : |
| 950 | case Hexagon::MEMw_ANDr_indexed_MEM_V4 : |
| 951 | case Hexagon::MEMw_ORr_indexed_MEM_V4 : |
| 952 | case Hexagon::MEMw_ADDSUBi_MEM_V4 : |
| 953 | case Hexagon::MEMw_ADDi_MEM_V4 : |
| 954 | case Hexagon::MEMw_SUBi_MEM_V4 : |
| 955 | case Hexagon::MEMw_ADDr_MEM_V4 : |
| 956 | case Hexagon::MEMw_SUBr_MEM_V4 : |
| 957 | case Hexagon::MEMw_ANDr_MEM_V4 : |
| 958 | case Hexagon::MEMw_ORr_MEM_V4 : |
| 959 | case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 : |
| 960 | case Hexagon::MEMh_ADDi_indexed_MEM_V4 : |
| 961 | case Hexagon::MEMh_SUBi_indexed_MEM_V4 : |
| 962 | case Hexagon::MEMh_ADDr_indexed_MEM_V4 : |
| 963 | case Hexagon::MEMh_SUBr_indexed_MEM_V4 : |
| 964 | case Hexagon::MEMh_ANDr_indexed_MEM_V4 : |
| 965 | case Hexagon::MEMh_ORr_indexed_MEM_V4 : |
| 966 | case Hexagon::MEMh_ADDSUBi_MEM_V4 : |
| 967 | case Hexagon::MEMh_ADDi_MEM_V4 : |
| 968 | case Hexagon::MEMh_SUBi_MEM_V4 : |
| 969 | case Hexagon::MEMh_ADDr_MEM_V4 : |
| 970 | case Hexagon::MEMh_SUBr_MEM_V4 : |
| 971 | case Hexagon::MEMh_ANDr_MEM_V4 : |
| 972 | case Hexagon::MEMh_ORr_MEM_V4 : |
| 973 | case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 : |
| 974 | case Hexagon::MEMb_ADDi_indexed_MEM_V4 : |
| 975 | case Hexagon::MEMb_SUBi_indexed_MEM_V4 : |
| 976 | case Hexagon::MEMb_ADDr_indexed_MEM_V4 : |
| 977 | case Hexagon::MEMb_SUBr_indexed_MEM_V4 : |
| 978 | case Hexagon::MEMb_ANDr_indexed_MEM_V4 : |
| 979 | case Hexagon::MEMb_ORr_indexed_MEM_V4 : |
| 980 | case Hexagon::MEMb_ADDSUBi_MEM_V4 : |
| 981 | case Hexagon::MEMb_ADDi_MEM_V4 : |
| 982 | case Hexagon::MEMb_SUBi_MEM_V4 : |
| 983 | case Hexagon::MEMb_ADDr_MEM_V4 : |
| 984 | case Hexagon::MEMb_SUBr_MEM_V4 : |
| 985 | case Hexagon::MEMb_ANDr_MEM_V4 : |
| 986 | case Hexagon::MEMb_ORr_MEM_V4 : |
| 987 | llvm_unreachable("Needs implementing."); |
| 988 | } |
| 989 | } |
| 990 | |
| 991 | unsigned HexagonInstrInfo::getNormalBranchForm(const MachineInstr* MI) const { |
| 992 | switch(MI->getOpcode()) { |
| 993 | default: llvm_unreachable("Unknown type of jump instruction."); |
| 994 | // JMP_EQri |
| 995 | case Hexagon::JMP_EQriPt_ie_nv_V4: |
| 996 | return Hexagon::JMP_EQriPt_nv_V4; |
| 997 | case Hexagon::JMP_EQriNotPt_ie_nv_V4: |
| 998 | return Hexagon::JMP_EQriNotPt_nv_V4; |
| 999 | case Hexagon::JMP_EQriPnt_ie_nv_V4: |
| 1000 | return Hexagon::JMP_EQriPnt_nv_V4; |
| 1001 | case Hexagon::JMP_EQriNotPnt_ie_nv_V4: |
| 1002 | return Hexagon::JMP_EQriNotPnt_nv_V4; |
| 1003 | |
| 1004 | // JMP_EQri -- with -1 |
| 1005 | case Hexagon::JMP_EQriPtneg_ie_nv_V4: |
| 1006 | return Hexagon::JMP_EQriPtneg_nv_V4; |
| 1007 | case Hexagon::JMP_EQriNotPtneg_ie_nv_V4: |
| 1008 | return Hexagon::JMP_EQriNotPtneg_nv_V4; |
| 1009 | case Hexagon::JMP_EQriPntneg_ie_nv_V4: |
| 1010 | return Hexagon::JMP_EQriPntneg_nv_V4; |
| 1011 | case Hexagon::JMP_EQriNotPntneg_ie_nv_V4: |
| 1012 | return Hexagon::JMP_EQriNotPntneg_nv_V4; |
| 1013 | |
| 1014 | // JMP_EQrr |
| 1015 | case Hexagon::JMP_EQrrPt_ie_nv_V4: |
| 1016 | return Hexagon::JMP_EQrrPt_nv_V4; |
| 1017 | case Hexagon::JMP_EQrrNotPt_ie_nv_V4: |
| 1018 | return Hexagon::JMP_EQrrNotPt_nv_V4; |
| 1019 | case Hexagon::JMP_EQrrPnt_ie_nv_V4: |
| 1020 | return Hexagon::JMP_EQrrPnt_nv_V4; |
| 1021 | case Hexagon::JMP_EQrrNotPnt_ie_nv_V4: |
| 1022 | return Hexagon::JMP_EQrrNotPnt_nv_V4; |
| 1023 | |
| 1024 | // JMP_GTri |
| 1025 | case Hexagon::JMP_GTriPt_ie_nv_V4: |
| 1026 | return Hexagon::JMP_GTriPt_nv_V4; |
| 1027 | case Hexagon::JMP_GTriNotPt_ie_nv_V4: |
| 1028 | return Hexagon::JMP_GTriNotPt_nv_V4; |
| 1029 | case Hexagon::JMP_GTriPnt_ie_nv_V4: |
| 1030 | return Hexagon::JMP_GTriPnt_nv_V4; |
| 1031 | case Hexagon::JMP_GTriNotPnt_ie_nv_V4: |
| 1032 | return Hexagon::JMP_GTriNotPnt_nv_V4; |
| 1033 | |
| 1034 | // JMP_GTri -- with -1 |
| 1035 | case Hexagon::JMP_GTriPtneg_ie_nv_V4: |
| 1036 | return Hexagon::JMP_GTriPtneg_nv_V4; |
| 1037 | case Hexagon::JMP_GTriNotPtneg_ie_nv_V4: |
| 1038 | return Hexagon::JMP_GTriNotPtneg_nv_V4; |
| 1039 | case Hexagon::JMP_GTriPntneg_ie_nv_V4: |
| 1040 | return Hexagon::JMP_GTriPntneg_nv_V4; |
| 1041 | case Hexagon::JMP_GTriNotPntneg_ie_nv_V4: |
| 1042 | return Hexagon::JMP_GTriNotPntneg_nv_V4; |
| 1043 | |
| 1044 | // JMP_GTrr |
| 1045 | case Hexagon::JMP_GTrrPt_ie_nv_V4: |
| 1046 | return Hexagon::JMP_GTrrPt_nv_V4; |
| 1047 | case Hexagon::JMP_GTrrNotPt_ie_nv_V4: |
| 1048 | return Hexagon::JMP_GTrrNotPt_nv_V4; |
| 1049 | case Hexagon::JMP_GTrrPnt_ie_nv_V4: |
| 1050 | return Hexagon::JMP_GTrrPnt_nv_V4; |
| 1051 | case Hexagon::JMP_GTrrNotPnt_ie_nv_V4: |
| 1052 | return Hexagon::JMP_GTrrNotPnt_nv_V4; |
| 1053 | |
| 1054 | // JMP_GTrrdn |
| 1055 | case Hexagon::JMP_GTrrdnPt_ie_nv_V4: |
| 1056 | return Hexagon::JMP_GTrrdnPt_nv_V4; |
| 1057 | case Hexagon::JMP_GTrrdnNotPt_ie_nv_V4: |
| 1058 | return Hexagon::JMP_GTrrdnNotPt_nv_V4; |
| 1059 | case Hexagon::JMP_GTrrdnPnt_ie_nv_V4: |
| 1060 | return Hexagon::JMP_GTrrdnPnt_nv_V4; |
| 1061 | case Hexagon::JMP_GTrrdnNotPnt_ie_nv_V4: |
| 1062 | return Hexagon::JMP_GTrrdnNotPnt_nv_V4; |
| 1063 | |
| 1064 | // JMP_GTUri |
| 1065 | case Hexagon::JMP_GTUriPt_ie_nv_V4: |
| 1066 | return Hexagon::JMP_GTUriPt_nv_V4; |
| 1067 | case Hexagon::JMP_GTUriNotPt_ie_nv_V4: |
| 1068 | return Hexagon::JMP_GTUriNotPt_nv_V4; |
| 1069 | case Hexagon::JMP_GTUriPnt_ie_nv_V4: |
| 1070 | return Hexagon::JMP_GTUriPnt_nv_V4; |
| 1071 | case Hexagon::JMP_GTUriNotPnt_ie_nv_V4: |
| 1072 | return Hexagon::JMP_GTUriNotPnt_nv_V4; |
| 1073 | |
| 1074 | // JMP_GTUrr |
| 1075 | case Hexagon::JMP_GTUrrPt_ie_nv_V4: |
| 1076 | return Hexagon::JMP_GTUrrPt_nv_V4; |
| 1077 | case Hexagon::JMP_GTUrrNotPt_ie_nv_V4: |
| 1078 | return Hexagon::JMP_GTUrrNotPt_nv_V4; |
| 1079 | case Hexagon::JMP_GTUrrPnt_ie_nv_V4: |
| 1080 | return Hexagon::JMP_GTUrrPnt_nv_V4; |
| 1081 | case Hexagon::JMP_GTUrrNotPnt_ie_nv_V4: |
| 1082 | return Hexagon::JMP_GTUrrNotPnt_nv_V4; |
| 1083 | |
| 1084 | // JMP_GTUrrdn |
| 1085 | case Hexagon::JMP_GTUrrdnPt_ie_nv_V4: |
| 1086 | return Hexagon::JMP_GTUrrdnPt_nv_V4; |
| 1087 | case Hexagon::JMP_GTUrrdnNotPt_ie_nv_V4: |
| 1088 | return Hexagon::JMP_GTUrrdnNotPt_nv_V4; |
| 1089 | case Hexagon::JMP_GTUrrdnPnt_ie_nv_V4: |
| 1090 | return Hexagon::JMP_GTUrrdnPnt_nv_V4; |
| 1091 | case Hexagon::JMP_GTUrrdnNotPnt_ie_nv_V4: |
| 1092 | return Hexagon::JMP_GTUrrdnNotPnt_nv_V4; |
| 1093 | } |
| 1094 | } |
| 1095 | |
| 1096 | |
| 1097 | bool HexagonInstrInfo::isNewValueStore(const MachineInstr *MI) const { |
| 1098 | switch (MI->getOpcode()) { |
| 1099 | default: return false; |
| 1100 | // Store Byte |
| 1101 | case Hexagon::STrib_nv_V4: |
| 1102 | case Hexagon::STrib_indexed_nv_V4: |
| 1103 | case Hexagon::STrib_indexed_shl_nv_V4: |
| 1104 | case Hexagon::STrib_shl_nv_V4: |
| 1105 | case Hexagon::STrib_GP_nv_V4: |
| 1106 | case Hexagon::STb_GP_nv_V4: |
| 1107 | case Hexagon::POST_STbri_nv_V4: |
| 1108 | case Hexagon::STrib_cPt_nv_V4: |
| 1109 | case Hexagon::STrib_cdnPt_nv_V4: |
| 1110 | case Hexagon::STrib_cNotPt_nv_V4: |
| 1111 | case Hexagon::STrib_cdnNotPt_nv_V4: |
| 1112 | case Hexagon::STrib_indexed_cPt_nv_V4: |
| 1113 | case Hexagon::STrib_indexed_cdnPt_nv_V4: |
| 1114 | case Hexagon::STrib_indexed_cNotPt_nv_V4: |
| 1115 | case Hexagon::STrib_indexed_cdnNotPt_nv_V4: |
| 1116 | case Hexagon::STrib_indexed_shl_cPt_nv_V4: |
| 1117 | case Hexagon::STrib_indexed_shl_cdnPt_nv_V4: |
| 1118 | case Hexagon::STrib_indexed_shl_cNotPt_nv_V4: |
| 1119 | case Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4: |
| 1120 | case Hexagon::POST_STbri_cPt_nv_V4: |
| 1121 | case Hexagon::POST_STbri_cdnPt_nv_V4: |
| 1122 | case Hexagon::POST_STbri_cNotPt_nv_V4: |
| 1123 | case Hexagon::POST_STbri_cdnNotPt_nv_V4: |
| 1124 | case Hexagon::STb_GP_cPt_nv_V4: |
| 1125 | case Hexagon::STb_GP_cNotPt_nv_V4: |
| 1126 | case Hexagon::STb_GP_cdnPt_nv_V4: |
| 1127 | case Hexagon::STb_GP_cdnNotPt_nv_V4: |
| 1128 | case Hexagon::STrib_GP_cPt_nv_V4: |
| 1129 | case Hexagon::STrib_GP_cNotPt_nv_V4: |
| 1130 | case Hexagon::STrib_GP_cdnPt_nv_V4: |
| 1131 | case Hexagon::STrib_GP_cdnNotPt_nv_V4: |
| 1132 | case Hexagon::STrib_abs_nv_V4: |
| 1133 | case Hexagon::STrib_abs_cPt_nv_V4: |
| 1134 | case Hexagon::STrib_abs_cdnPt_nv_V4: |
| 1135 | case Hexagon::STrib_abs_cNotPt_nv_V4: |
| 1136 | case Hexagon::STrib_abs_cdnNotPt_nv_V4: |
| 1137 | case Hexagon::STrib_imm_abs_nv_V4: |
| 1138 | case Hexagon::STrib_imm_abs_cPt_nv_V4: |
| 1139 | case Hexagon::STrib_imm_abs_cdnPt_nv_V4: |
| 1140 | case Hexagon::STrib_imm_abs_cNotPt_nv_V4: |
| 1141 | case Hexagon::STrib_imm_abs_cdnNotPt_nv_V4: |
| 1142 | |
| 1143 | // Store Halfword |
| 1144 | case Hexagon::STrih_nv_V4: |
| 1145 | case Hexagon::STrih_indexed_nv_V4: |
| 1146 | case Hexagon::STrih_indexed_shl_nv_V4: |
| 1147 | case Hexagon::STrih_shl_nv_V4: |
| 1148 | case Hexagon::STrih_GP_nv_V4: |
| 1149 | case Hexagon::STh_GP_nv_V4: |
| 1150 | case Hexagon::POST_SThri_nv_V4: |
| 1151 | case Hexagon::STrih_cPt_nv_V4: |
| 1152 | case Hexagon::STrih_cdnPt_nv_V4: |
| 1153 | case Hexagon::STrih_cNotPt_nv_V4: |
| 1154 | case Hexagon::STrih_cdnNotPt_nv_V4: |
| 1155 | case Hexagon::STrih_indexed_cPt_nv_V4: |
| 1156 | case Hexagon::STrih_indexed_cdnPt_nv_V4: |
| 1157 | case Hexagon::STrih_indexed_cNotPt_nv_V4: |
| 1158 | case Hexagon::STrih_indexed_cdnNotPt_nv_V4: |
| 1159 | case Hexagon::STrih_indexed_shl_cPt_nv_V4: |
| 1160 | case Hexagon::STrih_indexed_shl_cdnPt_nv_V4: |
| 1161 | case Hexagon::STrih_indexed_shl_cNotPt_nv_V4: |
| 1162 | case Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4: |
| 1163 | case Hexagon::POST_SThri_cPt_nv_V4: |
| 1164 | case Hexagon::POST_SThri_cdnPt_nv_V4: |
| 1165 | case Hexagon::POST_SThri_cNotPt_nv_V4: |
| 1166 | case Hexagon::POST_SThri_cdnNotPt_nv_V4: |
| 1167 | case Hexagon::STh_GP_cPt_nv_V4: |
| 1168 | case Hexagon::STh_GP_cNotPt_nv_V4: |
| 1169 | case Hexagon::STh_GP_cdnPt_nv_V4: |
| 1170 | case Hexagon::STh_GP_cdnNotPt_nv_V4: |
| 1171 | case Hexagon::STrih_GP_cPt_nv_V4: |
| 1172 | case Hexagon::STrih_GP_cNotPt_nv_V4: |
| 1173 | case Hexagon::STrih_GP_cdnPt_nv_V4: |
| 1174 | case Hexagon::STrih_GP_cdnNotPt_nv_V4: |
| 1175 | case Hexagon::STrih_abs_nv_V4: |
| 1176 | case Hexagon::STrih_abs_cPt_nv_V4: |
| 1177 | case Hexagon::STrih_abs_cdnPt_nv_V4: |
| 1178 | case Hexagon::STrih_abs_cNotPt_nv_V4: |
| 1179 | case Hexagon::STrih_abs_cdnNotPt_nv_V4: |
| 1180 | case Hexagon::STrih_imm_abs_nv_V4: |
| 1181 | case Hexagon::STrih_imm_abs_cPt_nv_V4: |
| 1182 | case Hexagon::STrih_imm_abs_cdnPt_nv_V4: |
| 1183 | case Hexagon::STrih_imm_abs_cNotPt_nv_V4: |
| 1184 | case Hexagon::STrih_imm_abs_cdnNotPt_nv_V4: |
| 1185 | |
| 1186 | // Store Word |
| 1187 | case Hexagon::STriw_nv_V4: |
| 1188 | case Hexagon::STriw_indexed_nv_V4: |
| 1189 | case Hexagon::STriw_indexed_shl_nv_V4: |
| 1190 | case Hexagon::STriw_shl_nv_V4: |
| 1191 | case Hexagon::STriw_GP_nv_V4: |
| 1192 | case Hexagon::STw_GP_nv_V4: |
| 1193 | case Hexagon::POST_STwri_nv_V4: |
| 1194 | case Hexagon::STriw_cPt_nv_V4: |
| 1195 | case Hexagon::STriw_cdnPt_nv_V4: |
| 1196 | case Hexagon::STriw_cNotPt_nv_V4: |
| 1197 | case Hexagon::STriw_cdnNotPt_nv_V4: |
| 1198 | case Hexagon::STriw_indexed_cPt_nv_V4: |
| 1199 | case Hexagon::STriw_indexed_cdnPt_nv_V4: |
| 1200 | case Hexagon::STriw_indexed_cNotPt_nv_V4: |
| 1201 | case Hexagon::STriw_indexed_cdnNotPt_nv_V4: |
| 1202 | case Hexagon::STriw_indexed_shl_cPt_nv_V4: |
| 1203 | case Hexagon::STriw_indexed_shl_cdnPt_nv_V4: |
| 1204 | case Hexagon::STriw_indexed_shl_cNotPt_nv_V4: |
| 1205 | case Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4: |
| 1206 | case Hexagon::POST_STwri_cPt_nv_V4: |
| 1207 | case Hexagon::POST_STwri_cdnPt_nv_V4: |
| 1208 | case Hexagon::POST_STwri_cNotPt_nv_V4: |
| 1209 | case Hexagon::POST_STwri_cdnNotPt_nv_V4: |
| 1210 | case Hexagon::STw_GP_cPt_nv_V4: |
| 1211 | case Hexagon::STw_GP_cNotPt_nv_V4: |
| 1212 | case Hexagon::STw_GP_cdnPt_nv_V4: |
| 1213 | case Hexagon::STw_GP_cdnNotPt_nv_V4: |
| 1214 | case Hexagon::STriw_GP_cPt_nv_V4: |
| 1215 | case Hexagon::STriw_GP_cNotPt_nv_V4: |
| 1216 | case Hexagon::STriw_GP_cdnPt_nv_V4: |
| 1217 | case Hexagon::STriw_GP_cdnNotPt_nv_V4: |
| 1218 | case Hexagon::STriw_abs_nv_V4: |
| 1219 | case Hexagon::STriw_abs_cPt_nv_V4: |
| 1220 | case Hexagon::STriw_abs_cdnPt_nv_V4: |
| 1221 | case Hexagon::STriw_abs_cNotPt_nv_V4: |
| 1222 | case Hexagon::STriw_abs_cdnNotPt_nv_V4: |
| 1223 | case Hexagon::STriw_imm_abs_nv_V4: |
| 1224 | case Hexagon::STriw_imm_abs_cPt_nv_V4: |
| 1225 | case Hexagon::STriw_imm_abs_cdnPt_nv_V4: |
| 1226 | case Hexagon::STriw_imm_abs_cNotPt_nv_V4: |
| 1227 | case Hexagon::STriw_imm_abs_cdnNotPt_nv_V4: |
| 1228 | return true; |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | bool HexagonInstrInfo::isPostIncrement (const MachineInstr* MI) const { |
| 1233 | switch (MI->getOpcode()) |
| 1234 | { |
| 1235 | default: return false; |
| 1236 | // Load Byte |
| 1237 | case Hexagon::POST_LDrib: |
| 1238 | case Hexagon::POST_LDrib_cPt: |
| 1239 | case Hexagon::POST_LDrib_cNotPt: |
| 1240 | case Hexagon::POST_LDrib_cdnPt_V4: |
| 1241 | case Hexagon::POST_LDrib_cdnNotPt_V4: |
| 1242 | |
| 1243 | // Load unsigned byte |
| 1244 | case Hexagon::POST_LDriub: |
| 1245 | case Hexagon::POST_LDriub_cPt: |
| 1246 | case Hexagon::POST_LDriub_cNotPt: |
| 1247 | case Hexagon::POST_LDriub_cdnPt_V4: |
| 1248 | case Hexagon::POST_LDriub_cdnNotPt_V4: |
| 1249 | |
| 1250 | // Load halfword |
| 1251 | case Hexagon::POST_LDrih: |
| 1252 | case Hexagon::POST_LDrih_cPt: |
| 1253 | case Hexagon::POST_LDrih_cNotPt: |
| 1254 | case Hexagon::POST_LDrih_cdnPt_V4: |
| 1255 | case Hexagon::POST_LDrih_cdnNotPt_V4: |
| 1256 | |
| 1257 | // Load unsigned halfword |
| 1258 | case Hexagon::POST_LDriuh: |
| 1259 | case Hexagon::POST_LDriuh_cPt: |
| 1260 | case Hexagon::POST_LDriuh_cNotPt: |
| 1261 | case Hexagon::POST_LDriuh_cdnPt_V4: |
| 1262 | case Hexagon::POST_LDriuh_cdnNotPt_V4: |
| 1263 | |
| 1264 | // Load word |
| 1265 | case Hexagon::POST_LDriw: |
| 1266 | case Hexagon::POST_LDriw_cPt: |
| 1267 | case Hexagon::POST_LDriw_cNotPt: |
| 1268 | case Hexagon::POST_LDriw_cdnPt_V4: |
| 1269 | case Hexagon::POST_LDriw_cdnNotPt_V4: |
| 1270 | |
| 1271 | // Load double word |
| 1272 | case Hexagon::POST_LDrid: |
| 1273 | case Hexagon::POST_LDrid_cPt: |
| 1274 | case Hexagon::POST_LDrid_cNotPt: |
| 1275 | case Hexagon::POST_LDrid_cdnPt_V4: |
| 1276 | case Hexagon::POST_LDrid_cdnNotPt_V4: |
| 1277 | |
| 1278 | // Store byte |
| 1279 | case Hexagon::POST_STbri: |
| 1280 | case Hexagon::POST_STbri_cPt: |
| 1281 | case Hexagon::POST_STbri_cNotPt: |
| 1282 | case Hexagon::POST_STbri_cdnPt_V4: |
| 1283 | case Hexagon::POST_STbri_cdnNotPt_V4: |
| 1284 | |
| 1285 | // Store halfword |
| 1286 | case Hexagon::POST_SThri: |
| 1287 | case Hexagon::POST_SThri_cPt: |
| 1288 | case Hexagon::POST_SThri_cNotPt: |
| 1289 | case Hexagon::POST_SThri_cdnPt_V4: |
| 1290 | case Hexagon::POST_SThri_cdnNotPt_V4: |
| 1291 | |
| 1292 | // Store word |
| 1293 | case Hexagon::POST_STwri: |
| 1294 | case Hexagon::POST_STwri_cPt: |
| 1295 | case Hexagon::POST_STwri_cNotPt: |
| 1296 | case Hexagon::POST_STwri_cdnPt_V4: |
| 1297 | case Hexagon::POST_STwri_cdnNotPt_V4: |
| 1298 | |
| 1299 | // Store double word |
| 1300 | case Hexagon::POST_STdri: |
| 1301 | case Hexagon::POST_STdri_cPt: |
| 1302 | case Hexagon::POST_STdri_cNotPt: |
| 1303 | case Hexagon::POST_STdri_cdnPt_V4: |
| 1304 | case Hexagon::POST_STdri_cdnNotPt_V4: |
| 1305 | return true; |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | bool HexagonInstrInfo::isSaveCalleeSavedRegsCall(const MachineInstr *MI) const { |
| 1310 | return MI->getOpcode() == Hexagon::SAVE_REGISTERS_CALL_V4; |
| 1311 | } |
Andrew Trick | ee498d3 | 2012-02-01 22:13:57 +0000 | [diff] [blame] | 1312 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1313 | bool HexagonInstrInfo::isPredicable(MachineInstr *MI) const { |
| 1314 | bool isPred = MI->getDesc().isPredicable(); |
| 1315 | |
| 1316 | if (!isPred) |
| 1317 | return false; |
| 1318 | |
| 1319 | const int Opc = MI->getOpcode(); |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1320 | int NumOperands = MI->getNumOperands(); |
| 1321 | |
| 1322 | // Keep a flag for upto 4 operands in the instructions, to indicate if |
| 1323 | // that operand has been constant extended. |
| 1324 | bool OpCExtended[4]; |
| 1325 | if (NumOperands > 4) |
| 1326 | NumOperands = 4; |
| 1327 | |
| 1328 | for (int i=0; i<NumOperands; i++) |
| 1329 | OpCExtended[i] = (HexagonConstExt::isOperandExtended(Opc, 1) && |
| 1330 | isConstExtended(MI)); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1331 | |
| 1332 | switch(Opc) { |
| 1333 | case Hexagon::TFRI: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1334 | // Return true if MI is constant extended as predicated form will also be |
| 1335 | // extended so immediate value doesn't have to fit within range. |
| 1336 | return OpCExtended[1] || isInt<12>(MI->getOperand(1).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1337 | |
| 1338 | case Hexagon::STrid: |
| 1339 | case Hexagon::STrid_indexed: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1340 | return OpCExtended[1] || isShiftedUInt<6,3>(MI->getOperand(1).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1341 | |
| 1342 | case Hexagon::STriw: |
| 1343 | case Hexagon::STriw_indexed: |
| 1344 | case Hexagon::STriw_nv_V4: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1345 | return OpCExtended[1] || isShiftedUInt<6,2>(MI->getOperand(1).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1346 | |
| 1347 | case Hexagon::STrih: |
| 1348 | case Hexagon::STrih_indexed: |
| 1349 | case Hexagon::STrih_nv_V4: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1350 | return OpCExtended[1] || isShiftedUInt<6,1>(MI->getOperand(1).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1351 | |
| 1352 | case Hexagon::STrib: |
| 1353 | case Hexagon::STrib_indexed: |
| 1354 | case Hexagon::STrib_nv_V4: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1355 | return OpCExtended[1] || isUInt<6>(MI->getOperand(1).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1356 | |
| 1357 | case Hexagon::LDrid: |
| 1358 | case Hexagon::LDrid_indexed: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1359 | return OpCExtended[2] || isShiftedUInt<6,3>(MI->getOperand(2).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1360 | |
| 1361 | case Hexagon::LDriw: |
| 1362 | case Hexagon::LDriw_indexed: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1363 | return OpCExtended[2] || isShiftedUInt<6,2>(MI->getOperand(2).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1364 | |
| 1365 | case Hexagon::LDrih: |
| 1366 | case Hexagon::LDriuh: |
| 1367 | case Hexagon::LDrih_indexed: |
| 1368 | case Hexagon::LDriuh_indexed: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1369 | return OpCExtended[2] || isShiftedUInt<6,1>(MI->getOperand(2).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1370 | |
| 1371 | case Hexagon::LDrib: |
| 1372 | case Hexagon::LDriub: |
| 1373 | case Hexagon::LDrib_indexed: |
| 1374 | case Hexagon::LDriub_indexed: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1375 | return OpCExtended[2] || isUInt<6>(MI->getOperand(2).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1376 | |
| 1377 | case Hexagon::POST_LDrid: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1378 | return OpCExtended[3] || isShiftedInt<4,3>(MI->getOperand(3).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1379 | |
| 1380 | case Hexagon::POST_LDriw: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1381 | return OpCExtended[3] || isShiftedInt<4,2>(MI->getOperand(3).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1382 | |
| 1383 | case Hexagon::POST_LDrih: |
| 1384 | case Hexagon::POST_LDriuh: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1385 | return OpCExtended[3] || isShiftedInt<4,1>(MI->getOperand(3).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1386 | |
| 1387 | case Hexagon::POST_LDrib: |
| 1388 | case Hexagon::POST_LDriub: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1389 | return OpCExtended[3] || isInt<4>(MI->getOperand(3).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1390 | |
| 1391 | case Hexagon::STrib_imm_V4: |
| 1392 | case Hexagon::STrih_imm_V4: |
| 1393 | case Hexagon::STriw_imm_V4: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1394 | return ((OpCExtended[1] || isUInt<6>(MI->getOperand(1).getImm())) && |
| 1395 | (OpCExtended[2] || isInt<6>(MI->getOperand(2).getImm()))); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1396 | |
| 1397 | case Hexagon::ADD_ri: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 1398 | return OpCExtended[2] || isInt<8>(MI->getOperand(2).getImm()); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1399 | |
| 1400 | case Hexagon::ASLH: |
| 1401 | case Hexagon::ASRH: |
| 1402 | case Hexagon::SXTB: |
| 1403 | case Hexagon::SXTH: |
| 1404 | case Hexagon::ZXTB: |
| 1405 | case Hexagon::ZXTH: |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 1406 | return Subtarget.hasV4TOps(); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1407 | |
| 1408 | case Hexagon::JMPR: |
| 1409 | return false; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1410 | } |
| 1411 | |
| 1412 | return true; |
| 1413 | } |
| 1414 | |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 1415 | // This function performs the following inversiones: |
| 1416 | // |
| 1417 | // cPt ---> cNotPt |
| 1418 | // cNotPt ---> cPt |
| 1419 | // |
| 1420 | // however, these inversiones are NOT included: |
| 1421 | // |
| 1422 | // cdnPt -X-> cdnNotPt |
| 1423 | // cdnNotPt -X-> cdnPt |
| 1424 | // cPt_nv -X-> cNotPt_nv (new value stores) |
| 1425 | // cNotPt_nv -X-> cPt_nv (new value stores) |
| 1426 | // |
| 1427 | // because only the following transformations are allowed: |
| 1428 | // |
| 1429 | // cNotPt ---> cdnNotPt |
| 1430 | // cPt ---> cdnPt |
| 1431 | // cNotPt ---> cNotPt_nv |
| 1432 | // cPt ---> cPt_nv |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 1433 | unsigned HexagonInstrInfo::getInvertedPredicatedOpcode(const int Opc) const { |
| 1434 | switch(Opc) { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 1435 | default: llvm_unreachable("Unexpected predicated instruction"); |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 1436 | case Hexagon::TFR_cPt: |
| 1437 | return Hexagon::TFR_cNotPt; |
| 1438 | case Hexagon::TFR_cNotPt: |
| 1439 | return Hexagon::TFR_cPt; |
| 1440 | |
| 1441 | case Hexagon::TFRI_cPt: |
| 1442 | return Hexagon::TFRI_cNotPt; |
| 1443 | case Hexagon::TFRI_cNotPt: |
| 1444 | return Hexagon::TFRI_cPt; |
| 1445 | |
| 1446 | case Hexagon::JMP_c: |
| 1447 | return Hexagon::JMP_cNot; |
| 1448 | case Hexagon::JMP_cNot: |
| 1449 | return Hexagon::JMP_c; |
| 1450 | |
| 1451 | case Hexagon::ADD_ri_cPt: |
| 1452 | return Hexagon::ADD_ri_cNotPt; |
| 1453 | case Hexagon::ADD_ri_cNotPt: |
| 1454 | return Hexagon::ADD_ri_cPt; |
| 1455 | |
| 1456 | case Hexagon::ADD_rr_cPt: |
| 1457 | return Hexagon::ADD_rr_cNotPt; |
| 1458 | case Hexagon::ADD_rr_cNotPt: |
| 1459 | return Hexagon::ADD_rr_cPt; |
| 1460 | |
| 1461 | case Hexagon::XOR_rr_cPt: |
| 1462 | return Hexagon::XOR_rr_cNotPt; |
| 1463 | case Hexagon::XOR_rr_cNotPt: |
| 1464 | return Hexagon::XOR_rr_cPt; |
| 1465 | |
| 1466 | case Hexagon::AND_rr_cPt: |
| 1467 | return Hexagon::AND_rr_cNotPt; |
| 1468 | case Hexagon::AND_rr_cNotPt: |
| 1469 | return Hexagon::AND_rr_cPt; |
| 1470 | |
| 1471 | case Hexagon::OR_rr_cPt: |
| 1472 | return Hexagon::OR_rr_cNotPt; |
| 1473 | case Hexagon::OR_rr_cNotPt: |
| 1474 | return Hexagon::OR_rr_cPt; |
| 1475 | |
| 1476 | case Hexagon::SUB_rr_cPt: |
| 1477 | return Hexagon::SUB_rr_cNotPt; |
| 1478 | case Hexagon::SUB_rr_cNotPt: |
| 1479 | return Hexagon::SUB_rr_cPt; |
| 1480 | |
| 1481 | case Hexagon::COMBINE_rr_cPt: |
| 1482 | return Hexagon::COMBINE_rr_cNotPt; |
| 1483 | case Hexagon::COMBINE_rr_cNotPt: |
| 1484 | return Hexagon::COMBINE_rr_cPt; |
| 1485 | |
| 1486 | case Hexagon::ASLH_cPt_V4: |
| 1487 | return Hexagon::ASLH_cNotPt_V4; |
| 1488 | case Hexagon::ASLH_cNotPt_V4: |
| 1489 | return Hexagon::ASLH_cPt_V4; |
| 1490 | |
| 1491 | case Hexagon::ASRH_cPt_V4: |
| 1492 | return Hexagon::ASRH_cNotPt_V4; |
| 1493 | case Hexagon::ASRH_cNotPt_V4: |
| 1494 | return Hexagon::ASRH_cPt_V4; |
| 1495 | |
| 1496 | case Hexagon::SXTB_cPt_V4: |
| 1497 | return Hexagon::SXTB_cNotPt_V4; |
| 1498 | case Hexagon::SXTB_cNotPt_V4: |
| 1499 | return Hexagon::SXTB_cPt_V4; |
| 1500 | |
| 1501 | case Hexagon::SXTH_cPt_V4: |
| 1502 | return Hexagon::SXTH_cNotPt_V4; |
| 1503 | case Hexagon::SXTH_cNotPt_V4: |
| 1504 | return Hexagon::SXTH_cPt_V4; |
| 1505 | |
| 1506 | case Hexagon::ZXTB_cPt_V4: |
| 1507 | return Hexagon::ZXTB_cNotPt_V4; |
| 1508 | case Hexagon::ZXTB_cNotPt_V4: |
| 1509 | return Hexagon::ZXTB_cPt_V4; |
| 1510 | |
| 1511 | case Hexagon::ZXTH_cPt_V4: |
| 1512 | return Hexagon::ZXTH_cNotPt_V4; |
| 1513 | case Hexagon::ZXTH_cNotPt_V4: |
| 1514 | return Hexagon::ZXTH_cPt_V4; |
| 1515 | |
| 1516 | |
| 1517 | case Hexagon::JMPR_cPt: |
| 1518 | return Hexagon::JMPR_cNotPt; |
| 1519 | case Hexagon::JMPR_cNotPt: |
| 1520 | return Hexagon::JMPR_cPt; |
| 1521 | |
| 1522 | // V4 indexed+scaled load. |
| 1523 | case Hexagon::LDrid_indexed_cPt_V4: |
| 1524 | return Hexagon::LDrid_indexed_cNotPt_V4; |
| 1525 | case Hexagon::LDrid_indexed_cNotPt_V4: |
| 1526 | return Hexagon::LDrid_indexed_cPt_V4; |
| 1527 | |
| 1528 | case Hexagon::LDrid_indexed_shl_cPt_V4: |
| 1529 | return Hexagon::LDrid_indexed_shl_cNotPt_V4; |
| 1530 | case Hexagon::LDrid_indexed_shl_cNotPt_V4: |
| 1531 | return Hexagon::LDrid_indexed_shl_cPt_V4; |
| 1532 | |
| 1533 | case Hexagon::LDrib_indexed_cPt_V4: |
| 1534 | return Hexagon::LDrib_indexed_cNotPt_V4; |
| 1535 | case Hexagon::LDrib_indexed_cNotPt_V4: |
| 1536 | return Hexagon::LDrib_indexed_cPt_V4; |
| 1537 | |
| 1538 | case Hexagon::LDriub_indexed_cPt_V4: |
| 1539 | return Hexagon::LDriub_indexed_cNotPt_V4; |
| 1540 | case Hexagon::LDriub_indexed_cNotPt_V4: |
| 1541 | return Hexagon::LDriub_indexed_cPt_V4; |
| 1542 | |
| 1543 | case Hexagon::LDrib_indexed_shl_cPt_V4: |
| 1544 | return Hexagon::LDrib_indexed_shl_cNotPt_V4; |
| 1545 | case Hexagon::LDrib_indexed_shl_cNotPt_V4: |
| 1546 | return Hexagon::LDrib_indexed_shl_cPt_V4; |
| 1547 | |
| 1548 | case Hexagon::LDriub_indexed_shl_cPt_V4: |
| 1549 | return Hexagon::LDriub_indexed_shl_cNotPt_V4; |
| 1550 | case Hexagon::LDriub_indexed_shl_cNotPt_V4: |
| 1551 | return Hexagon::LDriub_indexed_shl_cPt_V4; |
| 1552 | |
| 1553 | case Hexagon::LDrih_indexed_cPt_V4: |
| 1554 | return Hexagon::LDrih_indexed_cNotPt_V4; |
| 1555 | case Hexagon::LDrih_indexed_cNotPt_V4: |
| 1556 | return Hexagon::LDrih_indexed_cPt_V4; |
| 1557 | |
| 1558 | case Hexagon::LDriuh_indexed_cPt_V4: |
| 1559 | return Hexagon::LDriuh_indexed_cNotPt_V4; |
| 1560 | case Hexagon::LDriuh_indexed_cNotPt_V4: |
| 1561 | return Hexagon::LDriuh_indexed_cPt_V4; |
| 1562 | |
| 1563 | case Hexagon::LDrih_indexed_shl_cPt_V4: |
| 1564 | return Hexagon::LDrih_indexed_shl_cNotPt_V4; |
| 1565 | case Hexagon::LDrih_indexed_shl_cNotPt_V4: |
| 1566 | return Hexagon::LDrih_indexed_shl_cPt_V4; |
| 1567 | |
| 1568 | case Hexagon::LDriuh_indexed_shl_cPt_V4: |
| 1569 | return Hexagon::LDriuh_indexed_shl_cNotPt_V4; |
| 1570 | case Hexagon::LDriuh_indexed_shl_cNotPt_V4: |
| 1571 | return Hexagon::LDriuh_indexed_shl_cPt_V4; |
| 1572 | |
| 1573 | case Hexagon::LDriw_indexed_cPt_V4: |
| 1574 | return Hexagon::LDriw_indexed_cNotPt_V4; |
| 1575 | case Hexagon::LDriw_indexed_cNotPt_V4: |
| 1576 | return Hexagon::LDriw_indexed_cPt_V4; |
| 1577 | |
| 1578 | case Hexagon::LDriw_indexed_shl_cPt_V4: |
| 1579 | return Hexagon::LDriw_indexed_shl_cNotPt_V4; |
| 1580 | case Hexagon::LDriw_indexed_shl_cNotPt_V4: |
| 1581 | return Hexagon::LDriw_indexed_shl_cPt_V4; |
| 1582 | |
| 1583 | // Byte. |
| 1584 | case Hexagon::POST_STbri_cPt: |
| 1585 | return Hexagon::POST_STbri_cNotPt; |
| 1586 | case Hexagon::POST_STbri_cNotPt: |
| 1587 | return Hexagon::POST_STbri_cPt; |
| 1588 | |
| 1589 | case Hexagon::STrib_cPt: |
| 1590 | return Hexagon::STrib_cNotPt; |
| 1591 | case Hexagon::STrib_cNotPt: |
| 1592 | return Hexagon::STrib_cPt; |
| 1593 | |
| 1594 | case Hexagon::STrib_indexed_cPt: |
| 1595 | return Hexagon::STrib_indexed_cNotPt; |
| 1596 | case Hexagon::STrib_indexed_cNotPt: |
| 1597 | return Hexagon::STrib_indexed_cPt; |
| 1598 | |
| 1599 | case Hexagon::STrib_imm_cPt_V4: |
| 1600 | return Hexagon::STrib_imm_cNotPt_V4; |
| 1601 | case Hexagon::STrib_imm_cNotPt_V4: |
| 1602 | return Hexagon::STrib_imm_cPt_V4; |
| 1603 | |
| 1604 | case Hexagon::STrib_indexed_shl_cPt_V4: |
| 1605 | return Hexagon::STrib_indexed_shl_cNotPt_V4; |
| 1606 | case Hexagon::STrib_indexed_shl_cNotPt_V4: |
| 1607 | return Hexagon::STrib_indexed_shl_cPt_V4; |
| 1608 | |
| 1609 | // Halfword. |
| 1610 | case Hexagon::POST_SThri_cPt: |
| 1611 | return Hexagon::POST_SThri_cNotPt; |
| 1612 | case Hexagon::POST_SThri_cNotPt: |
| 1613 | return Hexagon::POST_SThri_cPt; |
| 1614 | |
| 1615 | case Hexagon::STrih_cPt: |
| 1616 | return Hexagon::STrih_cNotPt; |
| 1617 | case Hexagon::STrih_cNotPt: |
| 1618 | return Hexagon::STrih_cPt; |
| 1619 | |
| 1620 | case Hexagon::STrih_indexed_cPt: |
| 1621 | return Hexagon::STrih_indexed_cNotPt; |
| 1622 | case Hexagon::STrih_indexed_cNotPt: |
| 1623 | return Hexagon::STrih_indexed_cPt; |
| 1624 | |
| 1625 | case Hexagon::STrih_imm_cPt_V4: |
| 1626 | return Hexagon::STrih_imm_cNotPt_V4; |
| 1627 | case Hexagon::STrih_imm_cNotPt_V4: |
| 1628 | return Hexagon::STrih_imm_cPt_V4; |
| 1629 | |
| 1630 | case Hexagon::STrih_indexed_shl_cPt_V4: |
| 1631 | return Hexagon::STrih_indexed_shl_cNotPt_V4; |
| 1632 | case Hexagon::STrih_indexed_shl_cNotPt_V4: |
| 1633 | return Hexagon::STrih_indexed_shl_cPt_V4; |
| 1634 | |
| 1635 | // Word. |
| 1636 | case Hexagon::POST_STwri_cPt: |
| 1637 | return Hexagon::POST_STwri_cNotPt; |
| 1638 | case Hexagon::POST_STwri_cNotPt: |
| 1639 | return Hexagon::POST_STwri_cPt; |
| 1640 | |
| 1641 | case Hexagon::STriw_cPt: |
| 1642 | return Hexagon::STriw_cNotPt; |
| 1643 | case Hexagon::STriw_cNotPt: |
| 1644 | return Hexagon::STriw_cPt; |
| 1645 | |
| 1646 | case Hexagon::STriw_indexed_cPt: |
| 1647 | return Hexagon::STriw_indexed_cNotPt; |
| 1648 | case Hexagon::STriw_indexed_cNotPt: |
| 1649 | return Hexagon::STriw_indexed_cPt; |
| 1650 | |
| 1651 | case Hexagon::STriw_indexed_shl_cPt_V4: |
| 1652 | return Hexagon::STriw_indexed_shl_cNotPt_V4; |
| 1653 | case Hexagon::STriw_indexed_shl_cNotPt_V4: |
| 1654 | return Hexagon::STriw_indexed_shl_cPt_V4; |
| 1655 | |
| 1656 | case Hexagon::STriw_imm_cPt_V4: |
| 1657 | return Hexagon::STriw_imm_cNotPt_V4; |
| 1658 | case Hexagon::STriw_imm_cNotPt_V4: |
| 1659 | return Hexagon::STriw_imm_cPt_V4; |
| 1660 | |
| 1661 | // Double word. |
| 1662 | case Hexagon::POST_STdri_cPt: |
| 1663 | return Hexagon::POST_STdri_cNotPt; |
| 1664 | case Hexagon::POST_STdri_cNotPt: |
| 1665 | return Hexagon::POST_STdri_cPt; |
| 1666 | |
| 1667 | case Hexagon::STrid_cPt: |
| 1668 | return Hexagon::STrid_cNotPt; |
| 1669 | case Hexagon::STrid_cNotPt: |
| 1670 | return Hexagon::STrid_cPt; |
| 1671 | |
| 1672 | case Hexagon::STrid_indexed_cPt: |
| 1673 | return Hexagon::STrid_indexed_cNotPt; |
| 1674 | case Hexagon::STrid_indexed_cNotPt: |
| 1675 | return Hexagon::STrid_indexed_cPt; |
| 1676 | |
| 1677 | case Hexagon::STrid_indexed_shl_cPt_V4: |
| 1678 | return Hexagon::STrid_indexed_shl_cNotPt_V4; |
| 1679 | case Hexagon::STrid_indexed_shl_cNotPt_V4: |
| 1680 | return Hexagon::STrid_indexed_shl_cPt_V4; |
| 1681 | |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 1682 | // V4 Store to global address. |
| 1683 | case Hexagon::STd_GP_cPt_V4: |
| 1684 | return Hexagon::STd_GP_cNotPt_V4; |
| 1685 | case Hexagon::STd_GP_cNotPt_V4: |
| 1686 | return Hexagon::STd_GP_cPt_V4; |
| 1687 | |
| 1688 | case Hexagon::STb_GP_cPt_V4: |
| 1689 | return Hexagon::STb_GP_cNotPt_V4; |
| 1690 | case Hexagon::STb_GP_cNotPt_V4: |
| 1691 | return Hexagon::STb_GP_cPt_V4; |
| 1692 | |
| 1693 | case Hexagon::STh_GP_cPt_V4: |
| 1694 | return Hexagon::STh_GP_cNotPt_V4; |
| 1695 | case Hexagon::STh_GP_cNotPt_V4: |
| 1696 | return Hexagon::STh_GP_cPt_V4; |
| 1697 | |
| 1698 | case Hexagon::STw_GP_cPt_V4: |
| 1699 | return Hexagon::STw_GP_cNotPt_V4; |
| 1700 | case Hexagon::STw_GP_cNotPt_V4: |
| 1701 | return Hexagon::STw_GP_cPt_V4; |
| 1702 | |
| 1703 | case Hexagon::STrid_GP_cPt_V4: |
| 1704 | return Hexagon::STrid_GP_cNotPt_V4; |
| 1705 | case Hexagon::STrid_GP_cNotPt_V4: |
| 1706 | return Hexagon::STrid_GP_cPt_V4; |
| 1707 | |
| 1708 | case Hexagon::STrib_GP_cPt_V4: |
| 1709 | return Hexagon::STrib_GP_cNotPt_V4; |
| 1710 | case Hexagon::STrib_GP_cNotPt_V4: |
| 1711 | return Hexagon::STrib_GP_cPt_V4; |
| 1712 | |
| 1713 | case Hexagon::STrih_GP_cPt_V4: |
| 1714 | return Hexagon::STrih_GP_cNotPt_V4; |
| 1715 | case Hexagon::STrih_GP_cNotPt_V4: |
| 1716 | return Hexagon::STrih_GP_cPt_V4; |
| 1717 | |
| 1718 | case Hexagon::STriw_GP_cPt_V4: |
| 1719 | return Hexagon::STriw_GP_cNotPt_V4; |
| 1720 | case Hexagon::STriw_GP_cNotPt_V4: |
| 1721 | return Hexagon::STriw_GP_cPt_V4; |
| 1722 | |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 1723 | // Load. |
| 1724 | case Hexagon::LDrid_cPt: |
| 1725 | return Hexagon::LDrid_cNotPt; |
| 1726 | case Hexagon::LDrid_cNotPt: |
| 1727 | return Hexagon::LDrid_cPt; |
| 1728 | |
| 1729 | case Hexagon::LDriw_cPt: |
| 1730 | return Hexagon::LDriw_cNotPt; |
| 1731 | case Hexagon::LDriw_cNotPt: |
| 1732 | return Hexagon::LDriw_cPt; |
| 1733 | |
| 1734 | case Hexagon::LDrih_cPt: |
| 1735 | return Hexagon::LDrih_cNotPt; |
| 1736 | case Hexagon::LDrih_cNotPt: |
| 1737 | return Hexagon::LDrih_cPt; |
| 1738 | |
| 1739 | case Hexagon::LDriuh_cPt: |
| 1740 | return Hexagon::LDriuh_cNotPt; |
| 1741 | case Hexagon::LDriuh_cNotPt: |
| 1742 | return Hexagon::LDriuh_cPt; |
| 1743 | |
| 1744 | case Hexagon::LDrib_cPt: |
| 1745 | return Hexagon::LDrib_cNotPt; |
| 1746 | case Hexagon::LDrib_cNotPt: |
| 1747 | return Hexagon::LDrib_cPt; |
| 1748 | |
| 1749 | case Hexagon::LDriub_cPt: |
| 1750 | return Hexagon::LDriub_cNotPt; |
| 1751 | case Hexagon::LDriub_cNotPt: |
| 1752 | return Hexagon::LDriub_cPt; |
| 1753 | |
| 1754 | // Load Indexed. |
| 1755 | case Hexagon::LDrid_indexed_cPt: |
| 1756 | return Hexagon::LDrid_indexed_cNotPt; |
| 1757 | case Hexagon::LDrid_indexed_cNotPt: |
| 1758 | return Hexagon::LDrid_indexed_cPt; |
| 1759 | |
| 1760 | case Hexagon::LDriw_indexed_cPt: |
| 1761 | return Hexagon::LDriw_indexed_cNotPt; |
| 1762 | case Hexagon::LDriw_indexed_cNotPt: |
| 1763 | return Hexagon::LDriw_indexed_cPt; |
| 1764 | |
| 1765 | case Hexagon::LDrih_indexed_cPt: |
| 1766 | return Hexagon::LDrih_indexed_cNotPt; |
| 1767 | case Hexagon::LDrih_indexed_cNotPt: |
| 1768 | return Hexagon::LDrih_indexed_cPt; |
| 1769 | |
| 1770 | case Hexagon::LDriuh_indexed_cPt: |
| 1771 | return Hexagon::LDriuh_indexed_cNotPt; |
| 1772 | case Hexagon::LDriuh_indexed_cNotPt: |
| 1773 | return Hexagon::LDriuh_indexed_cPt; |
| 1774 | |
| 1775 | case Hexagon::LDrib_indexed_cPt: |
| 1776 | return Hexagon::LDrib_indexed_cNotPt; |
| 1777 | case Hexagon::LDrib_indexed_cNotPt: |
| 1778 | return Hexagon::LDrib_indexed_cPt; |
| 1779 | |
| 1780 | case Hexagon::LDriub_indexed_cPt: |
| 1781 | return Hexagon::LDriub_indexed_cNotPt; |
| 1782 | case Hexagon::LDriub_indexed_cNotPt: |
| 1783 | return Hexagon::LDriub_indexed_cPt; |
| 1784 | |
| 1785 | // Post Inc Load. |
| 1786 | case Hexagon::POST_LDrid_cPt: |
| 1787 | return Hexagon::POST_LDrid_cNotPt; |
| 1788 | case Hexagon::POST_LDriw_cNotPt: |
| 1789 | return Hexagon::POST_LDriw_cPt; |
| 1790 | |
| 1791 | case Hexagon::POST_LDrih_cPt: |
| 1792 | return Hexagon::POST_LDrih_cNotPt; |
| 1793 | case Hexagon::POST_LDrih_cNotPt: |
| 1794 | return Hexagon::POST_LDrih_cPt; |
| 1795 | |
| 1796 | case Hexagon::POST_LDriuh_cPt: |
| 1797 | return Hexagon::POST_LDriuh_cNotPt; |
| 1798 | case Hexagon::POST_LDriuh_cNotPt: |
| 1799 | return Hexagon::POST_LDriuh_cPt; |
| 1800 | |
| 1801 | case Hexagon::POST_LDrib_cPt: |
| 1802 | return Hexagon::POST_LDrib_cNotPt; |
| 1803 | case Hexagon::POST_LDrib_cNotPt: |
| 1804 | return Hexagon::POST_LDrib_cPt; |
| 1805 | |
| 1806 | case Hexagon::POST_LDriub_cPt: |
| 1807 | return Hexagon::POST_LDriub_cNotPt; |
| 1808 | case Hexagon::POST_LDriub_cNotPt: |
| 1809 | return Hexagon::POST_LDriub_cPt; |
| 1810 | |
| 1811 | // Dealloc_return. |
| 1812 | case Hexagon::DEALLOC_RET_cPt_V4: |
| 1813 | return Hexagon::DEALLOC_RET_cNotPt_V4; |
| 1814 | case Hexagon::DEALLOC_RET_cNotPt_V4: |
| 1815 | return Hexagon::DEALLOC_RET_cPt_V4; |
| 1816 | |
| 1817 | // New Value Jump. |
| 1818 | // JMPEQ_ri - with -1. |
| 1819 | case Hexagon::JMP_EQriPtneg_nv_V4: |
| 1820 | return Hexagon::JMP_EQriNotPtneg_nv_V4; |
| 1821 | case Hexagon::JMP_EQriNotPtneg_nv_V4: |
| 1822 | return Hexagon::JMP_EQriPtneg_nv_V4; |
| 1823 | |
| 1824 | case Hexagon::JMP_EQriPntneg_nv_V4: |
| 1825 | return Hexagon::JMP_EQriNotPntneg_nv_V4; |
| 1826 | case Hexagon::JMP_EQriNotPntneg_nv_V4: |
| 1827 | return Hexagon::JMP_EQriPntneg_nv_V4; |
| 1828 | |
| 1829 | // JMPEQ_ri. |
| 1830 | case Hexagon::JMP_EQriPt_nv_V4: |
| 1831 | return Hexagon::JMP_EQriNotPt_nv_V4; |
| 1832 | case Hexagon::JMP_EQriNotPt_nv_V4: |
| 1833 | return Hexagon::JMP_EQriPt_nv_V4; |
| 1834 | |
| 1835 | case Hexagon::JMP_EQriPnt_nv_V4: |
| 1836 | return Hexagon::JMP_EQriNotPnt_nv_V4; |
| 1837 | case Hexagon::JMP_EQriNotPnt_nv_V4: |
| 1838 | return Hexagon::JMP_EQriPnt_nv_V4; |
| 1839 | |
| 1840 | // JMPEQ_rr. |
| 1841 | case Hexagon::JMP_EQrrPt_nv_V4: |
| 1842 | return Hexagon::JMP_EQrrNotPt_nv_V4; |
| 1843 | case Hexagon::JMP_EQrrNotPt_nv_V4: |
| 1844 | return Hexagon::JMP_EQrrPt_nv_V4; |
| 1845 | |
| 1846 | case Hexagon::JMP_EQrrPnt_nv_V4: |
| 1847 | return Hexagon::JMP_EQrrNotPnt_nv_V4; |
| 1848 | case Hexagon::JMP_EQrrNotPnt_nv_V4: |
| 1849 | return Hexagon::JMP_EQrrPnt_nv_V4; |
| 1850 | |
| 1851 | // JMPGT_ri - with -1. |
| 1852 | case Hexagon::JMP_GTriPtneg_nv_V4: |
| 1853 | return Hexagon::JMP_GTriNotPtneg_nv_V4; |
| 1854 | case Hexagon::JMP_GTriNotPtneg_nv_V4: |
| 1855 | return Hexagon::JMP_GTriPtneg_nv_V4; |
| 1856 | |
| 1857 | case Hexagon::JMP_GTriPntneg_nv_V4: |
| 1858 | return Hexagon::JMP_GTriNotPntneg_nv_V4; |
| 1859 | case Hexagon::JMP_GTriNotPntneg_nv_V4: |
| 1860 | return Hexagon::JMP_GTriPntneg_nv_V4; |
| 1861 | |
| 1862 | // JMPGT_ri. |
| 1863 | case Hexagon::JMP_GTriPt_nv_V4: |
| 1864 | return Hexagon::JMP_GTriNotPt_nv_V4; |
| 1865 | case Hexagon::JMP_GTriNotPt_nv_V4: |
| 1866 | return Hexagon::JMP_GTriPt_nv_V4; |
| 1867 | |
| 1868 | case Hexagon::JMP_GTriPnt_nv_V4: |
| 1869 | return Hexagon::JMP_GTriNotPnt_nv_V4; |
| 1870 | case Hexagon::JMP_GTriNotPnt_nv_V4: |
| 1871 | return Hexagon::JMP_GTriPnt_nv_V4; |
| 1872 | |
| 1873 | // JMPGT_rr. |
| 1874 | case Hexagon::JMP_GTrrPt_nv_V4: |
| 1875 | return Hexagon::JMP_GTrrNotPt_nv_V4; |
| 1876 | case Hexagon::JMP_GTrrNotPt_nv_V4: |
| 1877 | return Hexagon::JMP_GTrrPt_nv_V4; |
| 1878 | |
| 1879 | case Hexagon::JMP_GTrrPnt_nv_V4: |
| 1880 | return Hexagon::JMP_GTrrNotPnt_nv_V4; |
| 1881 | case Hexagon::JMP_GTrrNotPnt_nv_V4: |
| 1882 | return Hexagon::JMP_GTrrPnt_nv_V4; |
| 1883 | |
| 1884 | // JMPGT_rrdn. |
| 1885 | case Hexagon::JMP_GTrrdnPt_nv_V4: |
| 1886 | return Hexagon::JMP_GTrrdnNotPt_nv_V4; |
| 1887 | case Hexagon::JMP_GTrrdnNotPt_nv_V4: |
| 1888 | return Hexagon::JMP_GTrrdnPt_nv_V4; |
| 1889 | |
| 1890 | case Hexagon::JMP_GTrrdnPnt_nv_V4: |
| 1891 | return Hexagon::JMP_GTrrdnNotPnt_nv_V4; |
| 1892 | case Hexagon::JMP_GTrrdnNotPnt_nv_V4: |
| 1893 | return Hexagon::JMP_GTrrdnPnt_nv_V4; |
| 1894 | |
| 1895 | // JMPGTU_ri. |
| 1896 | case Hexagon::JMP_GTUriPt_nv_V4: |
| 1897 | return Hexagon::JMP_GTUriNotPt_nv_V4; |
| 1898 | case Hexagon::JMP_GTUriNotPt_nv_V4: |
| 1899 | return Hexagon::JMP_GTUriPt_nv_V4; |
| 1900 | |
| 1901 | case Hexagon::JMP_GTUriPnt_nv_V4: |
| 1902 | return Hexagon::JMP_GTUriNotPnt_nv_V4; |
| 1903 | case Hexagon::JMP_GTUriNotPnt_nv_V4: |
| 1904 | return Hexagon::JMP_GTUriPnt_nv_V4; |
| 1905 | |
| 1906 | // JMPGTU_rr. |
| 1907 | case Hexagon::JMP_GTUrrPt_nv_V4: |
| 1908 | return Hexagon::JMP_GTUrrNotPt_nv_V4; |
| 1909 | case Hexagon::JMP_GTUrrNotPt_nv_V4: |
| 1910 | return Hexagon::JMP_GTUrrPt_nv_V4; |
| 1911 | |
| 1912 | case Hexagon::JMP_GTUrrPnt_nv_V4: |
| 1913 | return Hexagon::JMP_GTUrrNotPnt_nv_V4; |
| 1914 | case Hexagon::JMP_GTUrrNotPnt_nv_V4: |
| 1915 | return Hexagon::JMP_GTUrrPnt_nv_V4; |
| 1916 | |
| 1917 | // JMPGTU_rrdn. |
| 1918 | case Hexagon::JMP_GTUrrdnPt_nv_V4: |
| 1919 | return Hexagon::JMP_GTUrrdnNotPt_nv_V4; |
| 1920 | case Hexagon::JMP_GTUrrdnNotPt_nv_V4: |
| 1921 | return Hexagon::JMP_GTUrrdnPt_nv_V4; |
| 1922 | |
| 1923 | case Hexagon::JMP_GTUrrdnPnt_nv_V4: |
| 1924 | return Hexagon::JMP_GTUrrdnNotPnt_nv_V4; |
| 1925 | case Hexagon::JMP_GTUrrdnNotPnt_nv_V4: |
| 1926 | return Hexagon::JMP_GTUrrdnPnt_nv_V4; |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 1927 | } |
| 1928 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1929 | |
Andrew Trick | ee498d3 | 2012-02-01 22:13:57 +0000 | [diff] [blame] | 1930 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1931 | int HexagonInstrInfo:: |
| 1932 | getMatchingCondBranchOpcode(int Opc, bool invertPredicate) const { |
| 1933 | switch(Opc) { |
| 1934 | case Hexagon::TFR: |
| 1935 | return !invertPredicate ? Hexagon::TFR_cPt : |
| 1936 | Hexagon::TFR_cNotPt; |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 1937 | case Hexagon::TFRI_f: |
| 1938 | return !invertPredicate ? Hexagon::TFRI_cPt_f : |
| 1939 | Hexagon::TFRI_cNotPt_f; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1940 | case Hexagon::TFRI: |
| 1941 | return !invertPredicate ? Hexagon::TFRI_cPt : |
| 1942 | Hexagon::TFRI_cNotPt; |
| 1943 | case Hexagon::JMP: |
Sirish Pande | ab7955b | 2012-02-15 18:52:27 +0000 | [diff] [blame] | 1944 | return !invertPredicate ? Hexagon::JMP_c : |
| 1945 | Hexagon::JMP_cNot; |
Sirish Pande | b338570 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 1946 | case Hexagon::JMP_EQrrPt_nv_V4: |
| 1947 | return !invertPredicate ? Hexagon::JMP_EQrrPt_nv_V4 : |
| 1948 | Hexagon::JMP_EQrrNotPt_nv_V4; |
| 1949 | case Hexagon::JMP_EQriPt_nv_V4: |
| 1950 | return !invertPredicate ? Hexagon::JMP_EQriPt_nv_V4 : |
| 1951 | Hexagon::JMP_EQriNotPt_nv_V4; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 1952 | case Hexagon::ADD_ri: |
| 1953 | return !invertPredicate ? Hexagon::ADD_ri_cPt : |
| 1954 | Hexagon::ADD_ri_cNotPt; |
| 1955 | case Hexagon::ADD_rr: |
| 1956 | return !invertPredicate ? Hexagon::ADD_rr_cPt : |
| 1957 | Hexagon::ADD_rr_cNotPt; |
| 1958 | case Hexagon::XOR_rr: |
| 1959 | return !invertPredicate ? Hexagon::XOR_rr_cPt : |
| 1960 | Hexagon::XOR_rr_cNotPt; |
| 1961 | case Hexagon::AND_rr: |
| 1962 | return !invertPredicate ? Hexagon::AND_rr_cPt : |
| 1963 | Hexagon::AND_rr_cNotPt; |
| 1964 | case Hexagon::OR_rr: |
| 1965 | return !invertPredicate ? Hexagon::OR_rr_cPt : |
| 1966 | Hexagon::OR_rr_cNotPt; |
| 1967 | case Hexagon::SUB_rr: |
| 1968 | return !invertPredicate ? Hexagon::SUB_rr_cPt : |
| 1969 | Hexagon::SUB_rr_cNotPt; |
| 1970 | case Hexagon::COMBINE_rr: |
| 1971 | return !invertPredicate ? Hexagon::COMBINE_rr_cPt : |
| 1972 | Hexagon::COMBINE_rr_cNotPt; |
| 1973 | case Hexagon::ASLH: |
| 1974 | return !invertPredicate ? Hexagon::ASLH_cPt_V4 : |
| 1975 | Hexagon::ASLH_cNotPt_V4; |
| 1976 | case Hexagon::ASRH: |
| 1977 | return !invertPredicate ? Hexagon::ASRH_cPt_V4 : |
| 1978 | Hexagon::ASRH_cNotPt_V4; |
| 1979 | case Hexagon::SXTB: |
| 1980 | return !invertPredicate ? Hexagon::SXTB_cPt_V4 : |
| 1981 | Hexagon::SXTB_cNotPt_V4; |
| 1982 | case Hexagon::SXTH: |
| 1983 | return !invertPredicate ? Hexagon::SXTH_cPt_V4 : |
| 1984 | Hexagon::SXTH_cNotPt_V4; |
| 1985 | case Hexagon::ZXTB: |
| 1986 | return !invertPredicate ? Hexagon::ZXTB_cPt_V4 : |
| 1987 | Hexagon::ZXTB_cNotPt_V4; |
| 1988 | case Hexagon::ZXTH: |
| 1989 | return !invertPredicate ? Hexagon::ZXTH_cPt_V4 : |
| 1990 | Hexagon::ZXTH_cNotPt_V4; |
| 1991 | |
| 1992 | case Hexagon::JMPR: |
| 1993 | return !invertPredicate ? Hexagon::JMPR_cPt : |
| 1994 | Hexagon::JMPR_cNotPt; |
| 1995 | |
| 1996 | // V4 indexed+scaled load. |
| 1997 | case Hexagon::LDrid_indexed_V4: |
| 1998 | return !invertPredicate ? Hexagon::LDrid_indexed_cPt_V4 : |
| 1999 | Hexagon::LDrid_indexed_cNotPt_V4; |
| 2000 | case Hexagon::LDrid_indexed_shl_V4: |
| 2001 | return !invertPredicate ? Hexagon::LDrid_indexed_shl_cPt_V4 : |
| 2002 | Hexagon::LDrid_indexed_shl_cNotPt_V4; |
| 2003 | case Hexagon::LDrib_indexed_V4: |
| 2004 | return !invertPredicate ? Hexagon::LDrib_indexed_cPt_V4 : |
| 2005 | Hexagon::LDrib_indexed_cNotPt_V4; |
| 2006 | case Hexagon::LDriub_indexed_V4: |
| 2007 | return !invertPredicate ? Hexagon::LDriub_indexed_cPt_V4 : |
| 2008 | Hexagon::LDriub_indexed_cNotPt_V4; |
| 2009 | case Hexagon::LDriub_ae_indexed_V4: |
| 2010 | return !invertPredicate ? Hexagon::LDriub_indexed_cPt_V4 : |
| 2011 | Hexagon::LDriub_indexed_cNotPt_V4; |
| 2012 | case Hexagon::LDrib_indexed_shl_V4: |
| 2013 | return !invertPredicate ? Hexagon::LDrib_indexed_shl_cPt_V4 : |
| 2014 | Hexagon::LDrib_indexed_shl_cNotPt_V4; |
| 2015 | case Hexagon::LDriub_indexed_shl_V4: |
| 2016 | return !invertPredicate ? Hexagon::LDriub_indexed_shl_cPt_V4 : |
| 2017 | Hexagon::LDriub_indexed_shl_cNotPt_V4; |
| 2018 | case Hexagon::LDriub_ae_indexed_shl_V4: |
| 2019 | return !invertPredicate ? Hexagon::LDriub_indexed_shl_cPt_V4 : |
| 2020 | Hexagon::LDriub_indexed_shl_cNotPt_V4; |
| 2021 | case Hexagon::LDrih_indexed_V4: |
| 2022 | return !invertPredicate ? Hexagon::LDrih_indexed_cPt_V4 : |
| 2023 | Hexagon::LDrih_indexed_cNotPt_V4; |
| 2024 | case Hexagon::LDriuh_indexed_V4: |
| 2025 | return !invertPredicate ? Hexagon::LDriuh_indexed_cPt_V4 : |
| 2026 | Hexagon::LDriuh_indexed_cNotPt_V4; |
| 2027 | case Hexagon::LDriuh_ae_indexed_V4: |
| 2028 | return !invertPredicate ? Hexagon::LDriuh_indexed_cPt_V4 : |
| 2029 | Hexagon::LDriuh_indexed_cNotPt_V4; |
| 2030 | case Hexagon::LDrih_indexed_shl_V4: |
| 2031 | return !invertPredicate ? Hexagon::LDrih_indexed_shl_cPt_V4 : |
| 2032 | Hexagon::LDrih_indexed_shl_cNotPt_V4; |
| 2033 | case Hexagon::LDriuh_indexed_shl_V4: |
| 2034 | return !invertPredicate ? Hexagon::LDriuh_indexed_shl_cPt_V4 : |
| 2035 | Hexagon::LDriuh_indexed_shl_cNotPt_V4; |
| 2036 | case Hexagon::LDriuh_ae_indexed_shl_V4: |
| 2037 | return !invertPredicate ? Hexagon::LDriuh_indexed_shl_cPt_V4 : |
| 2038 | Hexagon::LDriuh_indexed_shl_cNotPt_V4; |
| 2039 | case Hexagon::LDriw_indexed_V4: |
| 2040 | return !invertPredicate ? Hexagon::LDriw_indexed_cPt_V4 : |
| 2041 | Hexagon::LDriw_indexed_cNotPt_V4; |
| 2042 | case Hexagon::LDriw_indexed_shl_V4: |
| 2043 | return !invertPredicate ? Hexagon::LDriw_indexed_shl_cPt_V4 : |
| 2044 | Hexagon::LDriw_indexed_shl_cNotPt_V4; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2045 | |
| 2046 | // V4 Load from global address |
| 2047 | case Hexagon::LDrid_GP_V4: |
| 2048 | return !invertPredicate ? Hexagon::LDrid_GP_cPt_V4 : |
| 2049 | Hexagon::LDrid_GP_cNotPt_V4; |
| 2050 | case Hexagon::LDrib_GP_V4: |
| 2051 | return !invertPredicate ? Hexagon::LDrib_GP_cPt_V4 : |
| 2052 | Hexagon::LDrib_GP_cNotPt_V4; |
| 2053 | case Hexagon::LDriub_GP_V4: |
| 2054 | return !invertPredicate ? Hexagon::LDriub_GP_cPt_V4 : |
| 2055 | Hexagon::LDriub_GP_cNotPt_V4; |
| 2056 | case Hexagon::LDrih_GP_V4: |
| 2057 | return !invertPredicate ? Hexagon::LDrih_GP_cPt_V4 : |
| 2058 | Hexagon::LDrih_GP_cNotPt_V4; |
| 2059 | case Hexagon::LDriuh_GP_V4: |
| 2060 | return !invertPredicate ? Hexagon::LDriuh_GP_cPt_V4 : |
| 2061 | Hexagon::LDriuh_GP_cNotPt_V4; |
| 2062 | case Hexagon::LDriw_GP_V4: |
| 2063 | return !invertPredicate ? Hexagon::LDriw_GP_cPt_V4 : |
| 2064 | Hexagon::LDriw_GP_cNotPt_V4; |
| 2065 | |
| 2066 | case Hexagon::LDd_GP_V4: |
| 2067 | return !invertPredicate ? Hexagon::LDd_GP_cPt_V4 : |
| 2068 | Hexagon::LDd_GP_cNotPt_V4; |
| 2069 | case Hexagon::LDb_GP_V4: |
| 2070 | return !invertPredicate ? Hexagon::LDb_GP_cPt_V4 : |
| 2071 | Hexagon::LDb_GP_cNotPt_V4; |
| 2072 | case Hexagon::LDub_GP_V4: |
| 2073 | return !invertPredicate ? Hexagon::LDub_GP_cPt_V4 : |
| 2074 | Hexagon::LDub_GP_cNotPt_V4; |
| 2075 | case Hexagon::LDh_GP_V4: |
| 2076 | return !invertPredicate ? Hexagon::LDh_GP_cPt_V4 : |
| 2077 | Hexagon::LDh_GP_cNotPt_V4; |
| 2078 | case Hexagon::LDuh_GP_V4: |
| 2079 | return !invertPredicate ? Hexagon::LDuh_GP_cPt_V4 : |
| 2080 | Hexagon::LDuh_GP_cNotPt_V4; |
| 2081 | case Hexagon::LDw_GP_V4: |
| 2082 | return !invertPredicate ? Hexagon::LDw_GP_cPt_V4 : |
| 2083 | Hexagon::LDw_GP_cNotPt_V4; |
| 2084 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2085 | // Byte. |
| 2086 | case Hexagon::POST_STbri: |
| 2087 | return !invertPredicate ? Hexagon::POST_STbri_cPt : |
| 2088 | Hexagon::POST_STbri_cNotPt; |
| 2089 | case Hexagon::STrib: |
| 2090 | return !invertPredicate ? Hexagon::STrib_cPt : |
| 2091 | Hexagon::STrib_cNotPt; |
| 2092 | case Hexagon::STrib_indexed: |
| 2093 | return !invertPredicate ? Hexagon::STrib_indexed_cPt : |
| 2094 | Hexagon::STrib_indexed_cNotPt; |
| 2095 | case Hexagon::STrib_imm_V4: |
| 2096 | return !invertPredicate ? Hexagon::STrib_imm_cPt_V4 : |
| 2097 | Hexagon::STrib_imm_cNotPt_V4; |
| 2098 | case Hexagon::STrib_indexed_shl_V4: |
| 2099 | return !invertPredicate ? Hexagon::STrib_indexed_shl_cPt_V4 : |
| 2100 | Hexagon::STrib_indexed_shl_cNotPt_V4; |
| 2101 | // Halfword. |
| 2102 | case Hexagon::POST_SThri: |
| 2103 | return !invertPredicate ? Hexagon::POST_SThri_cPt : |
| 2104 | Hexagon::POST_SThri_cNotPt; |
| 2105 | case Hexagon::STrih: |
| 2106 | return !invertPredicate ? Hexagon::STrih_cPt : |
| 2107 | Hexagon::STrih_cNotPt; |
| 2108 | case Hexagon::STrih_indexed: |
| 2109 | return !invertPredicate ? Hexagon::STrih_indexed_cPt : |
| 2110 | Hexagon::STrih_indexed_cNotPt; |
| 2111 | case Hexagon::STrih_imm_V4: |
| 2112 | return !invertPredicate ? Hexagon::STrih_imm_cPt_V4 : |
| 2113 | Hexagon::STrih_imm_cNotPt_V4; |
| 2114 | case Hexagon::STrih_indexed_shl_V4: |
| 2115 | return !invertPredicate ? Hexagon::STrih_indexed_shl_cPt_V4 : |
| 2116 | Hexagon::STrih_indexed_shl_cNotPt_V4; |
| 2117 | // Word. |
| 2118 | case Hexagon::POST_STwri: |
| 2119 | return !invertPredicate ? Hexagon::POST_STwri_cPt : |
| 2120 | Hexagon::POST_STwri_cNotPt; |
| 2121 | case Hexagon::STriw: |
| 2122 | return !invertPredicate ? Hexagon::STriw_cPt : |
| 2123 | Hexagon::STriw_cNotPt; |
| 2124 | case Hexagon::STriw_indexed: |
| 2125 | return !invertPredicate ? Hexagon::STriw_indexed_cPt : |
| 2126 | Hexagon::STriw_indexed_cNotPt; |
| 2127 | case Hexagon::STriw_indexed_shl_V4: |
| 2128 | return !invertPredicate ? Hexagon::STriw_indexed_shl_cPt_V4 : |
| 2129 | Hexagon::STriw_indexed_shl_cNotPt_V4; |
| 2130 | case Hexagon::STriw_imm_V4: |
| 2131 | return !invertPredicate ? Hexagon::STriw_imm_cPt_V4 : |
| 2132 | Hexagon::STriw_imm_cNotPt_V4; |
| 2133 | // Double word. |
| 2134 | case Hexagon::POST_STdri: |
| 2135 | return !invertPredicate ? Hexagon::POST_STdri_cPt : |
| 2136 | Hexagon::POST_STdri_cNotPt; |
| 2137 | case Hexagon::STrid: |
| 2138 | return !invertPredicate ? Hexagon::STrid_cPt : |
| 2139 | Hexagon::STrid_cNotPt; |
| 2140 | case Hexagon::STrid_indexed: |
| 2141 | return !invertPredicate ? Hexagon::STrid_indexed_cPt : |
| 2142 | Hexagon::STrid_indexed_cNotPt; |
| 2143 | case Hexagon::STrid_indexed_shl_V4: |
| 2144 | return !invertPredicate ? Hexagon::STrid_indexed_shl_cPt_V4 : |
| 2145 | Hexagon::STrid_indexed_shl_cNotPt_V4; |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2146 | |
| 2147 | // V4 Store to global address |
| 2148 | case Hexagon::STrid_GP_V4: |
| 2149 | return !invertPredicate ? Hexagon::STrid_GP_cPt_V4 : |
| 2150 | Hexagon::STrid_GP_cNotPt_V4; |
| 2151 | case Hexagon::STrib_GP_V4: |
| 2152 | return !invertPredicate ? Hexagon::STrib_GP_cPt_V4 : |
| 2153 | Hexagon::STrib_GP_cNotPt_V4; |
| 2154 | case Hexagon::STrih_GP_V4: |
| 2155 | return !invertPredicate ? Hexagon::STrih_GP_cPt_V4 : |
| 2156 | Hexagon::STrih_GP_cNotPt_V4; |
| 2157 | case Hexagon::STriw_GP_V4: |
| 2158 | return !invertPredicate ? Hexagon::STriw_GP_cPt_V4 : |
| 2159 | Hexagon::STriw_GP_cNotPt_V4; |
| 2160 | |
| 2161 | case Hexagon::STd_GP_V4: |
| 2162 | return !invertPredicate ? Hexagon::STd_GP_cPt_V4 : |
| 2163 | Hexagon::STd_GP_cNotPt_V4; |
| 2164 | case Hexagon::STb_GP_V4: |
| 2165 | return !invertPredicate ? Hexagon::STb_GP_cPt_V4 : |
| 2166 | Hexagon::STb_GP_cNotPt_V4; |
| 2167 | case Hexagon::STh_GP_V4: |
| 2168 | return !invertPredicate ? Hexagon::STh_GP_cPt_V4 : |
| 2169 | Hexagon::STh_GP_cNotPt_V4; |
| 2170 | case Hexagon::STw_GP_V4: |
| 2171 | return !invertPredicate ? Hexagon::STw_GP_cPt_V4 : |
| 2172 | Hexagon::STw_GP_cNotPt_V4; |
| 2173 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2174 | // Load. |
| 2175 | case Hexagon::LDrid: |
| 2176 | return !invertPredicate ? Hexagon::LDrid_cPt : |
| 2177 | Hexagon::LDrid_cNotPt; |
| 2178 | case Hexagon::LDriw: |
| 2179 | return !invertPredicate ? Hexagon::LDriw_cPt : |
| 2180 | Hexagon::LDriw_cNotPt; |
| 2181 | case Hexagon::LDrih: |
| 2182 | return !invertPredicate ? Hexagon::LDrih_cPt : |
| 2183 | Hexagon::LDrih_cNotPt; |
| 2184 | case Hexagon::LDriuh: |
| 2185 | return !invertPredicate ? Hexagon::LDriuh_cPt : |
| 2186 | Hexagon::LDriuh_cNotPt; |
| 2187 | case Hexagon::LDrib: |
| 2188 | return !invertPredicate ? Hexagon::LDrib_cPt : |
| 2189 | Hexagon::LDrib_cNotPt; |
| 2190 | case Hexagon::LDriub: |
| 2191 | return !invertPredicate ? Hexagon::LDriub_cPt : |
| 2192 | Hexagon::LDriub_cNotPt; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2193 | // Load Indexed. |
| 2194 | case Hexagon::LDrid_indexed: |
| 2195 | return !invertPredicate ? Hexagon::LDrid_indexed_cPt : |
| 2196 | Hexagon::LDrid_indexed_cNotPt; |
| 2197 | case Hexagon::LDriw_indexed: |
| 2198 | return !invertPredicate ? Hexagon::LDriw_indexed_cPt : |
| 2199 | Hexagon::LDriw_indexed_cNotPt; |
| 2200 | case Hexagon::LDrih_indexed: |
| 2201 | return !invertPredicate ? Hexagon::LDrih_indexed_cPt : |
| 2202 | Hexagon::LDrih_indexed_cNotPt; |
| 2203 | case Hexagon::LDriuh_indexed: |
| 2204 | return !invertPredicate ? Hexagon::LDriuh_indexed_cPt : |
| 2205 | Hexagon::LDriuh_indexed_cNotPt; |
| 2206 | case Hexagon::LDrib_indexed: |
| 2207 | return !invertPredicate ? Hexagon::LDrib_indexed_cPt : |
| 2208 | Hexagon::LDrib_indexed_cNotPt; |
| 2209 | case Hexagon::LDriub_indexed: |
| 2210 | return !invertPredicate ? Hexagon::LDriub_indexed_cPt : |
| 2211 | Hexagon::LDriub_indexed_cNotPt; |
| 2212 | // Post Increment Load. |
| 2213 | case Hexagon::POST_LDrid: |
| 2214 | return !invertPredicate ? Hexagon::POST_LDrid_cPt : |
| 2215 | Hexagon::POST_LDrid_cNotPt; |
| 2216 | case Hexagon::POST_LDriw: |
| 2217 | return !invertPredicate ? Hexagon::POST_LDriw_cPt : |
| 2218 | Hexagon::POST_LDriw_cNotPt; |
| 2219 | case Hexagon::POST_LDrih: |
| 2220 | return !invertPredicate ? Hexagon::POST_LDrih_cPt : |
| 2221 | Hexagon::POST_LDrih_cNotPt; |
| 2222 | case Hexagon::POST_LDriuh: |
| 2223 | return !invertPredicate ? Hexagon::POST_LDriuh_cPt : |
| 2224 | Hexagon::POST_LDriuh_cNotPt; |
| 2225 | case Hexagon::POST_LDrib: |
| 2226 | return !invertPredicate ? Hexagon::POST_LDrib_cPt : |
| 2227 | Hexagon::POST_LDrib_cNotPt; |
| 2228 | case Hexagon::POST_LDriub: |
| 2229 | return !invertPredicate ? Hexagon::POST_LDriub_cPt : |
| 2230 | Hexagon::POST_LDriub_cNotPt; |
| 2231 | // DEALLOC_RETURN. |
| 2232 | case Hexagon::DEALLOC_RET_V4: |
| 2233 | return !invertPredicate ? Hexagon::DEALLOC_RET_cPt_V4 : |
| 2234 | Hexagon::DEALLOC_RET_cNotPt_V4; |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 2235 | |
| 2236 | // Load Absolute Addressing -- global address. |
| 2237 | case Hexagon::LDrib_abs_V4: |
| 2238 | return !invertPredicate ? Hexagon::LDrib_abs_cPt_V4 : |
| 2239 | Hexagon::LDrib_abs_cNotPt_V4; |
| 2240 | case Hexagon::LDriub_abs_V4: |
| 2241 | return !invertPredicate ? Hexagon::LDriub_abs_cPt_V4 : |
| 2242 | Hexagon::LDriub_abs_cNotPt_V4; |
| 2243 | case Hexagon::LDrih_abs_V4: |
| 2244 | return !invertPredicate ? Hexagon::LDrih_abs_cPt_V4 : |
| 2245 | Hexagon::LDrih_abs_cNotPt_V4; |
| 2246 | case Hexagon::LDriuh_abs_V4: |
| 2247 | return !invertPredicate ? Hexagon::LDriuh_abs_cPt_V4 : |
| 2248 | Hexagon::LDriuh_abs_cNotPt_V4; |
| 2249 | case Hexagon::LDriw_abs_V4: |
| 2250 | return !invertPredicate ? Hexagon::LDriw_abs_cPt_V4 : |
| 2251 | Hexagon::LDriw_abs_cNotPt_V4; |
| 2252 | case Hexagon::LDrid_abs_V4: |
| 2253 | return !invertPredicate ? Hexagon::LDrid_abs_cPt_V4 : |
| 2254 | Hexagon::LDrid_abs_cNotPt_V4; |
| 2255 | |
| 2256 | // Load Absolute Addressing -- immediate value. |
| 2257 | case Hexagon::LDrib_imm_abs_V4: |
| 2258 | return !invertPredicate ? Hexagon::LDrib_imm_abs_cPt_V4 : |
| 2259 | Hexagon::LDrib_imm_abs_cNotPt_V4; |
| 2260 | case Hexagon::LDriub_imm_abs_V4: |
| 2261 | return !invertPredicate ? Hexagon::LDriub_imm_abs_cPt_V4 : |
| 2262 | Hexagon::LDriub_imm_abs_cNotPt_V4; |
| 2263 | case Hexagon::LDrih_imm_abs_V4: |
| 2264 | return !invertPredicate ? Hexagon::LDrih_imm_abs_cPt_V4 : |
| 2265 | Hexagon::LDrih_imm_abs_cNotPt_V4; |
| 2266 | case Hexagon::LDriuh_imm_abs_V4: |
| 2267 | return !invertPredicate ? Hexagon::LDriuh_imm_abs_cPt_V4 : |
| 2268 | Hexagon::LDriuh_imm_abs_cNotPt_V4; |
| 2269 | case Hexagon::LDriw_imm_abs_V4: |
| 2270 | return !invertPredicate ? Hexagon::LDriw_imm_abs_cPt_V4 : |
| 2271 | Hexagon::LDriw_imm_abs_cNotPt_V4; |
| 2272 | |
| 2273 | // Store Absolute Addressing. |
| 2274 | case Hexagon::STrib_abs_V4: |
| 2275 | return !invertPredicate ? Hexagon::STrib_abs_cPt_V4 : |
| 2276 | Hexagon::STrib_abs_cNotPt_V4; |
| 2277 | case Hexagon::STrih_abs_V4: |
| 2278 | return !invertPredicate ? Hexagon::STrih_abs_cPt_V4 : |
| 2279 | Hexagon::STrih_abs_cNotPt_V4; |
| 2280 | case Hexagon::STriw_abs_V4: |
| 2281 | return !invertPredicate ? Hexagon::STriw_abs_cPt_V4 : |
| 2282 | Hexagon::STriw_abs_cNotPt_V4; |
| 2283 | case Hexagon::STrid_abs_V4: |
| 2284 | return !invertPredicate ? Hexagon::STrid_abs_cPt_V4 : |
| 2285 | Hexagon::STrid_abs_cNotPt_V4; |
| 2286 | |
| 2287 | // Store Absolute Addressing - global address. |
| 2288 | case Hexagon::STrib_imm_abs_V4: |
| 2289 | return !invertPredicate ? Hexagon::STrib_imm_abs_cPt_V4 : |
| 2290 | Hexagon::STrib_imm_abs_cNotPt_V4; |
| 2291 | case Hexagon::STrih_imm_abs_V4: |
| 2292 | return !invertPredicate ? Hexagon::STrih_imm_abs_cPt_V4 : |
| 2293 | Hexagon::STrih_imm_abs_cNotPt_V4; |
| 2294 | case Hexagon::STriw_imm_abs_V4: |
| 2295 | return !invertPredicate ? Hexagon::STriw_imm_abs_cPt_V4 : |
| 2296 | Hexagon::STriw_imm_abs_cNotPt_V4; |
| 2297 | |
| 2298 | // Transfer |
| 2299 | case Hexagon::TFRI_V4: |
| 2300 | return !invertPredicate ? Hexagon::TFRI_cPt_V4 : |
| 2301 | Hexagon::TFRI_cNotPt_V4; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2302 | } |
Benjamin Kramer | 27baab6 | 2011-12-27 11:41:05 +0000 | [diff] [blame] | 2303 | llvm_unreachable("Unexpected predicable instruction"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2304 | } |
| 2305 | |
| 2306 | |
| 2307 | bool HexagonInstrInfo:: |
| 2308 | PredicateInstruction(MachineInstr *MI, |
| 2309 | const SmallVectorImpl<MachineOperand> &Cond) const { |
| 2310 | int Opc = MI->getOpcode(); |
| 2311 | assert (isPredicable(MI) && "Expected predicable instruction"); |
| 2312 | bool invertJump = (!Cond.empty() && Cond[0].isImm() && |
| 2313 | (Cond[0].getImm() == 0)); |
| 2314 | MI->setDesc(get(getMatchingCondBranchOpcode(Opc, invertJump))); |
| 2315 | // |
| 2316 | // This assumes that the predicate is always the first operand |
| 2317 | // in the set of inputs. |
| 2318 | // |
| 2319 | MI->addOperand(MI->getOperand(MI->getNumOperands()-1)); |
| 2320 | int oper; |
| 2321 | for (oper = MI->getNumOperands() - 3; oper >= 0; --oper) { |
| 2322 | MachineOperand MO = MI->getOperand(oper); |
| 2323 | if ((MO.isReg() && !MO.isUse() && !MO.isImplicit())) { |
| 2324 | break; |
| 2325 | } |
| 2326 | |
| 2327 | if (MO.isReg()) { |
| 2328 | MI->getOperand(oper+1).ChangeToRegister(MO.getReg(), MO.isDef(), |
| 2329 | MO.isImplicit(), MO.isKill(), |
| 2330 | MO.isDead(), MO.isUndef(), |
| 2331 | MO.isDebug()); |
| 2332 | } else if (MO.isImm()) { |
| 2333 | MI->getOperand(oper+1).ChangeToImmediate(MO.getImm()); |
| 2334 | } else { |
Craig Topper | bc21981 | 2012-02-07 02:50:20 +0000 | [diff] [blame] | 2335 | llvm_unreachable("Unexpected operand type"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2336 | } |
| 2337 | } |
| 2338 | |
| 2339 | int regPos = invertJump ? 1 : 0; |
| 2340 | MachineOperand PredMO = Cond[regPos]; |
| 2341 | MI->getOperand(oper+1).ChangeToRegister(PredMO.getReg(), PredMO.isDef(), |
| 2342 | PredMO.isImplicit(), PredMO.isKill(), |
| 2343 | PredMO.isDead(), PredMO.isUndef(), |
| 2344 | PredMO.isDebug()); |
| 2345 | |
| 2346 | return true; |
| 2347 | } |
| 2348 | |
| 2349 | |
| 2350 | bool |
| 2351 | HexagonInstrInfo:: |
| 2352 | isProfitableToIfCvt(MachineBasicBlock &MBB, |
| 2353 | unsigned NumCyles, |
| 2354 | unsigned ExtraPredCycles, |
| 2355 | const BranchProbability &Probability) const { |
| 2356 | return true; |
| 2357 | } |
| 2358 | |
| 2359 | |
| 2360 | bool |
| 2361 | HexagonInstrInfo:: |
| 2362 | isProfitableToIfCvt(MachineBasicBlock &TMBB, |
| 2363 | unsigned NumTCycles, |
| 2364 | unsigned ExtraTCycles, |
| 2365 | MachineBasicBlock &FMBB, |
| 2366 | unsigned NumFCycles, |
| 2367 | unsigned ExtraFCycles, |
| 2368 | const BranchProbability &Probability) const { |
| 2369 | return true; |
| 2370 | } |
| 2371 | |
| 2372 | |
| 2373 | bool HexagonInstrInfo::isPredicated(const MachineInstr *MI) const { |
Brendon Cahoon | c635ebd | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 2374 | const uint64_t F = MI->getDesc().TSFlags; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2375 | |
Brendon Cahoon | c635ebd | 2012-02-08 18:25:47 +0000 | [diff] [blame] | 2376 | return ((F >> HexagonII::PredicatedPos) & HexagonII::PredicatedMask); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2377 | } |
| 2378 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2379 | bool |
| 2380 | HexagonInstrInfo::DefinesPredicate(MachineInstr *MI, |
| 2381 | std::vector<MachineOperand> &Pred) const { |
| 2382 | for (unsigned oper = 0; oper < MI->getNumOperands(); ++oper) { |
| 2383 | MachineOperand MO = MI->getOperand(oper); |
| 2384 | if (MO.isReg() && MO.isDef()) { |
| 2385 | const TargetRegisterClass* RC = RI.getMinimalPhysRegClass(MO.getReg()); |
Craig Topper | 420761a | 2012-04-20 07:30:17 +0000 | [diff] [blame] | 2386 | if (RC == &Hexagon::PredRegsRegClass) { |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2387 | Pred.push_back(MO); |
| 2388 | return true; |
| 2389 | } |
| 2390 | } |
| 2391 | } |
| 2392 | return false; |
| 2393 | } |
| 2394 | |
| 2395 | |
| 2396 | bool |
| 2397 | HexagonInstrInfo:: |
| 2398 | SubsumesPredicate(const SmallVectorImpl<MachineOperand> &Pred1, |
| 2399 | const SmallVectorImpl<MachineOperand> &Pred2) const { |
| 2400 | // TODO: Fix this |
| 2401 | return false; |
| 2402 | } |
| 2403 | |
| 2404 | |
| 2405 | // |
| 2406 | // We indicate that we want to reverse the branch by |
| 2407 | // inserting a 0 at the beginning of the Cond vector. |
| 2408 | // |
| 2409 | bool HexagonInstrInfo:: |
| 2410 | ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const { |
| 2411 | if (!Cond.empty() && Cond[0].isImm() && Cond[0].getImm() == 0) { |
| 2412 | Cond.erase(Cond.begin()); |
| 2413 | } else { |
| 2414 | Cond.insert(Cond.begin(), MachineOperand::CreateImm(0)); |
| 2415 | } |
| 2416 | return false; |
| 2417 | } |
| 2418 | |
| 2419 | |
| 2420 | bool HexagonInstrInfo:: |
| 2421 | isProfitableToDupForIfCvt(MachineBasicBlock &MBB,unsigned NumInstrs, |
| 2422 | const BranchProbability &Probability) const { |
| 2423 | return (NumInstrs <= 4); |
| 2424 | } |
| 2425 | |
| 2426 | bool HexagonInstrInfo::isDeallocRet(const MachineInstr *MI) const { |
| 2427 | switch (MI->getOpcode()) { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2428 | default: return false; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2429 | case Hexagon::DEALLOC_RET_V4 : |
| 2430 | case Hexagon::DEALLOC_RET_cPt_V4 : |
| 2431 | case Hexagon::DEALLOC_RET_cNotPt_V4 : |
| 2432 | case Hexagon::DEALLOC_RET_cdnPnt_V4 : |
| 2433 | case Hexagon::DEALLOC_RET_cNotdnPnt_V4 : |
| 2434 | case Hexagon::DEALLOC_RET_cdnPt_V4 : |
| 2435 | case Hexagon::DEALLOC_RET_cNotdnPt_V4 : |
| 2436 | return true; |
| 2437 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2438 | } |
| 2439 | |
| 2440 | |
| 2441 | bool HexagonInstrInfo:: |
| 2442 | isValidOffset(const int Opcode, const int Offset) const { |
| 2443 | // This function is to check whether the "Offset" is in the correct range of |
| 2444 | // the given "Opcode". If "Offset" is not in the correct range, "ADD_ri" is |
| 2445 | // inserted to calculate the final address. Due to this reason, the function |
| 2446 | // assumes that the "Offset" has correct alignment. |
| 2447 | |
| 2448 | switch(Opcode) { |
| 2449 | |
| 2450 | case Hexagon::LDriw: |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 2451 | case Hexagon::LDriw_f: |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 2452 | case Hexagon::STriw_indexed: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2453 | case Hexagon::STriw: |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 2454 | case Hexagon::STriw_f: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2455 | assert((Offset % 4 == 0) && "Offset has incorrect alignment"); |
| 2456 | return (Offset >= Hexagon_MEMW_OFFSET_MIN) && |
| 2457 | (Offset <= Hexagon_MEMW_OFFSET_MAX); |
| 2458 | |
| 2459 | case Hexagon::LDrid: |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 2460 | case Hexagon::LDrid_f: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2461 | case Hexagon::STrid: |
Sirish Pande | 7517bbc | 2012-05-10 20:20:25 +0000 | [diff] [blame] | 2462 | case Hexagon::STrid_f: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2463 | assert((Offset % 8 == 0) && "Offset has incorrect alignment"); |
| 2464 | return (Offset >= Hexagon_MEMD_OFFSET_MIN) && |
| 2465 | (Offset <= Hexagon_MEMD_OFFSET_MAX); |
| 2466 | |
| 2467 | case Hexagon::LDrih: |
| 2468 | case Hexagon::LDriuh: |
| 2469 | case Hexagon::STrih: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2470 | assert((Offset % 2 == 0) && "Offset has incorrect alignment"); |
| 2471 | return (Offset >= Hexagon_MEMH_OFFSET_MIN) && |
| 2472 | (Offset <= Hexagon_MEMH_OFFSET_MAX); |
| 2473 | |
| 2474 | case Hexagon::LDrib: |
| 2475 | case Hexagon::STrib: |
| 2476 | case Hexagon::LDriub: |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2477 | return (Offset >= Hexagon_MEMB_OFFSET_MIN) && |
| 2478 | (Offset <= Hexagon_MEMB_OFFSET_MAX); |
| 2479 | |
| 2480 | case Hexagon::ADD_ri: |
| 2481 | case Hexagon::TFR_FI: |
| 2482 | return (Offset >= Hexagon_ADDI_OFFSET_MIN) && |
| 2483 | (Offset <= Hexagon_ADDI_OFFSET_MAX); |
| 2484 | |
| 2485 | case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 : |
| 2486 | case Hexagon::MEMw_ADDi_indexed_MEM_V4 : |
| 2487 | case Hexagon::MEMw_SUBi_indexed_MEM_V4 : |
| 2488 | case Hexagon::MEMw_ADDr_indexed_MEM_V4 : |
| 2489 | case Hexagon::MEMw_SUBr_indexed_MEM_V4 : |
| 2490 | case Hexagon::MEMw_ANDr_indexed_MEM_V4 : |
| 2491 | case Hexagon::MEMw_ORr_indexed_MEM_V4 : |
| 2492 | case Hexagon::MEMw_ADDSUBi_MEM_V4 : |
| 2493 | case Hexagon::MEMw_ADDi_MEM_V4 : |
| 2494 | case Hexagon::MEMw_SUBi_MEM_V4 : |
| 2495 | case Hexagon::MEMw_ADDr_MEM_V4 : |
| 2496 | case Hexagon::MEMw_SUBr_MEM_V4 : |
| 2497 | case Hexagon::MEMw_ANDr_MEM_V4 : |
| 2498 | case Hexagon::MEMw_ORr_MEM_V4 : |
| 2499 | assert ((Offset % 4) == 0 && "MEMOPw offset is not aligned correctly." ); |
| 2500 | return (0 <= Offset && Offset <= 255); |
| 2501 | |
| 2502 | case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 : |
| 2503 | case Hexagon::MEMh_ADDi_indexed_MEM_V4 : |
| 2504 | case Hexagon::MEMh_SUBi_indexed_MEM_V4 : |
| 2505 | case Hexagon::MEMh_ADDr_indexed_MEM_V4 : |
| 2506 | case Hexagon::MEMh_SUBr_indexed_MEM_V4 : |
| 2507 | case Hexagon::MEMh_ANDr_indexed_MEM_V4 : |
| 2508 | case Hexagon::MEMh_ORr_indexed_MEM_V4 : |
| 2509 | case Hexagon::MEMh_ADDSUBi_MEM_V4 : |
| 2510 | case Hexagon::MEMh_ADDi_MEM_V4 : |
| 2511 | case Hexagon::MEMh_SUBi_MEM_V4 : |
| 2512 | case Hexagon::MEMh_ADDr_MEM_V4 : |
| 2513 | case Hexagon::MEMh_SUBr_MEM_V4 : |
| 2514 | case Hexagon::MEMh_ANDr_MEM_V4 : |
| 2515 | case Hexagon::MEMh_ORr_MEM_V4 : |
| 2516 | assert ((Offset % 2) == 0 && "MEMOPh offset is not aligned correctly." ); |
| 2517 | return (0 <= Offset && Offset <= 127); |
| 2518 | |
| 2519 | case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 : |
| 2520 | case Hexagon::MEMb_ADDi_indexed_MEM_V4 : |
| 2521 | case Hexagon::MEMb_SUBi_indexed_MEM_V4 : |
| 2522 | case Hexagon::MEMb_ADDr_indexed_MEM_V4 : |
| 2523 | case Hexagon::MEMb_SUBr_indexed_MEM_V4 : |
| 2524 | case Hexagon::MEMb_ANDr_indexed_MEM_V4 : |
| 2525 | case Hexagon::MEMb_ORr_indexed_MEM_V4 : |
| 2526 | case Hexagon::MEMb_ADDSUBi_MEM_V4 : |
| 2527 | case Hexagon::MEMb_ADDi_MEM_V4 : |
| 2528 | case Hexagon::MEMb_SUBi_MEM_V4 : |
| 2529 | case Hexagon::MEMb_ADDr_MEM_V4 : |
| 2530 | case Hexagon::MEMb_SUBr_MEM_V4 : |
| 2531 | case Hexagon::MEMb_ANDr_MEM_V4 : |
| 2532 | case Hexagon::MEMb_ORr_MEM_V4 : |
| 2533 | return (0 <= Offset && Offset <= 63); |
| 2534 | |
| 2535 | // LDri_pred and STriw_pred are pseudo operations, so it has to take offset of |
| 2536 | // any size. Later pass knows how to handle it. |
| 2537 | case Hexagon::STriw_pred: |
| 2538 | case Hexagon::LDriw_pred: |
| 2539 | return true; |
| 2540 | |
| 2541 | // INLINEASM is very special. |
| 2542 | case Hexagon::INLINEASM: |
| 2543 | return true; |
| 2544 | } |
| 2545 | |
Benjamin Kramer | 27baab6 | 2011-12-27 11:41:05 +0000 | [diff] [blame] | 2546 | llvm_unreachable("No offset range is defined for this opcode. " |
| 2547 | "Please define it in the above switch statement!"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2548 | } |
| 2549 | |
| 2550 | |
| 2551 | // |
| 2552 | // Check if the Offset is a valid auto-inc imm by Load/Store Type. |
| 2553 | // |
| 2554 | bool HexagonInstrInfo:: |
| 2555 | isValidAutoIncImm(const EVT VT, const int Offset) const { |
| 2556 | |
| 2557 | if (VT == MVT::i64) { |
| 2558 | return (Offset >= Hexagon_MEMD_AUTOINC_MIN && |
| 2559 | Offset <= Hexagon_MEMD_AUTOINC_MAX && |
| 2560 | (Offset & 0x7) == 0); |
| 2561 | } |
| 2562 | if (VT == MVT::i32) { |
| 2563 | return (Offset >= Hexagon_MEMW_AUTOINC_MIN && |
| 2564 | Offset <= Hexagon_MEMW_AUTOINC_MAX && |
| 2565 | (Offset & 0x3) == 0); |
| 2566 | } |
| 2567 | if (VT == MVT::i16) { |
| 2568 | return (Offset >= Hexagon_MEMH_AUTOINC_MIN && |
| 2569 | Offset <= Hexagon_MEMH_AUTOINC_MAX && |
| 2570 | (Offset & 0x1) == 0); |
| 2571 | } |
| 2572 | if (VT == MVT::i8) { |
| 2573 | return (Offset >= Hexagon_MEMB_AUTOINC_MIN && |
| 2574 | Offset <= Hexagon_MEMB_AUTOINC_MAX); |
| 2575 | } |
Craig Topper | bc21981 | 2012-02-07 02:50:20 +0000 | [diff] [blame] | 2576 | llvm_unreachable("Not an auto-inc opc!"); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2577 | } |
| 2578 | |
| 2579 | |
| 2580 | bool HexagonInstrInfo:: |
| 2581 | isMemOp(const MachineInstr *MI) const { |
| 2582 | switch (MI->getOpcode()) |
| 2583 | { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2584 | default: return false; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2585 | case Hexagon::MEMw_ADDSUBi_indexed_MEM_V4 : |
| 2586 | case Hexagon::MEMw_ADDi_indexed_MEM_V4 : |
| 2587 | case Hexagon::MEMw_SUBi_indexed_MEM_V4 : |
| 2588 | case Hexagon::MEMw_ADDr_indexed_MEM_V4 : |
| 2589 | case Hexagon::MEMw_SUBr_indexed_MEM_V4 : |
| 2590 | case Hexagon::MEMw_ANDr_indexed_MEM_V4 : |
| 2591 | case Hexagon::MEMw_ORr_indexed_MEM_V4 : |
| 2592 | case Hexagon::MEMw_ADDSUBi_MEM_V4 : |
| 2593 | case Hexagon::MEMw_ADDi_MEM_V4 : |
| 2594 | case Hexagon::MEMw_SUBi_MEM_V4 : |
| 2595 | case Hexagon::MEMw_ADDr_MEM_V4 : |
| 2596 | case Hexagon::MEMw_SUBr_MEM_V4 : |
| 2597 | case Hexagon::MEMw_ANDr_MEM_V4 : |
| 2598 | case Hexagon::MEMw_ORr_MEM_V4 : |
| 2599 | case Hexagon::MEMh_ADDSUBi_indexed_MEM_V4 : |
| 2600 | case Hexagon::MEMh_ADDi_indexed_MEM_V4 : |
| 2601 | case Hexagon::MEMh_SUBi_indexed_MEM_V4 : |
| 2602 | case Hexagon::MEMh_ADDr_indexed_MEM_V4 : |
| 2603 | case Hexagon::MEMh_SUBr_indexed_MEM_V4 : |
| 2604 | case Hexagon::MEMh_ANDr_indexed_MEM_V4 : |
| 2605 | case Hexagon::MEMh_ORr_indexed_MEM_V4 : |
| 2606 | case Hexagon::MEMh_ADDSUBi_MEM_V4 : |
| 2607 | case Hexagon::MEMh_ADDi_MEM_V4 : |
| 2608 | case Hexagon::MEMh_SUBi_MEM_V4 : |
| 2609 | case Hexagon::MEMh_ADDr_MEM_V4 : |
| 2610 | case Hexagon::MEMh_SUBr_MEM_V4 : |
| 2611 | case Hexagon::MEMh_ANDr_MEM_V4 : |
| 2612 | case Hexagon::MEMh_ORr_MEM_V4 : |
| 2613 | case Hexagon::MEMb_ADDSUBi_indexed_MEM_V4 : |
| 2614 | case Hexagon::MEMb_ADDi_indexed_MEM_V4 : |
| 2615 | case Hexagon::MEMb_SUBi_indexed_MEM_V4 : |
| 2616 | case Hexagon::MEMb_ADDr_indexed_MEM_V4 : |
| 2617 | case Hexagon::MEMb_SUBr_indexed_MEM_V4 : |
| 2618 | case Hexagon::MEMb_ANDr_indexed_MEM_V4 : |
| 2619 | case Hexagon::MEMb_ORr_indexed_MEM_V4 : |
| 2620 | case Hexagon::MEMb_ADDSUBi_MEM_V4 : |
| 2621 | case Hexagon::MEMb_ADDi_MEM_V4 : |
| 2622 | case Hexagon::MEMb_SUBi_MEM_V4 : |
| 2623 | case Hexagon::MEMb_ADDr_MEM_V4 : |
| 2624 | case Hexagon::MEMb_SUBr_MEM_V4 : |
| 2625 | case Hexagon::MEMb_ANDr_MEM_V4 : |
| 2626 | case Hexagon::MEMb_ORr_MEM_V4 : |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2627 | return true; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2628 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2629 | } |
| 2630 | |
| 2631 | |
| 2632 | bool HexagonInstrInfo:: |
| 2633 | isSpillPredRegOp(const MachineInstr *MI) const { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2634 | switch (MI->getOpcode()) { |
| 2635 | default: return false; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2636 | case Hexagon::STriw_pred : |
| 2637 | case Hexagon::LDriw_pred : |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2638 | return true; |
Sirish Pande | 1bfd248 | 2012-04-23 17:49:28 +0000 | [diff] [blame] | 2639 | } |
Sirish Pande | b338570 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 2640 | } |
| 2641 | |
| 2642 | bool HexagonInstrInfo::isNewValueJumpCandidate(const MachineInstr *MI) const { |
| 2643 | switch (MI->getOpcode()) { |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 2644 | default: return false; |
Sirish Pande | b338570 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 2645 | case Hexagon::CMPEQrr: |
| 2646 | case Hexagon::CMPEQri: |
| 2647 | case Hexagon::CMPLTrr: |
| 2648 | case Hexagon::CMPGTrr: |
| 2649 | case Hexagon::CMPGTri: |
| 2650 | case Hexagon::CMPLTUrr: |
| 2651 | case Hexagon::CMPGTUrr: |
| 2652 | case Hexagon::CMPGTUri: |
| 2653 | case Hexagon::CMPGEri: |
| 2654 | case Hexagon::CMPGEUri: |
| 2655 | return true; |
Sirish Pande | b338570 | 2012-05-12 05:10:30 +0000 | [diff] [blame] | 2656 | } |
Sirish Pande | 1bfd248 | 2012-04-23 17:49:28 +0000 | [diff] [blame] | 2657 | } |
| 2658 | |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2659 | bool HexagonInstrInfo:: |
| 2660 | isConditionalTransfer (const MachineInstr *MI) const { |
| 2661 | switch (MI->getOpcode()) { |
| 2662 | default: return false; |
| 2663 | case Hexagon::TFR_cPt: |
| 2664 | case Hexagon::TFR_cNotPt: |
| 2665 | case Hexagon::TFRI_cPt: |
| 2666 | case Hexagon::TFRI_cNotPt: |
| 2667 | case Hexagon::TFR_cdnPt: |
| 2668 | case Hexagon::TFR_cdnNotPt: |
| 2669 | case Hexagon::TFRI_cdnPt: |
| 2670 | case Hexagon::TFRI_cdnNotPt: |
| 2671 | return true; |
| 2672 | } |
| 2673 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2674 | |
| 2675 | bool HexagonInstrInfo::isConditionalALU32 (const MachineInstr* MI) const { |
| 2676 | const HexagonRegisterInfo& QRI = getRegisterInfo(); |
| 2677 | switch (MI->getOpcode()) |
| 2678 | { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2679 | default: return false; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2680 | case Hexagon::ADD_ri_cPt: |
| 2681 | case Hexagon::ADD_ri_cNotPt: |
| 2682 | case Hexagon::ADD_rr_cPt: |
| 2683 | case Hexagon::ADD_rr_cNotPt: |
| 2684 | case Hexagon::XOR_rr_cPt: |
| 2685 | case Hexagon::XOR_rr_cNotPt: |
| 2686 | case Hexagon::AND_rr_cPt: |
| 2687 | case Hexagon::AND_rr_cNotPt: |
| 2688 | case Hexagon::OR_rr_cPt: |
| 2689 | case Hexagon::OR_rr_cNotPt: |
| 2690 | case Hexagon::SUB_rr_cPt: |
| 2691 | case Hexagon::SUB_rr_cNotPt: |
| 2692 | case Hexagon::COMBINE_rr_cPt: |
| 2693 | case Hexagon::COMBINE_rr_cNotPt: |
| 2694 | return true; |
| 2695 | case Hexagon::ASLH_cPt_V4: |
| 2696 | case Hexagon::ASLH_cNotPt_V4: |
| 2697 | case Hexagon::ASRH_cPt_V4: |
| 2698 | case Hexagon::ASRH_cNotPt_V4: |
| 2699 | case Hexagon::SXTB_cPt_V4: |
| 2700 | case Hexagon::SXTB_cNotPt_V4: |
| 2701 | case Hexagon::SXTH_cPt_V4: |
| 2702 | case Hexagon::SXTH_cNotPt_V4: |
| 2703 | case Hexagon::ZXTB_cPt_V4: |
| 2704 | case Hexagon::ZXTB_cNotPt_V4: |
| 2705 | case Hexagon::ZXTH_cPt_V4: |
| 2706 | case Hexagon::ZXTH_cNotPt_V4: |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2707 | return QRI.Subtarget.hasV4TOps(); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2708 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2709 | } |
| 2710 | |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2711 | bool HexagonInstrInfo:: |
| 2712 | isConditionalLoad (const MachineInstr* MI) const { |
| 2713 | const HexagonRegisterInfo& QRI = getRegisterInfo(); |
| 2714 | switch (MI->getOpcode()) |
| 2715 | { |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2716 | default: return false; |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2717 | case Hexagon::LDrid_cPt : |
| 2718 | case Hexagon::LDrid_cNotPt : |
| 2719 | case Hexagon::LDrid_indexed_cPt : |
| 2720 | case Hexagon::LDrid_indexed_cNotPt : |
| 2721 | case Hexagon::LDriw_cPt : |
| 2722 | case Hexagon::LDriw_cNotPt : |
| 2723 | case Hexagon::LDriw_indexed_cPt : |
| 2724 | case Hexagon::LDriw_indexed_cNotPt : |
| 2725 | case Hexagon::LDrih_cPt : |
| 2726 | case Hexagon::LDrih_cNotPt : |
| 2727 | case Hexagon::LDrih_indexed_cPt : |
| 2728 | case Hexagon::LDrih_indexed_cNotPt : |
| 2729 | case Hexagon::LDrib_cPt : |
| 2730 | case Hexagon::LDrib_cNotPt : |
| 2731 | case Hexagon::LDrib_indexed_cPt : |
| 2732 | case Hexagon::LDrib_indexed_cNotPt : |
| 2733 | case Hexagon::LDriuh_cPt : |
| 2734 | case Hexagon::LDriuh_cNotPt : |
| 2735 | case Hexagon::LDriuh_indexed_cPt : |
| 2736 | case Hexagon::LDriuh_indexed_cNotPt : |
| 2737 | case Hexagon::LDriub_cPt : |
| 2738 | case Hexagon::LDriub_cNotPt : |
| 2739 | case Hexagon::LDriub_indexed_cPt : |
| 2740 | case Hexagon::LDriub_indexed_cNotPt : |
| 2741 | return true; |
| 2742 | case Hexagon::POST_LDrid_cPt : |
| 2743 | case Hexagon::POST_LDrid_cNotPt : |
| 2744 | case Hexagon::POST_LDriw_cPt : |
| 2745 | case Hexagon::POST_LDriw_cNotPt : |
| 2746 | case Hexagon::POST_LDrih_cPt : |
| 2747 | case Hexagon::POST_LDrih_cNotPt : |
| 2748 | case Hexagon::POST_LDrib_cPt : |
| 2749 | case Hexagon::POST_LDrib_cNotPt : |
| 2750 | case Hexagon::POST_LDriuh_cPt : |
| 2751 | case Hexagon::POST_LDriuh_cNotPt : |
| 2752 | case Hexagon::POST_LDriub_cPt : |
| 2753 | case Hexagon::POST_LDriub_cNotPt : |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2754 | return QRI.Subtarget.hasV4TOps(); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2755 | case Hexagon::LDrid_indexed_cPt_V4 : |
| 2756 | case Hexagon::LDrid_indexed_cNotPt_V4 : |
| 2757 | case Hexagon::LDrid_indexed_shl_cPt_V4 : |
| 2758 | case Hexagon::LDrid_indexed_shl_cNotPt_V4 : |
| 2759 | case Hexagon::LDrib_indexed_cPt_V4 : |
| 2760 | case Hexagon::LDrib_indexed_cNotPt_V4 : |
| 2761 | case Hexagon::LDrib_indexed_shl_cPt_V4 : |
| 2762 | case Hexagon::LDrib_indexed_shl_cNotPt_V4 : |
| 2763 | case Hexagon::LDriub_indexed_cPt_V4 : |
| 2764 | case Hexagon::LDriub_indexed_cNotPt_V4 : |
| 2765 | case Hexagon::LDriub_indexed_shl_cPt_V4 : |
| 2766 | case Hexagon::LDriub_indexed_shl_cNotPt_V4 : |
| 2767 | case Hexagon::LDrih_indexed_cPt_V4 : |
| 2768 | case Hexagon::LDrih_indexed_cNotPt_V4 : |
| 2769 | case Hexagon::LDrih_indexed_shl_cPt_V4 : |
| 2770 | case Hexagon::LDrih_indexed_shl_cNotPt_V4 : |
| 2771 | case Hexagon::LDriuh_indexed_cPt_V4 : |
| 2772 | case Hexagon::LDriuh_indexed_cNotPt_V4 : |
| 2773 | case Hexagon::LDriuh_indexed_shl_cPt_V4 : |
| 2774 | case Hexagon::LDriuh_indexed_shl_cNotPt_V4 : |
| 2775 | case Hexagon::LDriw_indexed_cPt_V4 : |
| 2776 | case Hexagon::LDriw_indexed_cNotPt_V4 : |
| 2777 | case Hexagon::LDriw_indexed_shl_cPt_V4 : |
| 2778 | case Hexagon::LDriw_indexed_shl_cNotPt_V4 : |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2779 | return QRI.Subtarget.hasV4TOps(); |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2780 | } |
Tony Linthicum | b4b5415 | 2011-12-12 21:14:40 +0000 | [diff] [blame] | 2781 | } |
Andrew Trick | ee498d3 | 2012-02-01 22:13:57 +0000 | [diff] [blame] | 2782 | |
Sirish Pande | 26f61a1 | 2012-05-03 21:52:53 +0000 | [diff] [blame] | 2783 | // Returns true if an instruction is a conditional store. |
| 2784 | // |
| 2785 | // Note: It doesn't include conditional new-value stores as they can't be |
| 2786 | // converted to .new predicate. |
| 2787 | // |
| 2788 | // p.new NV store [ if(p0.new)memw(R0+#0)=R2.new ] |
| 2789 | // ^ ^ |
| 2790 | // / \ (not OK. it will cause new-value store to be |
| 2791 | // / X conditional on p0.new while R2 producer is |
| 2792 | // / \ on p0) |
| 2793 | // / \. |
| 2794 | // p.new store p.old NV store |
| 2795 | // [if(p0.new)memw(R0+#0)=R2] [if(p0)memw(R0+#0)=R2.new] |
| 2796 | // ^ ^ |
| 2797 | // \ / |
| 2798 | // \ / |
| 2799 | // \ / |
| 2800 | // p.old store |
| 2801 | // [if (p0)memw(R0+#0)=R2] |
| 2802 | // |
| 2803 | // The above diagram shows the steps involoved in the conversion of a predicated |
| 2804 | // store instruction to its .new predicated new-value form. |
| 2805 | // |
| 2806 | // The following set of instructions further explains the scenario where |
| 2807 | // conditional new-value store becomes invalid when promoted to .new predicate |
| 2808 | // form. |
| 2809 | // |
| 2810 | // { 1) if (p0) r0 = add(r1, r2) |
| 2811 | // 2) p0 = cmp.eq(r3, #0) } |
| 2812 | // |
| 2813 | // 3) if (p0) memb(r1+#0) = r0 --> this instruction can't be grouped with |
| 2814 | // the first two instructions because in instr 1, r0 is conditional on old value |
| 2815 | // of p0 but its use in instr 3 is conditional on p0 modified by instr 2 which |
| 2816 | // is not valid for new-value stores. |
| 2817 | bool HexagonInstrInfo:: |
| 2818 | isConditionalStore (const MachineInstr* MI) const { |
| 2819 | const HexagonRegisterInfo& QRI = getRegisterInfo(); |
| 2820 | switch (MI->getOpcode()) |
| 2821 | { |
| 2822 | default: return false; |
| 2823 | case Hexagon::STrib_imm_cPt_V4 : |
| 2824 | case Hexagon::STrib_imm_cNotPt_V4 : |
| 2825 | case Hexagon::STrib_indexed_shl_cPt_V4 : |
| 2826 | case Hexagon::STrib_indexed_shl_cNotPt_V4 : |
| 2827 | case Hexagon::STrib_cPt : |
| 2828 | case Hexagon::STrib_cNotPt : |
| 2829 | case Hexagon::POST_STbri_cPt : |
| 2830 | case Hexagon::POST_STbri_cNotPt : |
| 2831 | case Hexagon::STrid_indexed_cPt : |
| 2832 | case Hexagon::STrid_indexed_cNotPt : |
| 2833 | case Hexagon::STrid_indexed_shl_cPt_V4 : |
| 2834 | case Hexagon::POST_STdri_cPt : |
| 2835 | case Hexagon::POST_STdri_cNotPt : |
| 2836 | case Hexagon::STrih_cPt : |
| 2837 | case Hexagon::STrih_cNotPt : |
| 2838 | case Hexagon::STrih_indexed_cPt : |
| 2839 | case Hexagon::STrih_indexed_cNotPt : |
| 2840 | case Hexagon::STrih_imm_cPt_V4 : |
| 2841 | case Hexagon::STrih_imm_cNotPt_V4 : |
| 2842 | case Hexagon::STrih_indexed_shl_cPt_V4 : |
| 2843 | case Hexagon::STrih_indexed_shl_cNotPt_V4 : |
| 2844 | case Hexagon::POST_SThri_cPt : |
| 2845 | case Hexagon::POST_SThri_cNotPt : |
| 2846 | case Hexagon::STriw_cPt : |
| 2847 | case Hexagon::STriw_cNotPt : |
| 2848 | case Hexagon::STriw_indexed_cPt : |
| 2849 | case Hexagon::STriw_indexed_cNotPt : |
| 2850 | case Hexagon::STriw_imm_cPt_V4 : |
| 2851 | case Hexagon::STriw_imm_cNotPt_V4 : |
| 2852 | case Hexagon::STriw_indexed_shl_cPt_V4 : |
| 2853 | case Hexagon::STriw_indexed_shl_cNotPt_V4 : |
| 2854 | case Hexagon::POST_STwri_cPt : |
| 2855 | case Hexagon::POST_STwri_cNotPt : |
| 2856 | return QRI.Subtarget.hasV4TOps(); |
| 2857 | |
| 2858 | // V4 global address store before promoting to dot new. |
| 2859 | case Hexagon::STrid_GP_cPt_V4 : |
| 2860 | case Hexagon::STrid_GP_cNotPt_V4 : |
| 2861 | case Hexagon::STrib_GP_cPt_V4 : |
| 2862 | case Hexagon::STrib_GP_cNotPt_V4 : |
| 2863 | case Hexagon::STrih_GP_cPt_V4 : |
| 2864 | case Hexagon::STrih_GP_cNotPt_V4 : |
| 2865 | case Hexagon::STriw_GP_cPt_V4 : |
| 2866 | case Hexagon::STriw_GP_cNotPt_V4 : |
| 2867 | case Hexagon::STd_GP_cPt_V4 : |
| 2868 | case Hexagon::STd_GP_cNotPt_V4 : |
| 2869 | case Hexagon::STb_GP_cPt_V4 : |
| 2870 | case Hexagon::STb_GP_cNotPt_V4 : |
| 2871 | case Hexagon::STh_GP_cPt_V4 : |
| 2872 | case Hexagon::STh_GP_cNotPt_V4 : |
| 2873 | case Hexagon::STw_GP_cPt_V4 : |
| 2874 | case Hexagon::STw_GP_cNotPt_V4 : |
| 2875 | return QRI.Subtarget.hasV4TOps(); |
| 2876 | |
| 2877 | // Predicated new value stores (i.e. if (p0) memw(..)=r0.new) are excluded |
| 2878 | // from the "Conditional Store" list. Because a predicated new value store |
| 2879 | // would NOT be promoted to a double dot new store. See diagram below: |
| 2880 | // This function returns yes for those stores that are predicated but not |
| 2881 | // yet promoted to predicate dot new instructions. |
| 2882 | // |
| 2883 | // +---------------------+ |
| 2884 | // /-----| if (p0) memw(..)=r0 |---------\~ |
| 2885 | // || +---------------------+ || |
| 2886 | // promote || /\ /\ || promote |
| 2887 | // || /||\ /||\ || |
| 2888 | // \||/ demote || \||/ |
| 2889 | // \/ || || \/ |
| 2890 | // +-------------------------+ || +-------------------------+ |
| 2891 | // | if (p0.new) memw(..)=r0 | || | if (p0) memw(..)=r0.new | |
| 2892 | // +-------------------------+ || +-------------------------+ |
| 2893 | // || || || |
| 2894 | // || demote \||/ |
| 2895 | // promote || \/ NOT possible |
| 2896 | // || || /\~ |
| 2897 | // \||/ || /||\~ |
| 2898 | // \/ || || |
| 2899 | // +-----------------------------+ |
| 2900 | // | if (p0.new) memw(..)=r0.new | |
| 2901 | // +-----------------------------+ |
| 2902 | // Double Dot New Store |
| 2903 | // |
| 2904 | } |
| 2905 | } |
| 2906 | |
| 2907 | |
| 2908 | |
Andrew Trick | ee498d3 | 2012-02-01 22:13:57 +0000 | [diff] [blame] | 2909 | DFAPacketizer *HexagonInstrInfo:: |
| 2910 | CreateTargetScheduleState(const TargetMachine *TM, |
| 2911 | const ScheduleDAG *DAG) const { |
| 2912 | const InstrItineraryData *II = TM->getInstrItineraryData(); |
| 2913 | return TM->getSubtarget<HexagonGenSubtargetInfo>().createDFAPacketizer(II); |
| 2914 | } |
| 2915 | |
| 2916 | bool HexagonInstrInfo::isSchedulingBoundary(const MachineInstr *MI, |
| 2917 | const MachineBasicBlock *MBB, |
| 2918 | const MachineFunction &MF) const { |
| 2919 | // Debug info is never a scheduling boundary. It's necessary to be explicit |
| 2920 | // due to the special treatment of IT instructions below, otherwise a |
| 2921 | // dbg_value followed by an IT will result in the IT instruction being |
| 2922 | // considered a scheduling hazard, which is wrong. It should be the actual |
| 2923 | // instruction preceding the dbg_value instruction(s), just like it is |
| 2924 | // when debug info is not present. |
| 2925 | if (MI->isDebugValue()) |
| 2926 | return false; |
| 2927 | |
| 2928 | // Terminators and labels can't be scheduled around. |
| 2929 | if (MI->getDesc().isTerminator() || MI->isLabel() || MI->isInlineAsm()) |
| 2930 | return true; |
| 2931 | |
| 2932 | return false; |
| 2933 | } |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 2934 | |
| 2935 | bool HexagonInstrInfo::isExpr(unsigned OpType) const { |
| 2936 | switch(OpType) { |
| 2937 | case MachineOperand::MO_MachineBasicBlock: |
| 2938 | case MachineOperand::MO_GlobalAddress: |
| 2939 | case MachineOperand::MO_ExternalSymbol: |
| 2940 | case MachineOperand::MO_JumpTableIndex: |
| 2941 | case MachineOperand::MO_ConstantPoolIndex: |
| 2942 | case MachineOperand::MO_BlockAddress: |
| 2943 | return true; |
| 2944 | default: |
| 2945 | return false; |
| 2946 | } |
| 2947 | } |
| 2948 | |
| 2949 | bool HexagonInstrInfo::isConstExtended(MachineInstr *MI) const { |
| 2950 | unsigned short Opcode = MI->getOpcode(); |
| 2951 | short ExtOpNum = HexagonConstExt::getCExtOpNum(Opcode); |
| 2952 | |
| 2953 | // Instruction has no constant extended operand. |
| 2954 | if (ExtOpNum == -1) |
| 2955 | return false; |
| 2956 | |
| 2957 | |
| 2958 | int MinValue = HexagonConstExt::getMinValue(Opcode); |
| 2959 | int MaxValue = HexagonConstExt::getMaxValue(Opcode); |
| 2960 | const MachineOperand &MO = MI->getOperand(ExtOpNum); |
| 2961 | if (!MO.isImm()) // no range check if the operand is non-immediate. |
| 2962 | return true; |
| 2963 | |
Sirish Pande | 2b38c12 | 2012-05-12 05:54:15 +0000 | [diff] [blame] | 2964 | int ImmValue = MO.getImm(); |
Brendon Cahoon | 6d532d8 | 2012-05-11 19:56:59 +0000 | [diff] [blame] | 2965 | return (ImmValue < MinValue || ImmValue > MaxValue); |
| 2966 | |
| 2967 | } |
| 2968 | |
| 2969 | // Returns true if a particular operand is extended for an instruction. |
| 2970 | bool HexagonConstExt::isOperandExtended(unsigned short Opcode, |
| 2971 | unsigned short OperandNum) { |
| 2972 | return HexagonCExt[Opcode].CExtOpNum == OperandNum; |
| 2973 | } |
| 2974 | |
| 2975 | // Returns Operand Index for the constant extended instruction. |
| 2976 | unsigned short HexagonConstExt::getCExtOpNum(unsigned short Opcode) { |
| 2977 | return HexagonCExt[Opcode].CExtOpNum; |
| 2978 | } |
| 2979 | |
| 2980 | // Returns the min value that doesn't need to be extended. |
| 2981 | int HexagonConstExt::getMinValue(unsigned short Opcode) { |
| 2982 | return HexagonCExt[Opcode].MinValue; |
| 2983 | } |
| 2984 | |
| 2985 | // Returns the max value that doesn't need to be extended. |
| 2986 | int HexagonConstExt::getMaxValue(unsigned short Opcode) { |
| 2987 | return HexagonCExt[Opcode].MaxValue; |
| 2988 | } |
| 2989 | |
| 2990 | // Returns true if an instruction can be converted into a non-extended |
| 2991 | // equivalent instruction. |
| 2992 | bool HexagonConstExt::NonExtEquivalentExists (unsigned short Opcode) { |
| 2993 | if (HexagonCExt[Opcode].NonExtOpcode < 0 ) |
| 2994 | return false; |
| 2995 | return true; |
| 2996 | } |
| 2997 | |
| 2998 | // Returns opcode of the non-extended equivalent instruction. |
| 2999 | int HexagonConstExt::getNonExtOpcode (unsigned short Opcode) { |
| 3000 | return HexagonCExt[Opcode].NonExtOpcode; |
| 3001 | } |