blob: 805a79deaa9b44aac1917f26df81e4b588303ba6 [file] [log] [blame]
Sirish Pande26f61a12012-05-03 21:52:53 +00001//===----- HexagonPacketizer.cpp - vliw packetizer ---------------------===//
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 implements a simple VLIW packetizer using DFA. The packetizer works on
11// machine basic blocks. For each instruction I in BB, the packetizer consults
12// the DFA to see if machine resources are available to execute I. If so, the
13// packetizer checks if I depends on any instruction J in the current packet.
14// If no dependency is found, I is added to current packet and machine resource
15// is marked as taken. If any dependency is found, a target API call is made to
16// prune the dependence.
17//
18//===----------------------------------------------------------------------===//
19#define DEBUG_TYPE "packets"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000020#include "llvm/CodeGen/DFAPacketizer.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000021#include "llvm/CodeGen/Passes.h"
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +000022#include "llvm/CodeGen/MachineDominators.h"
23#include "llvm/CodeGen/MachineFunctionPass.h"
24#include "llvm/CodeGen/MachineLoopInfo.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000025#include "llvm/CodeGen/ScheduleDAG.h"
26#include "llvm/CodeGen/ScheduleDAGInstrs.h"
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +000027#include "llvm/CodeGen/LatencyPriorityQueue.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000028#include "llvm/CodeGen/SchedulerRegistry.h"
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +000029#include "llvm/CodeGen/MachineFrameInfo.h"
30#include "llvm/CodeGen/MachineInstrBuilder.h"
31#include "llvm/CodeGen/MachineRegisterInfo.h"
32#include "llvm/CodeGen/MachineFunctionAnalysis.h"
33#include "llvm/CodeGen/ScheduleHazardRecognizer.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000034#include "llvm/Target/TargetMachine.h"
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +000035#include "llvm/Target/TargetInstrInfo.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000036#include "llvm/Target/TargetRegisterInfo.h"
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +000037#include "llvm/ADT/DenseMap.h"
38#include "llvm/ADT/Statistic.h"
39#include "llvm/Support/MathExtras.h"
40#include "llvm/MC/MCInstrItineraries.h"
41#include "llvm/Support/Compiler.h"
42#include "llvm/Support/CommandLine.h"
43#include "llvm/Support/Debug.h"
44#include "Hexagon.h"
45#include "HexagonTargetMachine.h"
46#include "HexagonRegisterInfo.h"
47#include "HexagonSubtarget.h"
48#include "HexagonMachineFunctionInfo.h"
49
Sirish Pande26f61a12012-05-03 21:52:53 +000050#include <map>
51
52using namespace llvm;
53
54namespace {
55 class HexagonPacketizer : public MachineFunctionPass {
56
57 public:
58 static char ID;
59 HexagonPacketizer() : MachineFunctionPass(ID) {}
60
61 void getAnalysisUsage(AnalysisUsage &AU) const {
62 AU.setPreservesCFG();
63 AU.addRequired<MachineDominatorTree>();
64 AU.addPreserved<MachineDominatorTree>();
65 AU.addRequired<MachineLoopInfo>();
66 AU.addPreserved<MachineLoopInfo>();
67 MachineFunctionPass::getAnalysisUsage(AU);
68 }
69
70 const char *getPassName() const {
71 return "Hexagon Packetizer";
72 }
73
74 bool runOnMachineFunction(MachineFunction &Fn);
75 };
76 char HexagonPacketizer::ID = 0;
77
78 class HexagonPacketizerList : public VLIWPacketizerList {
79
80 private:
81
82 // Has the instruction been promoted to a dot-new instruction.
83 bool PromotedToDotNew;
84
85 // Has the instruction been glued to allocframe.
86 bool GlueAllocframeStore;
87
88 // Has the feeder instruction been glued to new value jump.
89 bool GlueToNewValueJump;
90
91 // Check if there is a dependence between some instruction already in this
92 // packet and this instruction.
93 bool Dependence;
94
95 // Only check for dependence if there are resources available to
96 // schedule this instruction.
97 bool FoundSequentialDependence;
98
99 public:
100 // Ctor.
101 HexagonPacketizerList(MachineFunction &MF, MachineLoopInfo &MLI,
102 MachineDominatorTree &MDT);
103
104 // initPacketizerState - initialize some internal flags.
105 void initPacketizerState();
106
107 // ignorePseudoInstruction - Ignore bundling of pseudo instructions.
108 bool ignorePseudoInstruction(MachineInstr *MI, MachineBasicBlock *MBB);
109
110 // isSoloInstruction - return true if instruction MI can not be packetized
111 // with any other instruction, which means that MI itself is a packet.
112 bool isSoloInstruction(MachineInstr *MI);
113
114 // isLegalToPacketizeTogether - Is it legal to packetize SUI and SUJ
115 // together.
116 bool isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ);
117
118 // isLegalToPruneDependencies - Is it legal to prune dependece between SUI
119 // and SUJ.
120 bool isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ);
121
122 MachineBasicBlock::iterator addToPacket(MachineInstr *MI);
123 private:
124 bool IsCallDependent(MachineInstr* MI, SDep::Kind DepType, unsigned DepReg);
125 bool PromoteToDotNew(MachineInstr* MI, SDep::Kind DepType,
126 MachineBasicBlock::iterator &MII,
127 const TargetRegisterClass* RC);
128 bool CanPromoteToDotNew(MachineInstr* MI, SUnit* PacketSU,
129 unsigned DepReg,
130 std::map <MachineInstr*, SUnit*> MIToSUnit,
131 MachineBasicBlock::iterator &MII,
132 const TargetRegisterClass* RC);
133 bool CanPromoteToNewValue(MachineInstr* MI, SUnit* PacketSU,
134 unsigned DepReg,
135 std::map <MachineInstr*, SUnit*> MIToSUnit,
136 MachineBasicBlock::iterator &MII);
137 bool CanPromoteToNewValueStore(MachineInstr* MI, MachineInstr* PacketMI,
138 unsigned DepReg,
139 std::map <MachineInstr*, SUnit*> MIToSUnit);
140 bool DemoteToDotOld(MachineInstr* MI);
141 bool ArePredicatesComplements(MachineInstr* MI1, MachineInstr* MI2,
142 std::map <MachineInstr*, SUnit*> MIToSUnit);
143 bool RestrictingDepExistInPacket(MachineInstr*,
144 unsigned, std::map <MachineInstr*, SUnit*>);
145 bool isNewifiable(MachineInstr* MI);
146 bool isCondInst(MachineInstr* MI);
147 bool IsNewifyStore (MachineInstr* MI);
148 bool tryAllocateResourcesForConstExt(MachineInstr* MI);
149 bool canReserveResourcesForConstExt(MachineInstr *MI);
150 void reserveResourcesForConstExt(MachineInstr* MI);
151 bool isNewValueInst(MachineInstr* MI);
Sirish Pande26f61a12012-05-03 21:52:53 +0000152 };
153}
154
155// HexagonPacketizerList Ctor.
156HexagonPacketizerList::HexagonPacketizerList(
157 MachineFunction &MF, MachineLoopInfo &MLI,MachineDominatorTree &MDT)
158 : VLIWPacketizerList(MF, MLI, MDT, true){
159}
160
161bool HexagonPacketizer::runOnMachineFunction(MachineFunction &Fn) {
162 const TargetInstrInfo *TII = Fn.getTarget().getInstrInfo();
163 MachineLoopInfo &MLI = getAnalysis<MachineLoopInfo>();
164 MachineDominatorTree &MDT = getAnalysis<MachineDominatorTree>();
165
166 // Instantiate the packetizer.
167 HexagonPacketizerList Packetizer(Fn, MLI, MDT);
168
169 // DFA state table should not be empty.
170 assert(Packetizer.getResourceTracker() && "Empty DFA table!");
171
172 //
173 // Loop over all basic blocks and remove KILL pseudo-instructions
174 // These instructions confuse the dependence analysis. Consider:
175 // D0 = ... (Insn 0)
176 // R0 = KILL R0, D0 (Insn 1)
177 // R0 = ... (Insn 2)
178 // Here, Insn 1 will result in the dependence graph not emitting an output
179 // dependence between Insn 0 and Insn 2. This can lead to incorrect
180 // packetization
181 //
182 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
183 MBB != MBBe; ++MBB) {
184 MachineBasicBlock::iterator End = MBB->end();
185 MachineBasicBlock::iterator MI = MBB->begin();
186 while (MI != End) {
187 if (MI->isKill()) {
188 MachineBasicBlock::iterator DeleteMI = MI;
189 ++MI;
190 MBB->erase(DeleteMI);
191 End = MBB->end();
192 continue;
193 }
194 ++MI;
195 }
196 }
197
198 // Loop over all of the basic blocks.
199 for (MachineFunction::iterator MBB = Fn.begin(), MBBe = Fn.end();
200 MBB != MBBe; ++MBB) {
201 // Find scheduling regions and schedule / packetize each region.
202 unsigned RemainingCount = MBB->size();
203 for(MachineBasicBlock::iterator RegionEnd = MBB->end();
204 RegionEnd != MBB->begin();) {
205 // The next region starts above the previous region. Look backward in the
206 // instruction stream until we find the nearest boundary.
207 MachineBasicBlock::iterator I = RegionEnd;
208 for(;I != MBB->begin(); --I, --RemainingCount) {
209 if (TII->isSchedulingBoundary(llvm::prior(I), MBB, Fn))
210 break;
211 }
212 I = MBB->begin();
213
214 // Skip empty scheduling regions.
215 if (I == RegionEnd) {
216 RegionEnd = llvm::prior(RegionEnd);
217 --RemainingCount;
218 continue;
219 }
220 // Skip regions with one instruction.
221 if (I == llvm::prior(RegionEnd)) {
222 RegionEnd = llvm::prior(RegionEnd);
223 continue;
224 }
225
226 Packetizer.PacketizeMIs(MBB, I, RegionEnd);
227 RegionEnd = I;
228 }
229 }
230
231 return true;
232}
233
234
235static bool IsIndirectCall(MachineInstr* MI) {
236 return ((MI->getOpcode() == Hexagon::CALLR) ||
237 (MI->getOpcode() == Hexagon::CALLRv3));
238}
239
240// Reserve resources for constant extender. Trigure an assertion if
241// reservation fail.
242void HexagonPacketizerList::reserveResourcesForConstExt(MachineInstr* MI) {
243 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
Jyotsna Verma39498d12012-12-20 06:45:39 +0000244 MachineFunction *MF = MI->getParent()->getParent();
245 MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT_i),
246 MI->getDebugLoc());
Sirish Pande26f61a12012-05-03 21:52:53 +0000247
248 if (ResourceTracker->canReserveResources(PseudoMI)) {
249 ResourceTracker->reserveResources(PseudoMI);
250 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
251 } else {
252 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
253 llvm_unreachable("can not reserve resources for constant extender.");
254 }
255 return;
256}
257
258bool HexagonPacketizerList::canReserveResourcesForConstExt(MachineInstr *MI) {
259 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +0000260 assert((QII->isExtended(MI) || QII->isConstExtended(MI)) &&
Sirish Pande26f61a12012-05-03 21:52:53 +0000261 "Should only be called for constant extended instructions");
262 MachineFunction *MF = MI->getParent()->getParent();
Jyotsna Verma39498d12012-12-20 06:45:39 +0000263 MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT_i),
Sirish Pande26f61a12012-05-03 21:52:53 +0000264 MI->getDebugLoc());
265 bool CanReserve = ResourceTracker->canReserveResources(PseudoMI);
266 MF->DeleteMachineInstr(PseudoMI);
267 return CanReserve;
268}
269
270// Allocate resources (i.e. 4 bytes) for constant extender. If succeed, return
271// true, otherwise, return false.
272bool HexagonPacketizerList::tryAllocateResourcesForConstExt(MachineInstr* MI) {
273 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
Jyotsna Verma39498d12012-12-20 06:45:39 +0000274 MachineFunction *MF = MI->getParent()->getParent();
275 MachineInstr *PseudoMI = MF->CreateMachineInstr(QII->get(Hexagon::IMMEXT_i),
276 MI->getDebugLoc());
Sirish Pande26f61a12012-05-03 21:52:53 +0000277
278 if (ResourceTracker->canReserveResources(PseudoMI)) {
279 ResourceTracker->reserveResources(PseudoMI);
280 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
281 return true;
282 } else {
283 MI->getParent()->getParent()->DeleteMachineInstr(PseudoMI);
284 return false;
285 }
286}
287
288
289bool HexagonPacketizerList::IsCallDependent(MachineInstr* MI,
290 SDep::Kind DepType,
291 unsigned DepReg) {
292
293 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
294 const HexagonRegisterInfo* QRI =
295 (const HexagonRegisterInfo *) TM.getRegisterInfo();
296
297 // Check for lr dependence
298 if (DepReg == QRI->getRARegister()) {
299 return true;
300 }
301
302 if (QII->isDeallocRet(MI)) {
303 if (DepReg == QRI->getFrameRegister() ||
304 DepReg == QRI->getStackRegister())
305 return true;
306 }
307
308 // Check if this is a predicate dependence
309 const TargetRegisterClass* RC = QRI->getMinimalPhysRegClass(DepReg);
310 if (RC == &Hexagon::PredRegsRegClass) {
311 return true;
312 }
313
314 //
315 // Lastly check for an operand used in an indirect call
316 // If we had an attribute for checking if an instruction is an indirect call,
317 // then we could have avoided this relatively brittle implementation of
318 // IsIndirectCall()
319 //
320 // Assumes that the first operand of the CALLr is the function address
321 //
322 if (IsIndirectCall(MI) && (DepType == SDep::Data)) {
323 MachineOperand MO = MI->getOperand(0);
324 if (MO.isReg() && MO.isUse() && (MO.getReg() == DepReg)) {
325 return true;
326 }
327 }
328
329 return false;
330}
331
332static bool IsRegDependence(const SDep::Kind DepType) {
333 return (DepType == SDep::Data || DepType == SDep::Anti ||
334 DepType == SDep::Output);
335}
336
337static bool IsDirectJump(MachineInstr* MI) {
338 return (MI->getOpcode() == Hexagon::JMP);
339}
340
341static bool IsSchedBarrier(MachineInstr* MI) {
342 switch (MI->getOpcode()) {
343 case Hexagon::BARRIER:
344 return true;
345 }
346 return false;
347}
348
349static bool IsControlFlow(MachineInstr* MI) {
350 return (MI->getDesc().isTerminator() || MI->getDesc().isCall());
351}
352
Sirish Pande26f61a12012-05-03 21:52:53 +0000353// Function returns true if an instruction can be promoted to the new-value
354// store. It will always return false for v2 and v3.
355// It lists all the conditional and unconditional stores that can be promoted
356// to the new-value stores.
357
358bool HexagonPacketizerList::IsNewifyStore (MachineInstr* MI) {
359 const HexagonRegisterInfo* QRI =
360 (const HexagonRegisterInfo *) TM.getRegisterInfo();
361 switch (MI->getOpcode())
362 {
363 // store byte
364 case Hexagon::STrib:
365 case Hexagon::STrib_indexed:
366 case Hexagon::STrib_indexed_shl_V4:
367 case Hexagon::STrib_shl_V4:
Sirish Pande26f61a12012-05-03 21:52:53 +0000368 case Hexagon::STb_GP_V4:
369 case Hexagon::POST_STbri:
370 case Hexagon::STrib_cPt:
371 case Hexagon::STrib_cdnPt_V4:
372 case Hexagon::STrib_cNotPt:
373 case Hexagon::STrib_cdnNotPt_V4:
374 case Hexagon::STrib_indexed_cPt:
375 case Hexagon::STrib_indexed_cdnPt_V4:
376 case Hexagon::STrib_indexed_cNotPt:
377 case Hexagon::STrib_indexed_cdnNotPt_V4:
378 case Hexagon::STrib_indexed_shl_cPt_V4:
379 case Hexagon::STrib_indexed_shl_cdnPt_V4:
380 case Hexagon::STrib_indexed_shl_cNotPt_V4:
381 case Hexagon::STrib_indexed_shl_cdnNotPt_V4:
382 case Hexagon::POST_STbri_cPt:
383 case Hexagon::POST_STbri_cdnPt_V4:
384 case Hexagon::POST_STbri_cNotPt:
385 case Hexagon::POST_STbri_cdnNotPt_V4:
386 case Hexagon::STb_GP_cPt_V4:
387 case Hexagon::STb_GP_cNotPt_V4:
388 case Hexagon::STb_GP_cdnPt_V4:
389 case Hexagon::STb_GP_cdnNotPt_V4:
Sirish Pande26f61a12012-05-03 21:52:53 +0000390
391 // store halfword
392 case Hexagon::STrih:
393 case Hexagon::STrih_indexed:
394 case Hexagon::STrih_indexed_shl_V4:
395 case Hexagon::STrih_shl_V4:
Sirish Pande26f61a12012-05-03 21:52:53 +0000396 case Hexagon::STh_GP_V4:
397 case Hexagon::POST_SThri:
398 case Hexagon::STrih_cPt:
399 case Hexagon::STrih_cdnPt_V4:
400 case Hexagon::STrih_cNotPt:
401 case Hexagon::STrih_cdnNotPt_V4:
402 case Hexagon::STrih_indexed_cPt:
403 case Hexagon::STrih_indexed_cdnPt_V4:
404 case Hexagon::STrih_indexed_cNotPt:
405 case Hexagon::STrih_indexed_cdnNotPt_V4:
406 case Hexagon::STrih_indexed_shl_cPt_V4:
407 case Hexagon::STrih_indexed_shl_cdnPt_V4:
408 case Hexagon::STrih_indexed_shl_cNotPt_V4:
409 case Hexagon::STrih_indexed_shl_cdnNotPt_V4:
410 case Hexagon::POST_SThri_cPt:
411 case Hexagon::POST_SThri_cdnPt_V4:
412 case Hexagon::POST_SThri_cNotPt:
413 case Hexagon::POST_SThri_cdnNotPt_V4:
414 case Hexagon::STh_GP_cPt_V4:
415 case Hexagon::STh_GP_cNotPt_V4:
416 case Hexagon::STh_GP_cdnPt_V4:
417 case Hexagon::STh_GP_cdnNotPt_V4:
Sirish Pande26f61a12012-05-03 21:52:53 +0000418
419 // store word
420 case Hexagon::STriw:
421 case Hexagon::STriw_indexed:
422 case Hexagon::STriw_indexed_shl_V4:
423 case Hexagon::STriw_shl_V4:
Sirish Pande26f61a12012-05-03 21:52:53 +0000424 case Hexagon::STw_GP_V4:
425 case Hexagon::POST_STwri:
426 case Hexagon::STriw_cPt:
427 case Hexagon::STriw_cdnPt_V4:
428 case Hexagon::STriw_cNotPt:
429 case Hexagon::STriw_cdnNotPt_V4:
430 case Hexagon::STriw_indexed_cPt:
431 case Hexagon::STriw_indexed_cdnPt_V4:
432 case Hexagon::STriw_indexed_cNotPt:
433 case Hexagon::STriw_indexed_cdnNotPt_V4:
434 case Hexagon::STriw_indexed_shl_cPt_V4:
435 case Hexagon::STriw_indexed_shl_cdnPt_V4:
436 case Hexagon::STriw_indexed_shl_cNotPt_V4:
437 case Hexagon::STriw_indexed_shl_cdnNotPt_V4:
438 case Hexagon::POST_STwri_cPt:
439 case Hexagon::POST_STwri_cdnPt_V4:
440 case Hexagon::POST_STwri_cNotPt:
441 case Hexagon::POST_STwri_cdnNotPt_V4:
442 case Hexagon::STw_GP_cPt_V4:
443 case Hexagon::STw_GP_cNotPt_V4:
444 case Hexagon::STw_GP_cdnPt_V4:
445 case Hexagon::STw_GP_cdnNotPt_V4:
Sirish Pande26f61a12012-05-03 21:52:53 +0000446 return QRI->Subtarget.hasV4TOps();
447 }
448 return false;
449}
450
451static bool IsLoopN(MachineInstr *MI) {
452 return (MI->getOpcode() == Hexagon::LOOP0_i ||
453 MI->getOpcode() == Hexagon::LOOP0_r);
454}
455
456/// DoesModifyCalleeSavedReg - Returns true if the instruction modifies a
457/// callee-saved register.
458static bool DoesModifyCalleeSavedReg(MachineInstr *MI,
459 const TargetRegisterInfo *TRI) {
460 for (const uint16_t *CSR = TRI->getCalleeSavedRegs(); *CSR; ++CSR) {
461 unsigned CalleeSavedReg = *CSR;
462 if (MI->modifiesRegister(CalleeSavedReg, TRI))
463 return true;
464 }
465 return false;
466}
467
468// Return the new value instruction for a given store.
469static int GetDotNewOp(const int opc) {
470 switch (opc) {
471 default: llvm_unreachable("Unknown .new type");
472 // store new value byte
473 case Hexagon::STrib:
474 return Hexagon::STrib_nv_V4;
475
476 case Hexagon::STrib_indexed:
477 return Hexagon::STrib_indexed_nv_V4;
478
479 case Hexagon::STrib_indexed_shl_V4:
480 return Hexagon::STrib_indexed_shl_nv_V4;
481
482 case Hexagon::STrib_shl_V4:
483 return Hexagon::STrib_shl_nv_V4;
484
Sirish Pande26f61a12012-05-03 21:52:53 +0000485 case Hexagon::STb_GP_V4:
486 return Hexagon::STb_GP_nv_V4;
487
488 case Hexagon::POST_STbri:
489 return Hexagon::POST_STbri_nv_V4;
490
491 case Hexagon::STrib_cPt:
492 return Hexagon::STrib_cPt_nv_V4;
493
494 case Hexagon::STrib_cdnPt_V4:
495 return Hexagon::STrib_cdnPt_nv_V4;
496
497 case Hexagon::STrib_cNotPt:
498 return Hexagon::STrib_cNotPt_nv_V4;
499
500 case Hexagon::STrib_cdnNotPt_V4:
501 return Hexagon::STrib_cdnNotPt_nv_V4;
502
503 case Hexagon::STrib_indexed_cPt:
504 return Hexagon::STrib_indexed_cPt_nv_V4;
505
506 case Hexagon::STrib_indexed_cdnPt_V4:
507 return Hexagon::STrib_indexed_cdnPt_nv_V4;
508
509 case Hexagon::STrib_indexed_cNotPt:
510 return Hexagon::STrib_indexed_cNotPt_nv_V4;
511
512 case Hexagon::STrib_indexed_cdnNotPt_V4:
513 return Hexagon::STrib_indexed_cdnNotPt_nv_V4;
514
515 case Hexagon::STrib_indexed_shl_cPt_V4:
516 return Hexagon::STrib_indexed_shl_cPt_nv_V4;
517
518 case Hexagon::STrib_indexed_shl_cdnPt_V4:
519 return Hexagon::STrib_indexed_shl_cdnPt_nv_V4;
520
521 case Hexagon::STrib_indexed_shl_cNotPt_V4:
522 return Hexagon::STrib_indexed_shl_cNotPt_nv_V4;
523
524 case Hexagon::STrib_indexed_shl_cdnNotPt_V4:
525 return Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4;
526
527 case Hexagon::POST_STbri_cPt:
528 return Hexagon::POST_STbri_cPt_nv_V4;
529
530 case Hexagon::POST_STbri_cdnPt_V4:
531 return Hexagon::POST_STbri_cdnPt_nv_V4;
532
533 case Hexagon::POST_STbri_cNotPt:
534 return Hexagon::POST_STbri_cNotPt_nv_V4;
535
536 case Hexagon::POST_STbri_cdnNotPt_V4:
537 return Hexagon::POST_STbri_cdnNotPt_nv_V4;
538
539 case Hexagon::STb_GP_cPt_V4:
540 return Hexagon::STb_GP_cPt_nv_V4;
541
542 case Hexagon::STb_GP_cNotPt_V4:
543 return Hexagon::STb_GP_cNotPt_nv_V4;
544
545 case Hexagon::STb_GP_cdnPt_V4:
546 return Hexagon::STb_GP_cdnPt_nv_V4;
547
548 case Hexagon::STb_GP_cdnNotPt_V4:
549 return Hexagon::STb_GP_cdnNotPt_nv_V4;
550
Sirish Pande26f61a12012-05-03 21:52:53 +0000551 // store new value halfword
552 case Hexagon::STrih:
553 return Hexagon::STrih_nv_V4;
554
555 case Hexagon::STrih_indexed:
556 return Hexagon::STrih_indexed_nv_V4;
557
558 case Hexagon::STrih_indexed_shl_V4:
559 return Hexagon::STrih_indexed_shl_nv_V4;
560
561 case Hexagon::STrih_shl_V4:
562 return Hexagon::STrih_shl_nv_V4;
563
Sirish Pande26f61a12012-05-03 21:52:53 +0000564 case Hexagon::STh_GP_V4:
565 return Hexagon::STh_GP_nv_V4;
566
567 case Hexagon::POST_SThri:
568 return Hexagon::POST_SThri_nv_V4;
569
570 case Hexagon::STrih_cPt:
571 return Hexagon::STrih_cPt_nv_V4;
572
573 case Hexagon::STrih_cdnPt_V4:
574 return Hexagon::STrih_cdnPt_nv_V4;
575
576 case Hexagon::STrih_cNotPt:
577 return Hexagon::STrih_cNotPt_nv_V4;
578
579 case Hexagon::STrih_cdnNotPt_V4:
580 return Hexagon::STrih_cdnNotPt_nv_V4;
581
582 case Hexagon::STrih_indexed_cPt:
583 return Hexagon::STrih_indexed_cPt_nv_V4;
584
585 case Hexagon::STrih_indexed_cdnPt_V4:
586 return Hexagon::STrih_indexed_cdnPt_nv_V4;
587
588 case Hexagon::STrih_indexed_cNotPt:
589 return Hexagon::STrih_indexed_cNotPt_nv_V4;
590
591 case Hexagon::STrih_indexed_cdnNotPt_V4:
592 return Hexagon::STrih_indexed_cdnNotPt_nv_V4;
593
594 case Hexagon::STrih_indexed_shl_cPt_V4:
595 return Hexagon::STrih_indexed_shl_cPt_nv_V4;
596
597 case Hexagon::STrih_indexed_shl_cdnPt_V4:
598 return Hexagon::STrih_indexed_shl_cdnPt_nv_V4;
599
600 case Hexagon::STrih_indexed_shl_cNotPt_V4:
601 return Hexagon::STrih_indexed_shl_cNotPt_nv_V4;
602
603 case Hexagon::STrih_indexed_shl_cdnNotPt_V4:
604 return Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4;
605
606 case Hexagon::POST_SThri_cPt:
607 return Hexagon::POST_SThri_cPt_nv_V4;
608
609 case Hexagon::POST_SThri_cdnPt_V4:
610 return Hexagon::POST_SThri_cdnPt_nv_V4;
611
612 case Hexagon::POST_SThri_cNotPt:
613 return Hexagon::POST_SThri_cNotPt_nv_V4;
614
615 case Hexagon::POST_SThri_cdnNotPt_V4:
616 return Hexagon::POST_SThri_cdnNotPt_nv_V4;
617
618 case Hexagon::STh_GP_cPt_V4:
619 return Hexagon::STh_GP_cPt_nv_V4;
620
621 case Hexagon::STh_GP_cNotPt_V4:
622 return Hexagon::STh_GP_cNotPt_nv_V4;
623
624 case Hexagon::STh_GP_cdnPt_V4:
625 return Hexagon::STh_GP_cdnPt_nv_V4;
626
627 case Hexagon::STh_GP_cdnNotPt_V4:
628 return Hexagon::STh_GP_cdnNotPt_nv_V4;
629
Sirish Pande26f61a12012-05-03 21:52:53 +0000630 // store new value word
631 case Hexagon::STriw:
632 return Hexagon::STriw_nv_V4;
633
634 case Hexagon::STriw_indexed:
635 return Hexagon::STriw_indexed_nv_V4;
636
637 case Hexagon::STriw_indexed_shl_V4:
638 return Hexagon::STriw_indexed_shl_nv_V4;
639
640 case Hexagon::STriw_shl_V4:
641 return Hexagon::STriw_shl_nv_V4;
642
Sirish Pande26f61a12012-05-03 21:52:53 +0000643 case Hexagon::STw_GP_V4:
644 return Hexagon::STw_GP_nv_V4;
645
646 case Hexagon::POST_STwri:
647 return Hexagon::POST_STwri_nv_V4;
648
649 case Hexagon::STriw_cPt:
650 return Hexagon::STriw_cPt_nv_V4;
651
652 case Hexagon::STriw_cdnPt_V4:
653 return Hexagon::STriw_cdnPt_nv_V4;
654
655 case Hexagon::STriw_cNotPt:
656 return Hexagon::STriw_cNotPt_nv_V4;
657
658 case Hexagon::STriw_cdnNotPt_V4:
659 return Hexagon::STriw_cdnNotPt_nv_V4;
660
661 case Hexagon::STriw_indexed_cPt:
662 return Hexagon::STriw_indexed_cPt_nv_V4;
663
664 case Hexagon::STriw_indexed_cdnPt_V4:
665 return Hexagon::STriw_indexed_cdnPt_nv_V4;
666
667 case Hexagon::STriw_indexed_cNotPt:
668 return Hexagon::STriw_indexed_cNotPt_nv_V4;
669
670 case Hexagon::STriw_indexed_cdnNotPt_V4:
671 return Hexagon::STriw_indexed_cdnNotPt_nv_V4;
672
673 case Hexagon::STriw_indexed_shl_cPt_V4:
674 return Hexagon::STriw_indexed_shl_cPt_nv_V4;
675
676 case Hexagon::STriw_indexed_shl_cdnPt_V4:
677 return Hexagon::STriw_indexed_shl_cdnPt_nv_V4;
678
679 case Hexagon::STriw_indexed_shl_cNotPt_V4:
680 return Hexagon::STriw_indexed_shl_cNotPt_nv_V4;
681
682 case Hexagon::STriw_indexed_shl_cdnNotPt_V4:
683 return Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4;
684
685 case Hexagon::POST_STwri_cPt:
686 return Hexagon::POST_STwri_cPt_nv_V4;
687
688 case Hexagon::POST_STwri_cdnPt_V4:
689 return Hexagon::POST_STwri_cdnPt_nv_V4;
690
691 case Hexagon::POST_STwri_cNotPt:
692 return Hexagon::POST_STwri_cNotPt_nv_V4;
693
694 case Hexagon::POST_STwri_cdnNotPt_V4:
695 return Hexagon::POST_STwri_cdnNotPt_nv_V4;
696
697 case Hexagon::STw_GP_cPt_V4:
698 return Hexagon::STw_GP_cPt_nv_V4;
699
700 case Hexagon::STw_GP_cNotPt_V4:
701 return Hexagon::STw_GP_cNotPt_nv_V4;
702
703 case Hexagon::STw_GP_cdnPt_V4:
704 return Hexagon::STw_GP_cdnPt_nv_V4;
705
706 case Hexagon::STw_GP_cdnNotPt_V4:
707 return Hexagon::STw_GP_cdnNotPt_nv_V4;
708
Sirish Pande26f61a12012-05-03 21:52:53 +0000709 }
710}
711
712// Return .new predicate version for an instruction
713static int GetDotNewPredOp(const int opc) {
714 switch (opc) {
715 default: llvm_unreachable("Unknown .new type");
716 // Conditional stores
717 // Store byte conditionally
718 case Hexagon::STrib_cPt :
719 return Hexagon::STrib_cdnPt_V4;
720
721 case Hexagon::STrib_cNotPt :
722 return Hexagon::STrib_cdnNotPt_V4;
723
724 case Hexagon::STrib_indexed_cPt :
725 return Hexagon::STrib_indexed_cdnPt_V4;
726
727 case Hexagon::STrib_indexed_cNotPt :
728 return Hexagon::STrib_indexed_cdnNotPt_V4;
729
730 case Hexagon::STrib_imm_cPt_V4 :
731 return Hexagon::STrib_imm_cdnPt_V4;
732
733 case Hexagon::STrib_imm_cNotPt_V4 :
734 return Hexagon::STrib_imm_cdnNotPt_V4;
735
736 case Hexagon::POST_STbri_cPt :
737 return Hexagon::POST_STbri_cdnPt_V4;
738
739 case Hexagon::POST_STbri_cNotPt :
740 return Hexagon::POST_STbri_cdnNotPt_V4;
741
742 case Hexagon::STrib_indexed_shl_cPt_V4 :
743 return Hexagon::STrib_indexed_shl_cdnPt_V4;
744
745 case Hexagon::STrib_indexed_shl_cNotPt_V4 :
746 return Hexagon::STrib_indexed_shl_cdnNotPt_V4;
747
748 case Hexagon::STb_GP_cPt_V4 :
749 return Hexagon::STb_GP_cdnPt_V4;
750
751 case Hexagon::STb_GP_cNotPt_V4 :
752 return Hexagon::STb_GP_cdnNotPt_V4;
753
Sirish Pande26f61a12012-05-03 21:52:53 +0000754 // Store doubleword conditionally
755 case Hexagon::STrid_cPt :
756 return Hexagon::STrid_cdnPt_V4;
757
758 case Hexagon::STrid_cNotPt :
759 return Hexagon::STrid_cdnNotPt_V4;
760
761 case Hexagon::STrid_indexed_cPt :
762 return Hexagon::STrid_indexed_cdnPt_V4;
763
764 case Hexagon::STrid_indexed_cNotPt :
765 return Hexagon::STrid_indexed_cdnNotPt_V4;
766
767 case Hexagon::STrid_indexed_shl_cPt_V4 :
768 return Hexagon::STrid_indexed_shl_cdnPt_V4;
769
770 case Hexagon::STrid_indexed_shl_cNotPt_V4 :
771 return Hexagon::STrid_indexed_shl_cdnNotPt_V4;
772
773 case Hexagon::POST_STdri_cPt :
774 return Hexagon::POST_STdri_cdnPt_V4;
775
776 case Hexagon::POST_STdri_cNotPt :
777 return Hexagon::POST_STdri_cdnNotPt_V4;
778
779 case Hexagon::STd_GP_cPt_V4 :
780 return Hexagon::STd_GP_cdnPt_V4;
781
782 case Hexagon::STd_GP_cNotPt_V4 :
783 return Hexagon::STd_GP_cdnNotPt_V4;
784
Sirish Pande26f61a12012-05-03 21:52:53 +0000785 // Store halfword conditionally
786 case Hexagon::STrih_cPt :
787 return Hexagon::STrih_cdnPt_V4;
788
789 case Hexagon::STrih_cNotPt :
790 return Hexagon::STrih_cdnNotPt_V4;
791
792 case Hexagon::STrih_indexed_cPt :
793 return Hexagon::STrih_indexed_cdnPt_V4;
794
795 case Hexagon::STrih_indexed_cNotPt :
796 return Hexagon::STrih_indexed_cdnNotPt_V4;
797
798 case Hexagon::STrih_imm_cPt_V4 :
799 return Hexagon::STrih_imm_cdnPt_V4;
800
801 case Hexagon::STrih_imm_cNotPt_V4 :
802 return Hexagon::STrih_imm_cdnNotPt_V4;
803
804 case Hexagon::STrih_indexed_shl_cPt_V4 :
805 return Hexagon::STrih_indexed_shl_cdnPt_V4;
806
807 case Hexagon::STrih_indexed_shl_cNotPt_V4 :
808 return Hexagon::STrih_indexed_shl_cdnNotPt_V4;
809
810 case Hexagon::POST_SThri_cPt :
811 return Hexagon::POST_SThri_cdnPt_V4;
812
813 case Hexagon::POST_SThri_cNotPt :
814 return Hexagon::POST_SThri_cdnNotPt_V4;
815
816 case Hexagon::STh_GP_cPt_V4 :
817 return Hexagon::STh_GP_cdnPt_V4;
818
819 case Hexagon::STh_GP_cNotPt_V4 :
820 return Hexagon::STh_GP_cdnNotPt_V4;
821
Sirish Pande26f61a12012-05-03 21:52:53 +0000822 // Store word conditionally
823 case Hexagon::STriw_cPt :
824 return Hexagon::STriw_cdnPt_V4;
825
826 case Hexagon::STriw_cNotPt :
827 return Hexagon::STriw_cdnNotPt_V4;
828
829 case Hexagon::STriw_indexed_cPt :
830 return Hexagon::STriw_indexed_cdnPt_V4;
831
832 case Hexagon::STriw_indexed_cNotPt :
833 return Hexagon::STriw_indexed_cdnNotPt_V4;
834
835 case Hexagon::STriw_imm_cPt_V4 :
836 return Hexagon::STriw_imm_cdnPt_V4;
837
838 case Hexagon::STriw_imm_cNotPt_V4 :
839 return Hexagon::STriw_imm_cdnNotPt_V4;
840
841 case Hexagon::STriw_indexed_shl_cPt_V4 :
842 return Hexagon::STriw_indexed_shl_cdnPt_V4;
843
844 case Hexagon::STriw_indexed_shl_cNotPt_V4 :
845 return Hexagon::STriw_indexed_shl_cdnNotPt_V4;
846
847 case Hexagon::POST_STwri_cPt :
848 return Hexagon::POST_STwri_cdnPt_V4;
849
850 case Hexagon::POST_STwri_cNotPt :
851 return Hexagon::POST_STwri_cdnNotPt_V4;
852
853 case Hexagon::STw_GP_cPt_V4 :
854 return Hexagon::STw_GP_cdnPt_V4;
855
856 case Hexagon::STw_GP_cNotPt_V4 :
857 return Hexagon::STw_GP_cdnNotPt_V4;
858
Sirish Pande26f61a12012-05-03 21:52:53 +0000859 // Condtional Jumps
Jyotsna Verma6ea706e2013-05-01 21:37:34 +0000860 case Hexagon::JMP_t:
861 return Hexagon::JMP_f;
Sirish Pande26f61a12012-05-03 21:52:53 +0000862
Jyotsna Verma6ea706e2013-05-01 21:37:34 +0000863 case Hexagon::JMP_f:
864 return Hexagon::JMP_fnew_t;
Sirish Pande26f61a12012-05-03 21:52:53 +0000865
Jyotsna Verma6ea706e2013-05-01 21:37:34 +0000866 case Hexagon::JMPR_t:
867 return Hexagon::JMPR_tnew_tV3;
Sirish Pande26f61a12012-05-03 21:52:53 +0000868
Jyotsna Verma6ea706e2013-05-01 21:37:34 +0000869 case Hexagon::JMPR_f:
870 return Hexagon::JMPR_fnew_tV3;
Sirish Pande26f61a12012-05-03 21:52:53 +0000871
872 // Conditional Transfers
873 case Hexagon::TFR_cPt:
874 return Hexagon::TFR_cdnPt;
875
876 case Hexagon::TFR_cNotPt:
877 return Hexagon::TFR_cdnNotPt;
878
879 case Hexagon::TFRI_cPt:
880 return Hexagon::TFRI_cdnPt;
881
882 case Hexagon::TFRI_cNotPt:
883 return Hexagon::TFRI_cdnNotPt;
884
885 // Load double word
886 case Hexagon::LDrid_cPt :
887 return Hexagon::LDrid_cdnPt;
888
889 case Hexagon::LDrid_cNotPt :
890 return Hexagon::LDrid_cdnNotPt;
891
892 case Hexagon::LDrid_indexed_cPt :
893 return Hexagon::LDrid_indexed_cdnPt;
894
895 case Hexagon::LDrid_indexed_cNotPt :
896 return Hexagon::LDrid_indexed_cdnNotPt;
897
898 case Hexagon::POST_LDrid_cPt :
899 return Hexagon::POST_LDrid_cdnPt_V4;
900
901 case Hexagon::POST_LDrid_cNotPt :
902 return Hexagon::POST_LDrid_cdnNotPt_V4;
903
904 // Load word
905 case Hexagon::LDriw_cPt :
906 return Hexagon::LDriw_cdnPt;
907
908 case Hexagon::LDriw_cNotPt :
909 return Hexagon::LDriw_cdnNotPt;
910
911 case Hexagon::LDriw_indexed_cPt :
912 return Hexagon::LDriw_indexed_cdnPt;
913
914 case Hexagon::LDriw_indexed_cNotPt :
915 return Hexagon::LDriw_indexed_cdnNotPt;
916
917 case Hexagon::POST_LDriw_cPt :
918 return Hexagon::POST_LDriw_cdnPt_V4;
919
920 case Hexagon::POST_LDriw_cNotPt :
921 return Hexagon::POST_LDriw_cdnNotPt_V4;
922
923 // Load halfword
924 case Hexagon::LDrih_cPt :
925 return Hexagon::LDrih_cdnPt;
926
927 case Hexagon::LDrih_cNotPt :
928 return Hexagon::LDrih_cdnNotPt;
929
930 case Hexagon::LDrih_indexed_cPt :
931 return Hexagon::LDrih_indexed_cdnPt;
932
933 case Hexagon::LDrih_indexed_cNotPt :
934 return Hexagon::LDrih_indexed_cdnNotPt;
935
936 case Hexagon::POST_LDrih_cPt :
937 return Hexagon::POST_LDrih_cdnPt_V4;
938
939 case Hexagon::POST_LDrih_cNotPt :
940 return Hexagon::POST_LDrih_cdnNotPt_V4;
941
942 // Load byte
943 case Hexagon::LDrib_cPt :
944 return Hexagon::LDrib_cdnPt;
945
946 case Hexagon::LDrib_cNotPt :
947 return Hexagon::LDrib_cdnNotPt;
948
949 case Hexagon::LDrib_indexed_cPt :
950 return Hexagon::LDrib_indexed_cdnPt;
951
952 case Hexagon::LDrib_indexed_cNotPt :
953 return Hexagon::LDrib_indexed_cdnNotPt;
954
955 case Hexagon::POST_LDrib_cPt :
956 return Hexagon::POST_LDrib_cdnPt_V4;
957
958 case Hexagon::POST_LDrib_cNotPt :
959 return Hexagon::POST_LDrib_cdnNotPt_V4;
960
961 // Load unsigned halfword
962 case Hexagon::LDriuh_cPt :
963 return Hexagon::LDriuh_cdnPt;
964
965 case Hexagon::LDriuh_cNotPt :
966 return Hexagon::LDriuh_cdnNotPt;
967
968 case Hexagon::LDriuh_indexed_cPt :
969 return Hexagon::LDriuh_indexed_cdnPt;
970
971 case Hexagon::LDriuh_indexed_cNotPt :
972 return Hexagon::LDriuh_indexed_cdnNotPt;
973
974 case Hexagon::POST_LDriuh_cPt :
975 return Hexagon::POST_LDriuh_cdnPt_V4;
976
977 case Hexagon::POST_LDriuh_cNotPt :
978 return Hexagon::POST_LDriuh_cdnNotPt_V4;
979
980 // Load unsigned byte
981 case Hexagon::LDriub_cPt :
982 return Hexagon::LDriub_cdnPt;
983
984 case Hexagon::LDriub_cNotPt :
985 return Hexagon::LDriub_cdnNotPt;
986
987 case Hexagon::LDriub_indexed_cPt :
988 return Hexagon::LDriub_indexed_cdnPt;
989
990 case Hexagon::LDriub_indexed_cNotPt :
991 return Hexagon::LDriub_indexed_cdnNotPt;
992
993 case Hexagon::POST_LDriub_cPt :
994 return Hexagon::POST_LDriub_cdnPt_V4;
995
996 case Hexagon::POST_LDriub_cNotPt :
997 return Hexagon::POST_LDriub_cdnNotPt_V4;
998
999 // V4 indexed+scaled load
1000
Sirish Pande26f61a12012-05-03 21:52:53 +00001001 case Hexagon::LDrid_indexed_shl_cPt_V4 :
1002 return Hexagon::LDrid_indexed_shl_cdnPt_V4;
1003
1004 case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
1005 return Hexagon::LDrid_indexed_shl_cdnNotPt_V4;
1006
Sirish Pande26f61a12012-05-03 21:52:53 +00001007 case Hexagon::LDrib_indexed_shl_cPt_V4 :
1008 return Hexagon::LDrib_indexed_shl_cdnPt_V4;
1009
1010 case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
1011 return Hexagon::LDrib_indexed_shl_cdnNotPt_V4;
1012
Sirish Pande26f61a12012-05-03 21:52:53 +00001013 case Hexagon::LDriub_indexed_shl_cPt_V4 :
1014 return Hexagon::LDriub_indexed_shl_cdnPt_V4;
1015
1016 case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
1017 return Hexagon::LDriub_indexed_shl_cdnNotPt_V4;
1018
Sirish Pande26f61a12012-05-03 21:52:53 +00001019 case Hexagon::LDrih_indexed_shl_cPt_V4 :
1020 return Hexagon::LDrih_indexed_shl_cdnPt_V4;
1021
1022 case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
1023 return Hexagon::LDrih_indexed_shl_cdnNotPt_V4;
1024
Sirish Pande26f61a12012-05-03 21:52:53 +00001025 case Hexagon::LDriuh_indexed_shl_cPt_V4 :
1026 return Hexagon::LDriuh_indexed_shl_cdnPt_V4;
1027
1028 case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
1029 return Hexagon::LDriuh_indexed_shl_cdnNotPt_V4;
1030
Sirish Pande26f61a12012-05-03 21:52:53 +00001031 case Hexagon::LDriw_indexed_shl_cPt_V4 :
1032 return Hexagon::LDriw_indexed_shl_cdnPt_V4;
1033
1034 case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
1035 return Hexagon::LDriw_indexed_shl_cdnNotPt_V4;
1036
1037 // V4 global address load
1038
1039 case Hexagon::LDd_GP_cPt_V4:
1040 return Hexagon::LDd_GP_cdnPt_V4;
1041
1042 case Hexagon::LDd_GP_cNotPt_V4:
1043 return Hexagon::LDd_GP_cdnNotPt_V4;
1044
1045 case Hexagon::LDb_GP_cPt_V4:
1046 return Hexagon::LDb_GP_cdnPt_V4;
1047
1048 case Hexagon::LDb_GP_cNotPt_V4:
1049 return Hexagon::LDb_GP_cdnNotPt_V4;
1050
1051 case Hexagon::LDub_GP_cPt_V4:
1052 return Hexagon::LDub_GP_cdnPt_V4;
1053
1054 case Hexagon::LDub_GP_cNotPt_V4:
1055 return Hexagon::LDub_GP_cdnNotPt_V4;
1056
1057 case Hexagon::LDh_GP_cPt_V4:
1058 return Hexagon::LDh_GP_cdnPt_V4;
1059
1060 case Hexagon::LDh_GP_cNotPt_V4:
1061 return Hexagon::LDh_GP_cdnNotPt_V4;
1062
1063 case Hexagon::LDuh_GP_cPt_V4:
1064 return Hexagon::LDuh_GP_cdnPt_V4;
1065
1066 case Hexagon::LDuh_GP_cNotPt_V4:
1067 return Hexagon::LDuh_GP_cdnNotPt_V4;
1068
1069 case Hexagon::LDw_GP_cPt_V4:
1070 return Hexagon::LDw_GP_cdnPt_V4;
1071
1072 case Hexagon::LDw_GP_cNotPt_V4:
1073 return Hexagon::LDw_GP_cdnNotPt_V4;
1074
Sirish Pande26f61a12012-05-03 21:52:53 +00001075 // Conditional store new-value byte
1076 case Hexagon::STrib_cPt_nv_V4 :
1077 return Hexagon::STrib_cdnPt_nv_V4;
1078 case Hexagon::STrib_cNotPt_nv_V4 :
1079 return Hexagon::STrib_cdnNotPt_nv_V4;
1080
1081 case Hexagon::STrib_indexed_cPt_nv_V4 :
1082 return Hexagon::STrib_indexed_cdnPt_nv_V4;
1083 case Hexagon::STrib_indexed_cNotPt_nv_V4 :
1084 return Hexagon::STrib_indexed_cdnNotPt_nv_V4;
1085
1086 case Hexagon::STrib_indexed_shl_cPt_nv_V4 :
1087 return Hexagon::STrib_indexed_shl_cdnPt_nv_V4;
1088 case Hexagon::STrib_indexed_shl_cNotPt_nv_V4 :
1089 return Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4;
1090
1091 case Hexagon::POST_STbri_cPt_nv_V4 :
1092 return Hexagon::POST_STbri_cdnPt_nv_V4;
1093 case Hexagon::POST_STbri_cNotPt_nv_V4 :
1094 return Hexagon::POST_STbri_cdnNotPt_nv_V4;
1095
1096 case Hexagon::STb_GP_cPt_nv_V4 :
1097 return Hexagon::STb_GP_cdnPt_nv_V4;
1098
1099 case Hexagon::STb_GP_cNotPt_nv_V4 :
1100 return Hexagon::STb_GP_cdnNotPt_nv_V4;
1101
Sirish Pande26f61a12012-05-03 21:52:53 +00001102 // Conditional store new-value halfword
1103 case Hexagon::STrih_cPt_nv_V4 :
1104 return Hexagon::STrih_cdnPt_nv_V4;
1105 case Hexagon::STrih_cNotPt_nv_V4 :
1106 return Hexagon::STrih_cdnNotPt_nv_V4;
1107
1108 case Hexagon::STrih_indexed_cPt_nv_V4 :
1109 return Hexagon::STrih_indexed_cdnPt_nv_V4;
1110 case Hexagon::STrih_indexed_cNotPt_nv_V4 :
1111 return Hexagon::STrih_indexed_cdnNotPt_nv_V4;
1112
1113 case Hexagon::STrih_indexed_shl_cPt_nv_V4 :
1114 return Hexagon::STrih_indexed_shl_cdnPt_nv_V4;
1115 case Hexagon::STrih_indexed_shl_cNotPt_nv_V4 :
1116 return Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4;
1117
1118 case Hexagon::POST_SThri_cPt_nv_V4 :
1119 return Hexagon::POST_SThri_cdnPt_nv_V4;
1120 case Hexagon::POST_SThri_cNotPt_nv_V4 :
1121 return Hexagon::POST_SThri_cdnNotPt_nv_V4;
1122
1123 case Hexagon::STh_GP_cPt_nv_V4 :
1124 return Hexagon::STh_GP_cdnPt_nv_V4;
1125
1126 case Hexagon::STh_GP_cNotPt_nv_V4 :
1127 return Hexagon::STh_GP_cdnNotPt_nv_V4;
1128
Sirish Pande26f61a12012-05-03 21:52:53 +00001129 // Conditional store new-value word
1130 case Hexagon::STriw_cPt_nv_V4 :
1131 return Hexagon::STriw_cdnPt_nv_V4;
1132 case Hexagon::STriw_cNotPt_nv_V4 :
1133 return Hexagon::STriw_cdnNotPt_nv_V4;
1134
1135 case Hexagon::STriw_indexed_cPt_nv_V4 :
1136 return Hexagon::STriw_indexed_cdnPt_nv_V4;
1137 case Hexagon::STriw_indexed_cNotPt_nv_V4 :
1138 return Hexagon::STriw_indexed_cdnNotPt_nv_V4;
1139
1140 case Hexagon::STriw_indexed_shl_cPt_nv_V4 :
1141 return Hexagon::STriw_indexed_shl_cdnPt_nv_V4;
1142 case Hexagon::STriw_indexed_shl_cNotPt_nv_V4 :
1143 return Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4;
1144
1145 case Hexagon::POST_STwri_cPt_nv_V4 :
1146 return Hexagon::POST_STwri_cdnPt_nv_V4;
1147 case Hexagon::POST_STwri_cNotPt_nv_V4:
1148 return Hexagon::POST_STwri_cdnNotPt_nv_V4;
1149
1150 case Hexagon::STw_GP_cPt_nv_V4 :
1151 return Hexagon::STw_GP_cdnPt_nv_V4;
1152
1153 case Hexagon::STw_GP_cNotPt_nv_V4 :
1154 return Hexagon::STw_GP_cdnNotPt_nv_V4;
1155
Sirish Pande26f61a12012-05-03 21:52:53 +00001156 // Conditional add
1157 case Hexagon::ADD_ri_cPt :
1158 return Hexagon::ADD_ri_cdnPt;
1159 case Hexagon::ADD_ri_cNotPt :
1160 return Hexagon::ADD_ri_cdnNotPt;
1161
1162 case Hexagon::ADD_rr_cPt :
1163 return Hexagon::ADD_rr_cdnPt;
1164 case Hexagon::ADD_rr_cNotPt :
1165 return Hexagon::ADD_rr_cdnNotPt;
1166
1167 // Conditional logical Operations
1168 case Hexagon::XOR_rr_cPt :
1169 return Hexagon::XOR_rr_cdnPt;
1170 case Hexagon::XOR_rr_cNotPt :
1171 return Hexagon::XOR_rr_cdnNotPt;
1172
1173 case Hexagon::AND_rr_cPt :
1174 return Hexagon::AND_rr_cdnPt;
1175 case Hexagon::AND_rr_cNotPt :
1176 return Hexagon::AND_rr_cdnNotPt;
1177
1178 case Hexagon::OR_rr_cPt :
1179 return Hexagon::OR_rr_cdnPt;
1180 case Hexagon::OR_rr_cNotPt :
1181 return Hexagon::OR_rr_cdnNotPt;
1182
1183 // Conditional Subtract
1184 case Hexagon::SUB_rr_cPt :
1185 return Hexagon::SUB_rr_cdnPt;
1186 case Hexagon::SUB_rr_cNotPt :
1187 return Hexagon::SUB_rr_cdnNotPt;
1188
1189 // Conditional combine
1190 case Hexagon::COMBINE_rr_cPt :
1191 return Hexagon::COMBINE_rr_cdnPt;
1192 case Hexagon::COMBINE_rr_cNotPt :
1193 return Hexagon::COMBINE_rr_cdnNotPt;
1194
1195 case Hexagon::ASLH_cPt_V4 :
1196 return Hexagon::ASLH_cdnPt_V4;
1197 case Hexagon::ASLH_cNotPt_V4 :
1198 return Hexagon::ASLH_cdnNotPt_V4;
1199
1200 case Hexagon::ASRH_cPt_V4 :
1201 return Hexagon::ASRH_cdnPt_V4;
1202 case Hexagon::ASRH_cNotPt_V4 :
1203 return Hexagon::ASRH_cdnNotPt_V4;
1204
1205 case Hexagon::SXTB_cPt_V4 :
1206 return Hexagon::SXTB_cdnPt_V4;
1207 case Hexagon::SXTB_cNotPt_V4 :
1208 return Hexagon::SXTB_cdnNotPt_V4;
1209
1210 case Hexagon::SXTH_cPt_V4 :
1211 return Hexagon::SXTH_cdnPt_V4;
1212 case Hexagon::SXTH_cNotPt_V4 :
1213 return Hexagon::SXTH_cdnNotPt_V4;
1214
1215 case Hexagon::ZXTB_cPt_V4 :
1216 return Hexagon::ZXTB_cdnPt_V4;
1217 case Hexagon::ZXTB_cNotPt_V4 :
1218 return Hexagon::ZXTB_cdnNotPt_V4;
1219
1220 case Hexagon::ZXTH_cPt_V4 :
1221 return Hexagon::ZXTH_cdnPt_V4;
1222 case Hexagon::ZXTH_cNotPt_V4 :
1223 return Hexagon::ZXTH_cdnNotPt_V4;
1224 }
1225}
1226
1227// Returns true if an instruction can be promoted to .new predicate
1228// or new-value store.
1229bool HexagonPacketizerList::isNewifiable(MachineInstr* MI) {
1230 if ( isCondInst(MI) || IsNewifyStore(MI))
1231 return true;
1232 else
1233 return false;
1234}
1235
1236bool HexagonPacketizerList::isCondInst (MachineInstr* MI) {
1237 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
1238 const MCInstrDesc& TID = MI->getDesc();
1239 // bug 5670: until that is fixed,
1240 // this portion is disabled.
1241 if ( TID.isConditionalBranch() // && !IsRegisterJump(MI)) ||
1242 || QII->isConditionalTransfer(MI)
1243 || QII->isConditionalALU32(MI)
1244 || QII->isConditionalLoad(MI)
1245 || QII->isConditionalStore(MI)) {
1246 return true;
1247 }
1248 return false;
1249}
1250
Brendon Cahoon5262abb2012-05-14 19:35:42 +00001251
Sirish Pande26f61a12012-05-03 21:52:53 +00001252// Promote an instructiont to its .new form.
1253// At this time, we have already made a call to CanPromoteToDotNew
1254// and made sure that it can *indeed* be promoted.
1255bool HexagonPacketizerList::PromoteToDotNew(MachineInstr* MI,
1256 SDep::Kind DepType, MachineBasicBlock::iterator &MII,
1257 const TargetRegisterClass* RC) {
1258
1259 assert (DepType == SDep::Data);
1260 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
1261
1262 int NewOpcode;
1263 if (RC == &Hexagon::PredRegsRegClass)
1264 NewOpcode = GetDotNewPredOp(MI->getOpcode());
1265 else
1266 NewOpcode = GetDotNewOp(MI->getOpcode());
1267 MI->setDesc(QII->get(NewOpcode));
1268
1269 return true;
1270}
1271
1272// Returns the most basic instruction for the .new predicated instructions and
1273// new-value stores.
1274// For example, all of the following instructions will be converted back to the
1275// same instruction:
1276// 1) if (p0.new) memw(R0+#0) = R1.new --->
1277// 2) if (p0) memw(R0+#0)= R1.new -------> if (p0) memw(R0+#0) = R1
1278// 3) if (p0.new) memw(R0+#0) = R1 --->
1279//
1280// To understand the translation of instruction 1 to its original form, consider
1281// a packet with 3 instructions.
1282// { p0 = cmp.eq(R0,R1)
1283// if (p0.new) R2 = add(R3, R4)
1284// R5 = add (R3, R1)
1285// }
1286// if (p0) memw(R5+#0) = R2 <--- trying to include it in the previous packet
1287//
1288// This instruction can be part of the previous packet only if both p0 and R2
1289// are promoted to .new values. This promotion happens in steps, first
1290// predicate register is promoted to .new and in the next iteration R2 is
1291// promoted. Therefore, in case of dependence check failure (due to R5) during
1292// next iteration, it should be converted back to its most basic form.
1293
1294static int GetDotOldOp(const int opc) {
1295 switch (opc) {
1296 default: llvm_unreachable("Unknown .old type");
1297 case Hexagon::TFR_cdnPt:
1298 return Hexagon::TFR_cPt;
1299
1300 case Hexagon::TFR_cdnNotPt:
1301 return Hexagon::TFR_cNotPt;
1302
1303 case Hexagon::TFRI_cdnPt:
1304 return Hexagon::TFRI_cPt;
1305
1306 case Hexagon::TFRI_cdnNotPt:
1307 return Hexagon::TFRI_cNotPt;
1308
Jyotsna Verma6ea706e2013-05-01 21:37:34 +00001309 case Hexagon::JMP_tnew_t:
1310 return Hexagon::JMP_t;
Sirish Pande26f61a12012-05-03 21:52:53 +00001311
Jyotsna Verma6ea706e2013-05-01 21:37:34 +00001312 case Hexagon::JMP_fnew_t:
1313 return Hexagon::JMP_f;
Sirish Pande26f61a12012-05-03 21:52:53 +00001314
Jyotsna Verma6ea706e2013-05-01 21:37:34 +00001315 case Hexagon::JMPR_tnew_tV3:
1316 return Hexagon::JMPR_t;
Sirish Pande26f61a12012-05-03 21:52:53 +00001317
Jyotsna Verma6ea706e2013-05-01 21:37:34 +00001318 case Hexagon::JMPR_fnew_tV3:
1319 return Hexagon::JMPR_f;
Sirish Pande26f61a12012-05-03 21:52:53 +00001320
1321 // Load double word
1322
1323 case Hexagon::LDrid_cdnPt :
1324 return Hexagon::LDrid_cPt;
1325
1326 case Hexagon::LDrid_cdnNotPt :
1327 return Hexagon::LDrid_cNotPt;
1328
1329 case Hexagon::LDrid_indexed_cdnPt :
1330 return Hexagon::LDrid_indexed_cPt;
1331
1332 case Hexagon::LDrid_indexed_cdnNotPt :
1333 return Hexagon::LDrid_indexed_cNotPt;
1334
1335 case Hexagon::POST_LDrid_cdnPt_V4 :
1336 return Hexagon::POST_LDrid_cPt;
1337
1338 case Hexagon::POST_LDrid_cdnNotPt_V4 :
1339 return Hexagon::POST_LDrid_cNotPt;
1340
1341 // Load word
1342
1343 case Hexagon::LDriw_cdnPt :
1344 return Hexagon::LDriw_cPt;
1345
1346 case Hexagon::LDriw_cdnNotPt :
1347 return Hexagon::LDriw_cNotPt;
1348
1349 case Hexagon::LDriw_indexed_cdnPt :
1350 return Hexagon::LDriw_indexed_cPt;
1351
1352 case Hexagon::LDriw_indexed_cdnNotPt :
1353 return Hexagon::LDriw_indexed_cNotPt;
1354
1355 case Hexagon::POST_LDriw_cdnPt_V4 :
1356 return Hexagon::POST_LDriw_cPt;
1357
1358 case Hexagon::POST_LDriw_cdnNotPt_V4 :
1359 return Hexagon::POST_LDriw_cNotPt;
1360
1361 // Load half
1362
1363 case Hexagon::LDrih_cdnPt :
1364 return Hexagon::LDrih_cPt;
1365
1366 case Hexagon::LDrih_cdnNotPt :
1367 return Hexagon::LDrih_cNotPt;
1368
1369 case Hexagon::LDrih_indexed_cdnPt :
1370 return Hexagon::LDrih_indexed_cPt;
1371
1372 case Hexagon::LDrih_indexed_cdnNotPt :
1373 return Hexagon::LDrih_indexed_cNotPt;
1374
1375 case Hexagon::POST_LDrih_cdnPt_V4 :
1376 return Hexagon::POST_LDrih_cPt;
1377
1378 case Hexagon::POST_LDrih_cdnNotPt_V4 :
1379 return Hexagon::POST_LDrih_cNotPt;
1380
1381 // Load byte
1382
1383 case Hexagon::LDrib_cdnPt :
1384 return Hexagon::LDrib_cPt;
1385
1386 case Hexagon::LDrib_cdnNotPt :
1387 return Hexagon::LDrib_cNotPt;
1388
1389 case Hexagon::LDrib_indexed_cdnPt :
1390 return Hexagon::LDrib_indexed_cPt;
1391
1392 case Hexagon::LDrib_indexed_cdnNotPt :
1393 return Hexagon::LDrib_indexed_cNotPt;
1394
1395 case Hexagon::POST_LDrib_cdnPt_V4 :
1396 return Hexagon::POST_LDrib_cPt;
1397
1398 case Hexagon::POST_LDrib_cdnNotPt_V4 :
1399 return Hexagon::POST_LDrib_cNotPt;
1400
1401 // Load unsigned half
1402
1403 case Hexagon::LDriuh_cdnPt :
1404 return Hexagon::LDriuh_cPt;
1405
1406 case Hexagon::LDriuh_cdnNotPt :
1407 return Hexagon::LDriuh_cNotPt;
1408
1409 case Hexagon::LDriuh_indexed_cdnPt :
1410 return Hexagon::LDriuh_indexed_cPt;
1411
1412 case Hexagon::LDriuh_indexed_cdnNotPt :
1413 return Hexagon::LDriuh_indexed_cNotPt;
1414
1415 case Hexagon::POST_LDriuh_cdnPt_V4 :
1416 return Hexagon::POST_LDriuh_cPt;
1417
1418 case Hexagon::POST_LDriuh_cdnNotPt_V4 :
1419 return Hexagon::POST_LDriuh_cNotPt;
1420
1421 // Load unsigned byte
1422 case Hexagon::LDriub_cdnPt :
1423 return Hexagon::LDriub_cPt;
1424
1425 case Hexagon::LDriub_cdnNotPt :
1426 return Hexagon::LDriub_cNotPt;
1427
1428 case Hexagon::LDriub_indexed_cdnPt :
1429 return Hexagon::LDriub_indexed_cPt;
1430
1431 case Hexagon::LDriub_indexed_cdnNotPt :
1432 return Hexagon::LDriub_indexed_cNotPt;
1433
1434 case Hexagon::POST_LDriub_cdnPt_V4 :
1435 return Hexagon::POST_LDriub_cPt;
1436
1437 case Hexagon::POST_LDriub_cdnNotPt_V4 :
1438 return Hexagon::POST_LDriub_cNotPt;
1439
1440 // V4 indexed+scaled Load
1441
Sirish Pande26f61a12012-05-03 21:52:53 +00001442 case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
1443 return Hexagon::LDrid_indexed_shl_cPt_V4;
1444
1445 case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
1446 return Hexagon::LDrid_indexed_shl_cNotPt_V4;
1447
Sirish Pande26f61a12012-05-03 21:52:53 +00001448 case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
1449 return Hexagon::LDrib_indexed_shl_cPt_V4;
1450
1451 case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
1452 return Hexagon::LDrib_indexed_shl_cNotPt_V4;
1453
Sirish Pande26f61a12012-05-03 21:52:53 +00001454 case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
1455 return Hexagon::LDriub_indexed_shl_cPt_V4;
1456
1457 case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
1458 return Hexagon::LDriub_indexed_shl_cNotPt_V4;
1459
Sirish Pande26f61a12012-05-03 21:52:53 +00001460 case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
1461 return Hexagon::LDrih_indexed_shl_cPt_V4;
1462
1463 case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
1464 return Hexagon::LDrih_indexed_shl_cNotPt_V4;
1465
Sirish Pande26f61a12012-05-03 21:52:53 +00001466 case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
1467 return Hexagon::LDriuh_indexed_shl_cPt_V4;
1468
1469 case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
1470 return Hexagon::LDriuh_indexed_shl_cNotPt_V4;
1471
Sirish Pande26f61a12012-05-03 21:52:53 +00001472 case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
1473 return Hexagon::LDriw_indexed_shl_cPt_V4;
1474
1475 case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
1476 return Hexagon::LDriw_indexed_shl_cNotPt_V4;
1477
1478 // V4 global address load
1479
1480 case Hexagon::LDd_GP_cdnPt_V4:
1481 return Hexagon::LDd_GP_cPt_V4;
1482
1483 case Hexagon::LDd_GP_cdnNotPt_V4:
1484 return Hexagon::LDd_GP_cNotPt_V4;
1485
1486 case Hexagon::LDb_GP_cdnPt_V4:
1487 return Hexagon::LDb_GP_cPt_V4;
1488
1489 case Hexagon::LDb_GP_cdnNotPt_V4:
1490 return Hexagon::LDb_GP_cNotPt_V4;
1491
1492 case Hexagon::LDub_GP_cdnPt_V4:
1493 return Hexagon::LDub_GP_cPt_V4;
1494
1495 case Hexagon::LDub_GP_cdnNotPt_V4:
1496 return Hexagon::LDub_GP_cNotPt_V4;
1497
1498 case Hexagon::LDh_GP_cdnPt_V4:
1499 return Hexagon::LDh_GP_cPt_V4;
1500
1501 case Hexagon::LDh_GP_cdnNotPt_V4:
1502 return Hexagon::LDh_GP_cNotPt_V4;
1503
1504 case Hexagon::LDuh_GP_cdnPt_V4:
1505 return Hexagon::LDuh_GP_cPt_V4;
1506
1507 case Hexagon::LDuh_GP_cdnNotPt_V4:
1508 return Hexagon::LDuh_GP_cNotPt_V4;
1509
1510 case Hexagon::LDw_GP_cdnPt_V4:
1511 return Hexagon::LDw_GP_cPt_V4;
1512
1513 case Hexagon::LDw_GP_cdnNotPt_V4:
1514 return Hexagon::LDw_GP_cNotPt_V4;
1515
Sirish Pande26f61a12012-05-03 21:52:53 +00001516 // Conditional add
1517
1518 case Hexagon::ADD_ri_cdnPt :
1519 return Hexagon::ADD_ri_cPt;
1520 case Hexagon::ADD_ri_cdnNotPt :
1521 return Hexagon::ADD_ri_cNotPt;
1522
1523 case Hexagon::ADD_rr_cdnPt :
1524 return Hexagon::ADD_rr_cPt;
1525 case Hexagon::ADD_rr_cdnNotPt:
1526 return Hexagon::ADD_rr_cNotPt;
1527
1528 // Conditional logical Operations
1529
1530 case Hexagon::XOR_rr_cdnPt :
1531 return Hexagon::XOR_rr_cPt;
1532 case Hexagon::XOR_rr_cdnNotPt :
1533 return Hexagon::XOR_rr_cNotPt;
1534
1535 case Hexagon::AND_rr_cdnPt :
1536 return Hexagon::AND_rr_cPt;
1537 case Hexagon::AND_rr_cdnNotPt :
1538 return Hexagon::AND_rr_cNotPt;
1539
1540 case Hexagon::OR_rr_cdnPt :
1541 return Hexagon::OR_rr_cPt;
1542 case Hexagon::OR_rr_cdnNotPt :
1543 return Hexagon::OR_rr_cNotPt;
1544
1545 // Conditional Subtract
1546
1547 case Hexagon::SUB_rr_cdnPt :
1548 return Hexagon::SUB_rr_cPt;
1549 case Hexagon::SUB_rr_cdnNotPt :
1550 return Hexagon::SUB_rr_cNotPt;
1551
1552 // Conditional combine
1553
1554 case Hexagon::COMBINE_rr_cdnPt :
1555 return Hexagon::COMBINE_rr_cPt;
1556 case Hexagon::COMBINE_rr_cdnNotPt :
1557 return Hexagon::COMBINE_rr_cNotPt;
1558
1559// Conditional shift operations
1560
1561 case Hexagon::ASLH_cdnPt_V4 :
1562 return Hexagon::ASLH_cPt_V4;
1563 case Hexagon::ASLH_cdnNotPt_V4 :
1564 return Hexagon::ASLH_cNotPt_V4;
1565
1566 case Hexagon::ASRH_cdnPt_V4 :
1567 return Hexagon::ASRH_cPt_V4;
1568 case Hexagon::ASRH_cdnNotPt_V4 :
1569 return Hexagon::ASRH_cNotPt_V4;
1570
1571 case Hexagon::SXTB_cdnPt_V4 :
1572 return Hexagon::SXTB_cPt_V4;
1573 case Hexagon::SXTB_cdnNotPt_V4 :
1574 return Hexagon::SXTB_cNotPt_V4;
1575
1576 case Hexagon::SXTH_cdnPt_V4 :
1577 return Hexagon::SXTH_cPt_V4;
1578 case Hexagon::SXTH_cdnNotPt_V4 :
1579 return Hexagon::SXTH_cNotPt_V4;
1580
1581 case Hexagon::ZXTB_cdnPt_V4 :
1582 return Hexagon::ZXTB_cPt_V4;
1583 case Hexagon::ZXTB_cdnNotPt_V4 :
1584 return Hexagon::ZXTB_cNotPt_V4;
1585
1586 case Hexagon::ZXTH_cdnPt_V4 :
1587 return Hexagon::ZXTH_cPt_V4;
1588 case Hexagon::ZXTH_cdnNotPt_V4 :
1589 return Hexagon::ZXTH_cNotPt_V4;
1590
1591 // Store byte
1592
1593 case Hexagon::STrib_imm_cdnPt_V4 :
1594 return Hexagon::STrib_imm_cPt_V4;
1595
1596 case Hexagon::STrib_imm_cdnNotPt_V4 :
1597 return Hexagon::STrib_imm_cNotPt_V4;
1598
1599 case Hexagon::STrib_cdnPt_nv_V4 :
1600 case Hexagon::STrib_cPt_nv_V4 :
1601 case Hexagon::STrib_cdnPt_V4 :
1602 return Hexagon::STrib_cPt;
1603
1604 case Hexagon::STrib_cdnNotPt_nv_V4 :
1605 case Hexagon::STrib_cNotPt_nv_V4 :
1606 case Hexagon::STrib_cdnNotPt_V4 :
1607 return Hexagon::STrib_cNotPt;
1608
1609 case Hexagon::STrib_indexed_cdnPt_V4 :
1610 case Hexagon::STrib_indexed_cPt_nv_V4 :
1611 case Hexagon::STrib_indexed_cdnPt_nv_V4 :
1612 return Hexagon::STrib_indexed_cPt;
1613
1614 case Hexagon::STrib_indexed_cdnNotPt_V4 :
1615 case Hexagon::STrib_indexed_cNotPt_nv_V4 :
1616 case Hexagon::STrib_indexed_cdnNotPt_nv_V4 :
1617 return Hexagon::STrib_indexed_cNotPt;
1618
1619 case Hexagon::STrib_indexed_shl_cdnPt_nv_V4:
1620 case Hexagon::STrib_indexed_shl_cPt_nv_V4 :
1621 case Hexagon::STrib_indexed_shl_cdnPt_V4 :
1622 return Hexagon::STrib_indexed_shl_cPt_V4;
1623
1624 case Hexagon::STrib_indexed_shl_cdnNotPt_nv_V4:
1625 case Hexagon::STrib_indexed_shl_cNotPt_nv_V4 :
1626 case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
1627 return Hexagon::STrib_indexed_shl_cNotPt_V4;
1628
1629 case Hexagon::POST_STbri_cdnPt_nv_V4 :
1630 case Hexagon::POST_STbri_cPt_nv_V4 :
1631 case Hexagon::POST_STbri_cdnPt_V4 :
1632 return Hexagon::POST_STbri_cPt;
1633
1634 case Hexagon::POST_STbri_cdnNotPt_nv_V4 :
1635 case Hexagon::POST_STbri_cNotPt_nv_V4:
1636 case Hexagon::POST_STbri_cdnNotPt_V4 :
1637 return Hexagon::POST_STbri_cNotPt;
1638
1639 case Hexagon::STb_GP_cdnPt_nv_V4:
1640 case Hexagon::STb_GP_cdnPt_V4:
1641 case Hexagon::STb_GP_cPt_nv_V4:
1642 return Hexagon::STb_GP_cPt_V4;
1643
1644 case Hexagon::STb_GP_cdnNotPt_nv_V4:
1645 case Hexagon::STb_GP_cdnNotPt_V4:
1646 case Hexagon::STb_GP_cNotPt_nv_V4:
1647 return Hexagon::STb_GP_cNotPt_V4;
1648
Sirish Pande26f61a12012-05-03 21:52:53 +00001649 // Store new-value byte - unconditional
1650 case Hexagon::STrib_nv_V4:
1651 return Hexagon::STrib;
1652
1653 case Hexagon::STrib_indexed_nv_V4:
1654 return Hexagon::STrib_indexed;
1655
1656 case Hexagon::STrib_indexed_shl_nv_V4:
1657 return Hexagon::STrib_indexed_shl_V4;
1658
1659 case Hexagon::STrib_shl_nv_V4:
1660 return Hexagon::STrib_shl_V4;
1661
Sirish Pande26f61a12012-05-03 21:52:53 +00001662 case Hexagon::STb_GP_nv_V4:
1663 return Hexagon::STb_GP_V4;
1664
1665 case Hexagon::POST_STbri_nv_V4:
1666 return Hexagon::POST_STbri;
1667
1668 // Store halfword
1669 case Hexagon::STrih_imm_cdnPt_V4 :
1670 return Hexagon::STrih_imm_cPt_V4;
1671
1672 case Hexagon::STrih_imm_cdnNotPt_V4 :
1673 return Hexagon::STrih_imm_cNotPt_V4;
1674
1675 case Hexagon::STrih_cdnPt_nv_V4 :
1676 case Hexagon::STrih_cPt_nv_V4 :
1677 case Hexagon::STrih_cdnPt_V4 :
1678 return Hexagon::STrih_cPt;
1679
1680 case Hexagon::STrih_cdnNotPt_nv_V4 :
1681 case Hexagon::STrih_cNotPt_nv_V4 :
1682 case Hexagon::STrih_cdnNotPt_V4 :
1683 return Hexagon::STrih_cNotPt;
1684
1685 case Hexagon::STrih_indexed_cdnPt_nv_V4:
1686 case Hexagon::STrih_indexed_cPt_nv_V4 :
1687 case Hexagon::STrih_indexed_cdnPt_V4 :
1688 return Hexagon::STrih_indexed_cPt;
1689
1690 case Hexagon::STrih_indexed_cdnNotPt_nv_V4:
1691 case Hexagon::STrih_indexed_cNotPt_nv_V4 :
1692 case Hexagon::STrih_indexed_cdnNotPt_V4 :
1693 return Hexagon::STrih_indexed_cNotPt;
1694
1695 case Hexagon::STrih_indexed_shl_cdnPt_nv_V4 :
1696 case Hexagon::STrih_indexed_shl_cPt_nv_V4 :
1697 case Hexagon::STrih_indexed_shl_cdnPt_V4 :
1698 return Hexagon::STrih_indexed_shl_cPt_V4;
1699
1700 case Hexagon::STrih_indexed_shl_cdnNotPt_nv_V4 :
1701 case Hexagon::STrih_indexed_shl_cNotPt_nv_V4 :
1702 case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
1703 return Hexagon::STrih_indexed_shl_cNotPt_V4;
1704
1705 case Hexagon::POST_SThri_cdnPt_nv_V4 :
1706 case Hexagon::POST_SThri_cPt_nv_V4 :
1707 case Hexagon::POST_SThri_cdnPt_V4 :
1708 return Hexagon::POST_SThri_cPt;
1709
1710 case Hexagon::POST_SThri_cdnNotPt_nv_V4 :
1711 case Hexagon::POST_SThri_cNotPt_nv_V4 :
1712 case Hexagon::POST_SThri_cdnNotPt_V4 :
1713 return Hexagon::POST_SThri_cNotPt;
1714
1715 case Hexagon::STh_GP_cdnPt_nv_V4:
1716 case Hexagon::STh_GP_cdnPt_V4:
1717 case Hexagon::STh_GP_cPt_nv_V4:
1718 return Hexagon::STh_GP_cPt_V4;
1719
1720 case Hexagon::STh_GP_cdnNotPt_nv_V4:
1721 case Hexagon::STh_GP_cdnNotPt_V4:
1722 case Hexagon::STh_GP_cNotPt_nv_V4:
1723 return Hexagon::STh_GP_cNotPt_V4;
1724
Sirish Pande26f61a12012-05-03 21:52:53 +00001725 // Store new-value halfword - unconditional
1726
1727 case Hexagon::STrih_nv_V4:
1728 return Hexagon::STrih;
1729
1730 case Hexagon::STrih_indexed_nv_V4:
1731 return Hexagon::STrih_indexed;
1732
1733 case Hexagon::STrih_indexed_shl_nv_V4:
1734 return Hexagon::STrih_indexed_shl_V4;
1735
1736 case Hexagon::STrih_shl_nv_V4:
1737 return Hexagon::STrih_shl_V4;
1738
Sirish Pande26f61a12012-05-03 21:52:53 +00001739 case Hexagon::STh_GP_nv_V4:
1740 return Hexagon::STh_GP_V4;
1741
1742 case Hexagon::POST_SThri_nv_V4:
1743 return Hexagon::POST_SThri;
1744
1745 // Store word
1746
1747 case Hexagon::STriw_imm_cdnPt_V4 :
1748 return Hexagon::STriw_imm_cPt_V4;
1749
1750 case Hexagon::STriw_imm_cdnNotPt_V4 :
1751 return Hexagon::STriw_imm_cNotPt_V4;
1752
1753 case Hexagon::STriw_cdnPt_nv_V4 :
1754 case Hexagon::STriw_cPt_nv_V4 :
1755 case Hexagon::STriw_cdnPt_V4 :
1756 return Hexagon::STriw_cPt;
1757
1758 case Hexagon::STriw_cdnNotPt_nv_V4 :
1759 case Hexagon::STriw_cNotPt_nv_V4 :
1760 case Hexagon::STriw_cdnNotPt_V4 :
1761 return Hexagon::STriw_cNotPt;
1762
1763 case Hexagon::STriw_indexed_cdnPt_nv_V4 :
1764 case Hexagon::STriw_indexed_cPt_nv_V4 :
1765 case Hexagon::STriw_indexed_cdnPt_V4 :
1766 return Hexagon::STriw_indexed_cPt;
1767
1768 case Hexagon::STriw_indexed_cdnNotPt_nv_V4 :
1769 case Hexagon::STriw_indexed_cNotPt_nv_V4 :
1770 case Hexagon::STriw_indexed_cdnNotPt_V4 :
1771 return Hexagon::STriw_indexed_cNotPt;
1772
1773 case Hexagon::STriw_indexed_shl_cdnPt_nv_V4 :
1774 case Hexagon::STriw_indexed_shl_cPt_nv_V4 :
1775 case Hexagon::STriw_indexed_shl_cdnPt_V4 :
1776 return Hexagon::STriw_indexed_shl_cPt_V4;
1777
1778 case Hexagon::STriw_indexed_shl_cdnNotPt_nv_V4 :
1779 case Hexagon::STriw_indexed_shl_cNotPt_nv_V4 :
1780 case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
1781 return Hexagon::STriw_indexed_shl_cNotPt_V4;
1782
1783 case Hexagon::POST_STwri_cdnPt_nv_V4 :
1784 case Hexagon::POST_STwri_cPt_nv_V4 :
1785 case Hexagon::POST_STwri_cdnPt_V4 :
1786 return Hexagon::POST_STwri_cPt;
1787
1788 case Hexagon::POST_STwri_cdnNotPt_nv_V4 :
1789 case Hexagon::POST_STwri_cNotPt_nv_V4 :
1790 case Hexagon::POST_STwri_cdnNotPt_V4 :
1791 return Hexagon::POST_STwri_cNotPt;
1792
1793 case Hexagon::STw_GP_cdnPt_nv_V4:
1794 case Hexagon::STw_GP_cdnPt_V4:
1795 case Hexagon::STw_GP_cPt_nv_V4:
1796 return Hexagon::STw_GP_cPt_V4;
1797
1798 case Hexagon::STw_GP_cdnNotPt_nv_V4:
1799 case Hexagon::STw_GP_cdnNotPt_V4:
1800 case Hexagon::STw_GP_cNotPt_nv_V4:
1801 return Hexagon::STw_GP_cNotPt_V4;
1802
Sirish Pande26f61a12012-05-03 21:52:53 +00001803 // Store new-value word - unconditional
1804
1805 case Hexagon::STriw_nv_V4:
1806 return Hexagon::STriw;
1807
1808 case Hexagon::STriw_indexed_nv_V4:
1809 return Hexagon::STriw_indexed;
1810
1811 case Hexagon::STriw_indexed_shl_nv_V4:
1812 return Hexagon::STriw_indexed_shl_V4;
1813
1814 case Hexagon::STriw_shl_nv_V4:
1815 return Hexagon::STriw_shl_V4;
1816
Sirish Pande26f61a12012-05-03 21:52:53 +00001817 case Hexagon::STw_GP_nv_V4:
1818 return Hexagon::STw_GP_V4;
1819
1820 case Hexagon::POST_STwri_nv_V4:
1821 return Hexagon::POST_STwri;
1822
1823 // Store doubleword
1824
1825 case Hexagon::STrid_cdnPt_V4 :
1826 return Hexagon::STrid_cPt;
1827
1828 case Hexagon::STrid_cdnNotPt_V4 :
1829 return Hexagon::STrid_cNotPt;
1830
1831 case Hexagon::STrid_indexed_cdnPt_V4 :
1832 return Hexagon::STrid_indexed_cPt;
1833
1834 case Hexagon::STrid_indexed_cdnNotPt_V4 :
1835 return Hexagon::STrid_indexed_cNotPt;
1836
1837 case Hexagon::STrid_indexed_shl_cdnPt_V4 :
1838 return Hexagon::STrid_indexed_shl_cPt_V4;
1839
1840 case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
1841 return Hexagon::STrid_indexed_shl_cNotPt_V4;
1842
1843 case Hexagon::POST_STdri_cdnPt_V4 :
1844 return Hexagon::POST_STdri_cPt;
1845
1846 case Hexagon::POST_STdri_cdnNotPt_V4 :
1847 return Hexagon::POST_STdri_cNotPt;
1848
1849 case Hexagon::STd_GP_cdnPt_V4 :
1850 return Hexagon::STd_GP_cPt_V4;
1851
1852 case Hexagon::STd_GP_cdnNotPt_V4 :
1853 return Hexagon::STd_GP_cNotPt_V4;
1854
Sirish Pande26f61a12012-05-03 21:52:53 +00001855 }
1856}
1857
1858bool HexagonPacketizerList::DemoteToDotOld(MachineInstr* MI) {
1859 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
1860 int NewOpcode = GetDotOldOp(MI->getOpcode());
1861 MI->setDesc(QII->get(NewOpcode));
1862 return true;
1863}
1864
1865// Returns true if an instruction is predicated on p0 and false if it's
1866// predicated on !p0.
1867
1868static bool GetPredicateSense(MachineInstr* MI,
1869 const HexagonInstrInfo *QII) {
1870
1871 switch (MI->getOpcode()) {
1872 default: llvm_unreachable("Unknown predicate sense of the instruction");
1873 case Hexagon::TFR_cPt:
1874 case Hexagon::TFR_cdnPt:
1875 case Hexagon::TFRI_cPt:
1876 case Hexagon::TFRI_cdnPt:
1877 case Hexagon::STrib_cPt :
1878 case Hexagon::STrib_cdnPt_V4 :
1879 case Hexagon::STrib_indexed_cPt :
1880 case Hexagon::STrib_indexed_cdnPt_V4 :
1881 case Hexagon::STrib_indexed_shl_cPt_V4 :
1882 case Hexagon::STrib_indexed_shl_cdnPt_V4 :
1883 case Hexagon::POST_STbri_cPt :
1884 case Hexagon::POST_STbri_cdnPt_V4 :
1885 case Hexagon::STrih_cPt :
1886 case Hexagon::STrih_cdnPt_V4 :
1887 case Hexagon::STrih_indexed_cPt :
1888 case Hexagon::STrih_indexed_cdnPt_V4 :
1889 case Hexagon::STrih_indexed_shl_cPt_V4 :
1890 case Hexagon::STrih_indexed_shl_cdnPt_V4 :
1891 case Hexagon::POST_SThri_cPt :
1892 case Hexagon::POST_SThri_cdnPt_V4 :
1893 case Hexagon::STriw_cPt :
1894 case Hexagon::STriw_cdnPt_V4 :
1895 case Hexagon::STriw_indexed_cPt :
1896 case Hexagon::STriw_indexed_cdnPt_V4 :
1897 case Hexagon::STriw_indexed_shl_cPt_V4 :
1898 case Hexagon::STriw_indexed_shl_cdnPt_V4 :
1899 case Hexagon::POST_STwri_cPt :
1900 case Hexagon::POST_STwri_cdnPt_V4 :
1901 case Hexagon::STrib_imm_cPt_V4 :
1902 case Hexagon::STrib_imm_cdnPt_V4 :
1903 case Hexagon::STrid_cPt :
1904 case Hexagon::STrid_cdnPt_V4 :
1905 case Hexagon::STrid_indexed_cPt :
1906 case Hexagon::STrid_indexed_cdnPt_V4 :
1907 case Hexagon::STrid_indexed_shl_cPt_V4 :
1908 case Hexagon::STrid_indexed_shl_cdnPt_V4 :
1909 case Hexagon::POST_STdri_cPt :
1910 case Hexagon::POST_STdri_cdnPt_V4 :
1911 case Hexagon::STrih_imm_cPt_V4 :
1912 case Hexagon::STrih_imm_cdnPt_V4 :
1913 case Hexagon::STriw_imm_cPt_V4 :
1914 case Hexagon::STriw_imm_cdnPt_V4 :
Jyotsna Verma6ea706e2013-05-01 21:37:34 +00001915 case Hexagon::JMP_tnew_t :
Sirish Pande26f61a12012-05-03 21:52:53 +00001916 case Hexagon::LDrid_cPt :
1917 case Hexagon::LDrid_cdnPt :
1918 case Hexagon::LDrid_indexed_cPt :
1919 case Hexagon::LDrid_indexed_cdnPt :
1920 case Hexagon::POST_LDrid_cPt :
1921 case Hexagon::POST_LDrid_cdnPt_V4 :
1922 case Hexagon::LDriw_cPt :
1923 case Hexagon::LDriw_cdnPt :
1924 case Hexagon::LDriw_indexed_cPt :
1925 case Hexagon::LDriw_indexed_cdnPt :
1926 case Hexagon::POST_LDriw_cPt :
1927 case Hexagon::POST_LDriw_cdnPt_V4 :
1928 case Hexagon::LDrih_cPt :
1929 case Hexagon::LDrih_cdnPt :
1930 case Hexagon::LDrih_indexed_cPt :
1931 case Hexagon::LDrih_indexed_cdnPt :
1932 case Hexagon::POST_LDrih_cPt :
1933 case Hexagon::POST_LDrih_cdnPt_V4 :
1934 case Hexagon::LDrib_cPt :
1935 case Hexagon::LDrib_cdnPt :
1936 case Hexagon::LDrib_indexed_cPt :
1937 case Hexagon::LDrib_indexed_cdnPt :
1938 case Hexagon::POST_LDrib_cPt :
1939 case Hexagon::POST_LDrib_cdnPt_V4 :
1940 case Hexagon::LDriuh_cPt :
1941 case Hexagon::LDriuh_cdnPt :
1942 case Hexagon::LDriuh_indexed_cPt :
1943 case Hexagon::LDriuh_indexed_cdnPt :
1944 case Hexagon::POST_LDriuh_cPt :
1945 case Hexagon::POST_LDriuh_cdnPt_V4 :
1946 case Hexagon::LDriub_cPt :
1947 case Hexagon::LDriub_cdnPt :
1948 case Hexagon::LDriub_indexed_cPt :
1949 case Hexagon::LDriub_indexed_cdnPt :
1950 case Hexagon::POST_LDriub_cPt :
1951 case Hexagon::POST_LDriub_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001952 case Hexagon::LDrid_indexed_shl_cPt_V4 :
1953 case Hexagon::LDrid_indexed_shl_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001954 case Hexagon::LDrib_indexed_shl_cPt_V4 :
1955 case Hexagon::LDrib_indexed_shl_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001956 case Hexagon::LDriub_indexed_shl_cPt_V4 :
1957 case Hexagon::LDriub_indexed_shl_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001958 case Hexagon::LDrih_indexed_shl_cPt_V4 :
1959 case Hexagon::LDrih_indexed_shl_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001960 case Hexagon::LDriuh_indexed_shl_cPt_V4 :
1961 case Hexagon::LDriuh_indexed_shl_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001962 case Hexagon::LDriw_indexed_shl_cPt_V4 :
1963 case Hexagon::LDriw_indexed_shl_cdnPt_V4 :
1964 case Hexagon::ADD_ri_cPt :
1965 case Hexagon::ADD_ri_cdnPt :
1966 case Hexagon::ADD_rr_cPt :
1967 case Hexagon::ADD_rr_cdnPt :
1968 case Hexagon::XOR_rr_cPt :
1969 case Hexagon::XOR_rr_cdnPt :
1970 case Hexagon::AND_rr_cPt :
1971 case Hexagon::AND_rr_cdnPt :
1972 case Hexagon::OR_rr_cPt :
1973 case Hexagon::OR_rr_cdnPt :
1974 case Hexagon::SUB_rr_cPt :
1975 case Hexagon::SUB_rr_cdnPt :
1976 case Hexagon::COMBINE_rr_cPt :
1977 case Hexagon::COMBINE_rr_cdnPt :
1978 case Hexagon::ASLH_cPt_V4 :
1979 case Hexagon::ASLH_cdnPt_V4 :
1980 case Hexagon::ASRH_cPt_V4 :
1981 case Hexagon::ASRH_cdnPt_V4 :
1982 case Hexagon::SXTB_cPt_V4 :
1983 case Hexagon::SXTB_cdnPt_V4 :
1984 case Hexagon::SXTH_cPt_V4 :
1985 case Hexagon::SXTH_cdnPt_V4 :
1986 case Hexagon::ZXTB_cPt_V4 :
1987 case Hexagon::ZXTB_cdnPt_V4 :
1988 case Hexagon::ZXTH_cPt_V4 :
1989 case Hexagon::ZXTH_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001990 case Hexagon::LDd_GP_cPt_V4 :
1991 case Hexagon::LDb_GP_cPt_V4 :
1992 case Hexagon::LDub_GP_cPt_V4 :
1993 case Hexagon::LDh_GP_cPt_V4 :
1994 case Hexagon::LDuh_GP_cPt_V4 :
1995 case Hexagon::LDw_GP_cPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00001996 case Hexagon::STd_GP_cPt_V4 :
1997 case Hexagon::STb_GP_cPt_V4 :
1998 case Hexagon::STh_GP_cPt_V4 :
1999 case Hexagon::STw_GP_cPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002000 case Hexagon::LDd_GP_cdnPt_V4 :
2001 case Hexagon::LDb_GP_cdnPt_V4 :
2002 case Hexagon::LDub_GP_cdnPt_V4 :
2003 case Hexagon::LDh_GP_cdnPt_V4 :
2004 case Hexagon::LDuh_GP_cdnPt_V4 :
2005 case Hexagon::LDw_GP_cdnPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002006 case Hexagon::STd_GP_cdnPt_V4 :
2007 case Hexagon::STb_GP_cdnPt_V4 :
2008 case Hexagon::STh_GP_cdnPt_V4 :
2009 case Hexagon::STw_GP_cdnPt_V4 :
2010 return true;
2011
2012 case Hexagon::TFR_cNotPt:
2013 case Hexagon::TFR_cdnNotPt:
2014 case Hexagon::TFRI_cNotPt:
2015 case Hexagon::TFRI_cdnNotPt:
2016 case Hexagon::STrib_cNotPt :
2017 case Hexagon::STrib_cdnNotPt_V4 :
2018 case Hexagon::STrib_indexed_cNotPt :
2019 case Hexagon::STrib_indexed_cdnNotPt_V4 :
2020 case Hexagon::STrib_indexed_shl_cNotPt_V4 :
2021 case Hexagon::STrib_indexed_shl_cdnNotPt_V4 :
2022 case Hexagon::POST_STbri_cNotPt :
2023 case Hexagon::POST_STbri_cdnNotPt_V4 :
2024 case Hexagon::STrih_cNotPt :
2025 case Hexagon::STrih_cdnNotPt_V4 :
2026 case Hexagon::STrih_indexed_cNotPt :
2027 case Hexagon::STrih_indexed_cdnNotPt_V4 :
2028 case Hexagon::STrih_indexed_shl_cNotPt_V4 :
2029 case Hexagon::STrih_indexed_shl_cdnNotPt_V4 :
2030 case Hexagon::POST_SThri_cNotPt :
2031 case Hexagon::POST_SThri_cdnNotPt_V4 :
2032 case Hexagon::STriw_cNotPt :
2033 case Hexagon::STriw_cdnNotPt_V4 :
2034 case Hexagon::STriw_indexed_cNotPt :
2035 case Hexagon::STriw_indexed_cdnNotPt_V4 :
2036 case Hexagon::STriw_indexed_shl_cNotPt_V4 :
2037 case Hexagon::STriw_indexed_shl_cdnNotPt_V4 :
2038 case Hexagon::POST_STwri_cNotPt :
2039 case Hexagon::POST_STwri_cdnNotPt_V4 :
2040 case Hexagon::STrib_imm_cNotPt_V4 :
2041 case Hexagon::STrib_imm_cdnNotPt_V4 :
2042 case Hexagon::STrid_cNotPt :
2043 case Hexagon::STrid_cdnNotPt_V4 :
2044 case Hexagon::STrid_indexed_cdnNotPt_V4 :
2045 case Hexagon::STrid_indexed_cNotPt :
2046 case Hexagon::STrid_indexed_shl_cNotPt_V4 :
2047 case Hexagon::STrid_indexed_shl_cdnNotPt_V4 :
2048 case Hexagon::POST_STdri_cNotPt :
2049 case Hexagon::POST_STdri_cdnNotPt_V4 :
2050 case Hexagon::STrih_imm_cNotPt_V4 :
2051 case Hexagon::STrih_imm_cdnNotPt_V4 :
2052 case Hexagon::STriw_imm_cNotPt_V4 :
2053 case Hexagon::STriw_imm_cdnNotPt_V4 :
Jyotsna Verma6ea706e2013-05-01 21:37:34 +00002054 case Hexagon::JMP_fnew_t :
Sirish Pande26f61a12012-05-03 21:52:53 +00002055 case Hexagon::LDrid_cNotPt :
2056 case Hexagon::LDrid_cdnNotPt :
2057 case Hexagon::LDrid_indexed_cNotPt :
2058 case Hexagon::LDrid_indexed_cdnNotPt :
2059 case Hexagon::POST_LDrid_cNotPt :
2060 case Hexagon::POST_LDrid_cdnNotPt_V4 :
2061 case Hexagon::LDriw_cNotPt :
2062 case Hexagon::LDriw_cdnNotPt :
2063 case Hexagon::LDriw_indexed_cNotPt :
2064 case Hexagon::LDriw_indexed_cdnNotPt :
2065 case Hexagon::POST_LDriw_cNotPt :
2066 case Hexagon::POST_LDriw_cdnNotPt_V4 :
2067 case Hexagon::LDrih_cNotPt :
2068 case Hexagon::LDrih_cdnNotPt :
2069 case Hexagon::LDrih_indexed_cNotPt :
2070 case Hexagon::LDrih_indexed_cdnNotPt :
2071 case Hexagon::POST_LDrih_cNotPt :
2072 case Hexagon::POST_LDrih_cdnNotPt_V4 :
2073 case Hexagon::LDrib_cNotPt :
2074 case Hexagon::LDrib_cdnNotPt :
2075 case Hexagon::LDrib_indexed_cNotPt :
2076 case Hexagon::LDrib_indexed_cdnNotPt :
2077 case Hexagon::POST_LDrib_cNotPt :
2078 case Hexagon::POST_LDrib_cdnNotPt_V4 :
2079 case Hexagon::LDriuh_cNotPt :
2080 case Hexagon::LDriuh_cdnNotPt :
2081 case Hexagon::LDriuh_indexed_cNotPt :
2082 case Hexagon::LDriuh_indexed_cdnNotPt :
2083 case Hexagon::POST_LDriuh_cNotPt :
2084 case Hexagon::POST_LDriuh_cdnNotPt_V4 :
2085 case Hexagon::LDriub_cNotPt :
2086 case Hexagon::LDriub_cdnNotPt :
2087 case Hexagon::LDriub_indexed_cNotPt :
2088 case Hexagon::LDriub_indexed_cdnNotPt :
2089 case Hexagon::POST_LDriub_cNotPt :
2090 case Hexagon::POST_LDriub_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002091 case Hexagon::LDrid_indexed_shl_cNotPt_V4 :
2092 case Hexagon::LDrid_indexed_shl_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002093 case Hexagon::LDrib_indexed_shl_cNotPt_V4 :
2094 case Hexagon::LDrib_indexed_shl_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002095 case Hexagon::LDriub_indexed_shl_cNotPt_V4 :
2096 case Hexagon::LDriub_indexed_shl_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002097 case Hexagon::LDrih_indexed_shl_cNotPt_V4 :
2098 case Hexagon::LDrih_indexed_shl_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002099 case Hexagon::LDriuh_indexed_shl_cNotPt_V4 :
2100 case Hexagon::LDriuh_indexed_shl_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002101 case Hexagon::LDriw_indexed_shl_cNotPt_V4 :
2102 case Hexagon::LDriw_indexed_shl_cdnNotPt_V4 :
2103 case Hexagon::ADD_ri_cNotPt :
2104 case Hexagon::ADD_ri_cdnNotPt :
2105 case Hexagon::ADD_rr_cNotPt :
2106 case Hexagon::ADD_rr_cdnNotPt :
2107 case Hexagon::XOR_rr_cNotPt :
2108 case Hexagon::XOR_rr_cdnNotPt :
2109 case Hexagon::AND_rr_cNotPt :
2110 case Hexagon::AND_rr_cdnNotPt :
2111 case Hexagon::OR_rr_cNotPt :
2112 case Hexagon::OR_rr_cdnNotPt :
2113 case Hexagon::SUB_rr_cNotPt :
2114 case Hexagon::SUB_rr_cdnNotPt :
2115 case Hexagon::COMBINE_rr_cNotPt :
2116 case Hexagon::COMBINE_rr_cdnNotPt :
2117 case Hexagon::ASLH_cNotPt_V4 :
2118 case Hexagon::ASLH_cdnNotPt_V4 :
2119 case Hexagon::ASRH_cNotPt_V4 :
2120 case Hexagon::ASRH_cdnNotPt_V4 :
2121 case Hexagon::SXTB_cNotPt_V4 :
2122 case Hexagon::SXTB_cdnNotPt_V4 :
2123 case Hexagon::SXTH_cNotPt_V4 :
2124 case Hexagon::SXTH_cdnNotPt_V4 :
2125 case Hexagon::ZXTB_cNotPt_V4 :
2126 case Hexagon::ZXTB_cdnNotPt_V4 :
2127 case Hexagon::ZXTH_cNotPt_V4 :
2128 case Hexagon::ZXTH_cdnNotPt_V4 :
2129
Sirish Pande26f61a12012-05-03 21:52:53 +00002130 case Hexagon::LDd_GP_cNotPt_V4 :
2131 case Hexagon::LDb_GP_cNotPt_V4 :
2132 case Hexagon::LDub_GP_cNotPt_V4 :
2133 case Hexagon::LDh_GP_cNotPt_V4 :
2134 case Hexagon::LDuh_GP_cNotPt_V4 :
2135 case Hexagon::LDw_GP_cNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002136 case Hexagon::STd_GP_cNotPt_V4 :
2137 case Hexagon::STb_GP_cNotPt_V4 :
2138 case Hexagon::STh_GP_cNotPt_V4 :
2139 case Hexagon::STw_GP_cNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002140 case Hexagon::LDd_GP_cdnNotPt_V4 :
2141 case Hexagon::LDb_GP_cdnNotPt_V4 :
2142 case Hexagon::LDub_GP_cdnNotPt_V4 :
2143 case Hexagon::LDh_GP_cdnNotPt_V4 :
2144 case Hexagon::LDuh_GP_cdnNotPt_V4 :
2145 case Hexagon::LDw_GP_cdnNotPt_V4 :
Sirish Pande26f61a12012-05-03 21:52:53 +00002146 case Hexagon::STd_GP_cdnNotPt_V4 :
2147 case Hexagon::STb_GP_cdnNotPt_V4 :
2148 case Hexagon::STh_GP_cdnNotPt_V4 :
2149 case Hexagon::STw_GP_cdnNotPt_V4 :
2150 return false;
2151 }
2152 // return *some value* to avoid compiler warning
2153 return false;
2154}
2155
Sirish Pande26f61a12012-05-03 21:52:53 +00002156static MachineOperand& GetPostIncrementOperand(MachineInstr *MI,
2157 const HexagonInstrInfo *QII) {
2158 assert(QII->isPostIncrement(MI) && "Not a post increment operation.");
2159#ifndef NDEBUG
2160 // Post Increment means duplicates. Use dense map to find duplicates in the
2161 // list. Caution: Densemap initializes with the minimum of 64 buckets,
2162 // whereas there are at most 5 operands in the post increment.
2163 DenseMap<unsigned, unsigned> DefRegsSet;
2164 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++)
2165 if (MI->getOperand(opNum).isReg() &&
2166 MI->getOperand(opNum).isDef()) {
2167 DefRegsSet[MI->getOperand(opNum).getReg()] = 1;
2168 }
2169
2170 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++)
2171 if (MI->getOperand(opNum).isReg() &&
2172 MI->getOperand(opNum).isUse()) {
2173 if (DefRegsSet[MI->getOperand(opNum).getReg()]) {
2174 return MI->getOperand(opNum);
2175 }
2176 }
2177#else
2178 if (MI->getDesc().mayLoad()) {
2179 // The 2nd operand is always the post increment operand in load.
2180 assert(MI->getOperand(1).isReg() &&
2181 "Post increment operand has be to a register.");
2182 return (MI->getOperand(1));
2183 }
2184 if (MI->getDesc().mayStore()) {
2185 // The 1st operand is always the post increment operand in store.
2186 assert(MI->getOperand(0).isReg() &&
2187 "Post increment operand has be to a register.");
2188 return (MI->getOperand(0));
2189 }
2190#endif
2191 // we should never come here.
2192 llvm_unreachable("mayLoad or mayStore not set for Post Increment operation");
2193}
2194
2195// get the value being stored
2196static MachineOperand& GetStoreValueOperand(MachineInstr *MI) {
2197 // value being stored is always the last operand.
2198 return (MI->getOperand(MI->getNumOperands()-1));
2199}
2200
2201// can be new value store?
2202// Following restrictions are to be respected in convert a store into
2203// a new value store.
2204// 1. If an instruction uses auto-increment, its address register cannot
2205// be a new-value register. Arch Spec 5.4.2.1
2206// 2. If an instruction uses absolute-set addressing mode,
2207// its address register cannot be a new-value register.
2208// Arch Spec 5.4.2.1.TODO: This is not enabled as
2209// as absolute-set address mode patters are not implemented.
2210// 3. If an instruction produces a 64-bit result, its registers cannot be used
2211// as new-value registers. Arch Spec 5.4.2.2.
2212// 4. If the instruction that sets a new-value register is conditional, then
2213// the instruction that uses the new-value register must also be conditional,
2214// and both must always have their predicates evaluate identically.
2215// Arch Spec 5.4.2.3.
2216// 5. There is an implied restriction of a packet can not have another store,
2217// if there is a new value store in the packet. Corollary, if there is
2218// already a store in a packet, there can not be a new value store.
2219// Arch Spec: 3.4.4.2
2220bool HexagonPacketizerList::CanPromoteToNewValueStore( MachineInstr *MI,
2221 MachineInstr *PacketMI, unsigned DepReg,
2222 std::map <MachineInstr*, SUnit*> MIToSUnit)
2223{
2224 // Make sure we are looking at the store
2225 if (!IsNewifyStore(MI))
2226 return false;
2227
2228 // Make sure there is dependency and can be new value'ed
2229 if (GetStoreValueOperand(MI).isReg() &&
2230 GetStoreValueOperand(MI).getReg() != DepReg)
2231 return false;
2232
2233 const HexagonRegisterInfo* QRI =
2234 (const HexagonRegisterInfo *) TM.getRegisterInfo();
2235 const MCInstrDesc& MCID = PacketMI->getDesc();
2236 // first operand is always the result
2237
2238 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
Jakob Stoklund Olesen397fc482012-05-07 22:10:26 +00002239 const TargetRegisterClass* PacketRC = QII->getRegClass(MCID, 0, QRI, MF);
Sirish Pande26f61a12012-05-03 21:52:53 +00002240
2241 // if there is already an store in the packet, no can do new value store
2242 // Arch Spec 3.4.4.2.
2243 for (std::vector<MachineInstr*>::iterator VI = CurrentPacketMIs.begin(),
2244 VE = CurrentPacketMIs.end();
2245 (VI != VE); ++VI) {
2246 SUnit* PacketSU = MIToSUnit[*VI];
2247 if (PacketSU->getInstr()->getDesc().mayStore() ||
2248 // if we have mayStore = 1 set on ALLOCFRAME and DEALLOCFRAME,
2249 // then we don't need this
2250 PacketSU->getInstr()->getOpcode() == Hexagon::ALLOCFRAME ||
2251 PacketSU->getInstr()->getOpcode() == Hexagon::DEALLOCFRAME)
2252 return false;
2253 }
2254
2255 if (PacketRC == &Hexagon::DoubleRegsRegClass) {
2256 // new value store constraint: double regs can not feed into new value store
2257 // arch spec section: 5.4.2.2
2258 return false;
2259 }
2260
2261 // Make sure it's NOT the post increment register that we are going to
2262 // new value.
2263 if (QII->isPostIncrement(MI) &&
2264 MI->getDesc().mayStore() &&
2265 GetPostIncrementOperand(MI, QII).getReg() == DepReg) {
2266 return false;
2267 }
2268
2269 if (QII->isPostIncrement(PacketMI) &&
2270 PacketMI->getDesc().mayLoad() &&
2271 GetPostIncrementOperand(PacketMI, QII).getReg() == DepReg) {
2272 // if source is post_inc, or absolute-set addressing,
2273 // it can not feed into new value store
2274 // r3 = memw(r2++#4)
2275 // memw(r30 + #-1404) = r2.new -> can not be new value store
2276 // arch spec section: 5.4.2.1
2277 return false;
2278 }
2279
2280 // If the source that feeds the store is predicated, new value store must
2281 // also be also predicated.
2282 if (QII->isPredicated(PacketMI)) {
2283 if (!QII->isPredicated(MI))
2284 return false;
2285
2286 // Check to make sure that they both will have their predicates
2287 // evaluate identically
Sirish Pande12a52522012-05-11 20:00:34 +00002288 unsigned predRegNumSrc = 0;
2289 unsigned predRegNumDst = 0;
2290 const TargetRegisterClass* predRegClass = NULL;
Sirish Pande26f61a12012-05-03 21:52:53 +00002291
2292 // Get predicate register used in the source instruction
2293 for(unsigned opNum = 0; opNum < PacketMI->getNumOperands(); opNum++) {
2294 if ( PacketMI->getOperand(opNum).isReg())
2295 predRegNumSrc = PacketMI->getOperand(opNum).getReg();
2296 predRegClass = QRI->getMinimalPhysRegClass(predRegNumSrc);
2297 if (predRegClass == &Hexagon::PredRegsRegClass) {
2298 break;
2299 }
2300 }
2301 assert ((predRegClass == &Hexagon::PredRegsRegClass ) &&
2302 ("predicate register not found in a predicated PacketMI instruction"));
2303
2304 // Get predicate register used in new-value store instruction
2305 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++) {
2306 if ( MI->getOperand(opNum).isReg())
2307 predRegNumDst = MI->getOperand(opNum).getReg();
2308 predRegClass = QRI->getMinimalPhysRegClass(predRegNumDst);
2309 if (predRegClass == &Hexagon::PredRegsRegClass) {
2310 break;
2311 }
2312 }
2313 assert ((predRegClass == &Hexagon::PredRegsRegClass ) &&
2314 ("predicate register not found in a predicated MI instruction"));
2315
2316 // New-value register producer and user (store) need to satisfy these
2317 // constraints:
2318 // 1) Both instructions should be predicated on the same register.
2319 // 2) If producer of the new-value register is .new predicated then store
2320 // should also be .new predicated and if producer is not .new predicated
2321 // then store should not be .new predicated.
2322 // 3) Both new-value register producer and user should have same predicate
2323 // sense, i.e, either both should be negated or both should be none negated.
2324
2325 if (( predRegNumDst != predRegNumSrc) ||
Jyotsna Verma810848d2013-03-28 19:44:04 +00002326 QII->isDotNewInst(PacketMI) != QII->isDotNewInst(MI) ||
Sirish Pande26f61a12012-05-03 21:52:53 +00002327 GetPredicateSense(MI, QII) != GetPredicateSense(PacketMI, QII)) {
2328 return false;
2329 }
2330 }
2331
2332 // Make sure that other than the new-value register no other store instruction
2333 // register has been modified in the same packet. Predicate registers can be
2334 // modified by they should not be modified between the producer and the store
2335 // instruction as it will make them both conditional on different values.
2336 // We already know this to be true for all the instructions before and
2337 // including PacketMI. Howerver, we need to perform the check for the
2338 // remaining instructions in the packet.
2339
2340 std::vector<MachineInstr*>::iterator VI;
2341 std::vector<MachineInstr*>::iterator VE;
2342 unsigned StartCheck = 0;
2343
2344 for (VI=CurrentPacketMIs.begin(), VE = CurrentPacketMIs.end();
2345 (VI != VE); ++VI) {
2346 SUnit* TempSU = MIToSUnit[*VI];
2347 MachineInstr* TempMI = TempSU->getInstr();
2348
2349 // Following condition is true for all the instructions until PacketMI is
2350 // reached (StartCheck is set to 0 before the for loop).
2351 // StartCheck flag is 1 for all the instructions after PacketMI.
2352 if (TempMI != PacketMI && !StartCheck) // start processing only after
2353 continue; // encountering PacketMI
2354
2355 StartCheck = 1;
2356 if (TempMI == PacketMI) // We don't want to check PacketMI for dependence
2357 continue;
2358
2359 for(unsigned opNum = 0; opNum < MI->getNumOperands(); opNum++) {
2360 if (MI->getOperand(opNum).isReg() &&
2361 TempSU->getInstr()->modifiesRegister(MI->getOperand(opNum).getReg(),
2362 QRI))
2363 return false;
2364 }
2365 }
2366
2367 // Make sure that for non POST_INC stores:
2368 // 1. The only use of reg is DepReg and no other registers.
2369 // This handles V4 base+index registers.
2370 // The following store can not be dot new.
2371 // Eg. r0 = add(r0, #3)a
2372 // memw(r1+r0<<#2) = r0
2373 if (!QII->isPostIncrement(MI) &&
2374 GetStoreValueOperand(MI).isReg() &&
2375 GetStoreValueOperand(MI).getReg() == DepReg) {
2376 for(unsigned opNum = 0; opNum < MI->getNumOperands()-1; opNum++) {
2377 if (MI->getOperand(opNum).isReg() &&
2378 MI->getOperand(opNum).getReg() == DepReg) {
2379 return false;
2380 }
2381 }
2382 // 2. If data definition is because of implicit definition of the register,
2383 // do not newify the store. Eg.
2384 // %R9<def> = ZXTH %R12, %D6<imp-use>, %R12<imp-def>
2385 // STrih_indexed %R8, 2, %R12<kill>; mem:ST2[%scevgep343]
2386 for(unsigned opNum = 0; opNum < PacketMI->getNumOperands(); opNum++) {
2387 if (PacketMI->getOperand(opNum).isReg() &&
2388 PacketMI->getOperand(opNum).getReg() == DepReg &&
2389 PacketMI->getOperand(opNum).isDef() &&
2390 PacketMI->getOperand(opNum).isImplicit()) {
2391 return false;
2392 }
2393 }
2394 }
2395
2396 // Can be dot new store.
2397 return true;
2398}
2399
2400// can this MI to promoted to either
2401// new value store or new value jump
2402bool HexagonPacketizerList::CanPromoteToNewValue( MachineInstr *MI,
2403 SUnit *PacketSU, unsigned DepReg,
2404 std::map <MachineInstr*, SUnit*> MIToSUnit,
2405 MachineBasicBlock::iterator &MII)
2406{
2407
2408 const HexagonRegisterInfo* QRI =
2409 (const HexagonRegisterInfo *) TM.getRegisterInfo();
2410 if (!QRI->Subtarget.hasV4TOps() ||
2411 !IsNewifyStore(MI))
2412 return false;
2413
2414 MachineInstr *PacketMI = PacketSU->getInstr();
2415
2416 // Check to see the store can be new value'ed.
2417 if (CanPromoteToNewValueStore(MI, PacketMI, DepReg, MIToSUnit))
2418 return true;
2419
2420 // Check to see the compare/jump can be new value'ed.
2421 // This is done as a pass on its own. Don't need to check it here.
2422 return false;
2423}
2424
2425// Check to see if an instruction can be dot new
2426// There are three kinds.
2427// 1. dot new on predicate - V2/V3/V4
2428// 2. dot new on stores NV/ST - V4
2429// 3. dot new on jump NV/J - V4 -- This is generated in a pass.
2430bool HexagonPacketizerList::CanPromoteToDotNew( MachineInstr *MI,
2431 SUnit *PacketSU, unsigned DepReg,
2432 std::map <MachineInstr*, SUnit*> MIToSUnit,
2433 MachineBasicBlock::iterator &MII,
2434 const TargetRegisterClass* RC )
2435{
Jyotsna Verma810848d2013-03-28 19:44:04 +00002436 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2437 // Already a dot new instruction.
2438 if (QII->isDotNewInst(MI) && !IsNewifyStore(MI))
Sirish Pande26f61a12012-05-03 21:52:53 +00002439 return false;
2440
2441 if (!isNewifiable(MI))
2442 return false;
2443
2444 // predicate .new
2445 if (RC == &Hexagon::PredRegsRegClass && isCondInst(MI))
2446 return true;
2447 else if (RC != &Hexagon::PredRegsRegClass &&
2448 !IsNewifyStore(MI)) // MI is not a new-value store
2449 return false;
2450 else {
2451 // Create a dot new machine instruction to see if resources can be
2452 // allocated. If not, bail out now.
Sirish Pande26f61a12012-05-03 21:52:53 +00002453 int NewOpcode = GetDotNewOp(MI->getOpcode());
2454 const MCInstrDesc &desc = QII->get(NewOpcode);
2455 DebugLoc dl;
2456 MachineInstr *NewMI =
2457 MI->getParent()->getParent()->CreateMachineInstr(desc, dl);
2458 bool ResourcesAvailable = ResourceTracker->canReserveResources(NewMI);
2459 MI->getParent()->getParent()->DeleteMachineInstr(NewMI);
2460
2461 if (!ResourcesAvailable)
2462 return false;
2463
2464 // new value store only
2465 // new new value jump generated as a passes
2466 if (!CanPromoteToNewValue(MI, PacketSU, DepReg, MIToSUnit, MII)) {
2467 return false;
2468 }
2469 }
2470 return true;
2471}
2472
2473// Go through the packet instructions and search for anti dependency
2474// between them and DepReg from MI
2475// Consider this case:
2476// Trying to add
2477// a) %R1<def> = TFRI_cdNotPt %P3, 2
2478// to this packet:
2479// {
2480// b) %P0<def> = OR_pp %P3<kill>, %P0<kill>
2481// c) %P3<def> = TFR_PdRs %R23
2482// d) %R1<def> = TFRI_cdnPt %P3, 4
2483// }
2484// The P3 from a) and d) will be complements after
2485// a)'s P3 is converted to .new form
2486// Anti Dep between c) and b) is irrelevant for this case
2487bool HexagonPacketizerList::RestrictingDepExistInPacket (MachineInstr* MI,
2488 unsigned DepReg,
2489 std::map <MachineInstr*, SUnit*> MIToSUnit) {
2490
2491 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2492 SUnit* PacketSUDep = MIToSUnit[MI];
2493
2494 for (std::vector<MachineInstr*>::iterator VIN = CurrentPacketMIs.begin(),
2495 VEN = CurrentPacketMIs.end(); (VIN != VEN); ++VIN) {
2496
2497 // We only care for dependencies to predicated instructions
2498 if(!QII->isPredicated(*VIN)) continue;
2499
2500 // Scheduling Unit for current insn in the packet
2501 SUnit* PacketSU = MIToSUnit[*VIN];
2502
2503 // Look at dependencies between current members of the packet
2504 // and predicate defining instruction MI.
2505 // Make sure that dependency is on the exact register
2506 // we care about.
2507 if (PacketSU->isSucc(PacketSUDep)) {
2508 for (unsigned i = 0; i < PacketSU->Succs.size(); ++i) {
2509 if ((PacketSU->Succs[i].getSUnit() == PacketSUDep) &&
2510 (PacketSU->Succs[i].getKind() == SDep::Anti) &&
2511 (PacketSU->Succs[i].getReg() == DepReg)) {
2512 return true;
2513 }
2514 }
2515 }
2516 }
2517
2518 return false;
2519}
2520
2521
2522// Given two predicated instructions, this function detects whether
2523// the predicates are complements
2524bool HexagonPacketizerList::ArePredicatesComplements (MachineInstr* MI1,
2525 MachineInstr* MI2, std::map <MachineInstr*, SUnit*> MIToSUnit) {
2526
2527 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2528 // Currently can only reason about conditional transfers
2529 if (!QII->isConditionalTransfer(MI1) || !QII->isConditionalTransfer(MI2)) {
2530 return false;
2531 }
2532
2533 // Scheduling unit for candidate
2534 SUnit* SU = MIToSUnit[MI1];
2535
2536 // One corner case deals with the following scenario:
2537 // Trying to add
2538 // a) %R24<def> = TFR_cPt %P0, %R25
2539 // to this packet:
2540 //
2541 // {
2542 // b) %R25<def> = TFR_cNotPt %P0, %R24
2543 // c) %P0<def> = CMPEQri %R26, 1
2544 // }
2545 //
2546 // On general check a) and b) are complements, but
2547 // presence of c) will convert a) to .new form, and
2548 // then it is not a complement
2549 // We attempt to detect it by analyzing existing
2550 // dependencies in the packet
2551
2552 // Analyze relationships between all existing members of the packet.
2553 // Look for Anti dependecy on the same predicate reg
2554 // as used in the candidate
2555 for (std::vector<MachineInstr*>::iterator VIN = CurrentPacketMIs.begin(),
2556 VEN = CurrentPacketMIs.end(); (VIN != VEN); ++VIN) {
2557
2558 // Scheduling Unit for current insn in the packet
2559 SUnit* PacketSU = MIToSUnit[*VIN];
2560
2561 // If this instruction in the packet is succeeded by the candidate...
2562 if (PacketSU->isSucc(SU)) {
2563 for (unsigned i = 0; i < PacketSU->Succs.size(); ++i) {
2564 // The corner case exist when there is true data
2565 // dependency between candidate and one of current
2566 // packet members, this dep is on predicate reg, and
2567 // there already exist anti dep on the same pred in
2568 // the packet.
2569 if (PacketSU->Succs[i].getSUnit() == SU &&
2570 Hexagon::PredRegsRegClass.contains(
2571 PacketSU->Succs[i].getReg()) &&
2572 PacketSU->Succs[i].getKind() == SDep::Data &&
2573 // Here I know that *VIN is predicate setting instruction
2574 // with true data dep to candidate on the register
2575 // we care about - c) in the above example.
2576 // Now I need to see if there is an anti dependency
2577 // from c) to any other instruction in the
2578 // same packet on the pred reg of interest
2579 RestrictingDepExistInPacket(*VIN,PacketSU->Succs[i].getReg(),
2580 MIToSUnit)) {
2581 return false;
2582 }
2583 }
2584 }
2585 }
2586
2587 // If the above case does not apply, check regular
2588 // complement condition.
2589 // Check that the predicate register is the same and
2590 // that the predicate sense is different
2591 // We also need to differentiate .old vs. .new:
2592 // !p0 is not complimentary to p0.new
2593 return ((MI1->getOperand(1).getReg() == MI2->getOperand(1).getReg()) &&
2594 (GetPredicateSense(MI1, QII) != GetPredicateSense(MI2, QII)) &&
Jyotsna Verma810848d2013-03-28 19:44:04 +00002595 (QII->isDotNewInst(MI1) == QII->isDotNewInst(MI2)));
Sirish Pande26f61a12012-05-03 21:52:53 +00002596}
2597
2598// initPacketizerState - Initialize packetizer flags
2599void HexagonPacketizerList::initPacketizerState() {
2600
2601 Dependence = false;
2602 PromotedToDotNew = false;
2603 GlueToNewValueJump = false;
2604 GlueAllocframeStore = false;
2605 FoundSequentialDependence = false;
2606
2607 return;
2608}
2609
2610// ignorePseudoInstruction - Ignore bundling of pseudo instructions.
2611bool HexagonPacketizerList::ignorePseudoInstruction(MachineInstr *MI,
2612 MachineBasicBlock *MBB) {
2613 if (MI->isDebugValue())
2614 return true;
2615
2616 // We must print out inline assembly
2617 if (MI->isInlineAsm())
2618 return false;
2619
2620 // We check if MI has any functional units mapped to it.
2621 // If it doesn't, we ignore the instruction.
2622 const MCInstrDesc& TID = MI->getDesc();
2623 unsigned SchedClass = TID.getSchedClass();
2624 const InstrStage* IS =
2625 ResourceTracker->getInstrItins()->beginStage(SchedClass);
Hal Finkelb460a332012-06-22 20:27:13 +00002626 unsigned FuncUnits = IS->getUnits();
Sirish Pande26f61a12012-05-03 21:52:53 +00002627 return !FuncUnits;
2628}
2629
2630// isSoloInstruction: - Returns true for instructions that must be
2631// scheduled in their own packet.
2632bool HexagonPacketizerList::isSoloInstruction(MachineInstr *MI) {
2633
2634 if (MI->isInlineAsm())
2635 return true;
2636
2637 if (MI->isEHLabel())
2638 return true;
2639
2640 // From Hexagon V4 Programmer's Reference Manual 3.4.4 Grouping constraints:
2641 // trap, pause, barrier, icinva, isync, and syncht are solo instructions.
2642 // They must not be grouped with other instructions in a packet.
2643 if (IsSchedBarrier(MI))
2644 return true;
2645
2646 return false;
2647}
2648
2649// isLegalToPacketizeTogether:
2650// SUI is the current instruction that is out side of the current packet.
2651// SUJ is the current instruction inside the current packet against which that
2652// SUI will be packetized.
2653bool HexagonPacketizerList::isLegalToPacketizeTogether(SUnit *SUI, SUnit *SUJ) {
2654 MachineInstr *I = SUI->getInstr();
2655 MachineInstr *J = SUJ->getInstr();
2656 assert(I && J && "Unable to packetize null instruction!");
2657
2658 const MCInstrDesc &MCIDI = I->getDesc();
2659 const MCInstrDesc &MCIDJ = J->getDesc();
2660
2661 MachineBasicBlock::iterator II = I;
2662
2663 const unsigned FrameSize = MF.getFrameInfo()->getStackSize();
2664 const HexagonRegisterInfo* QRI =
2665 (const HexagonRegisterInfo *) TM.getRegisterInfo();
2666 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
2667
2668 // Inline asm cannot go in the packet.
2669 if (I->getOpcode() == Hexagon::INLINEASM)
2670 llvm_unreachable("Should not meet inline asm here!");
2671
2672 if (isSoloInstruction(I))
2673 llvm_unreachable("Should not meet solo instr here!");
2674
2675 // A save callee-save register function call can only be in a packet
2676 // with instructions that don't write to the callee-save registers.
2677 if ((QII->isSaveCalleeSavedRegsCall(I) &&
2678 DoesModifyCalleeSavedReg(J, QRI)) ||
2679 (QII->isSaveCalleeSavedRegsCall(J) &&
2680 DoesModifyCalleeSavedReg(I, QRI))) {
2681 Dependence = true;
2682 return false;
2683 }
2684
2685 // Two control flow instructions cannot go in the same packet.
2686 if (IsControlFlow(I) && IsControlFlow(J)) {
2687 Dependence = true;
2688 return false;
2689 }
2690
2691 // A LoopN instruction cannot appear in the same packet as a jump or call.
2692 if (IsLoopN(I) && ( IsDirectJump(J)
2693 || MCIDJ.isCall()
2694 || QII->isDeallocRet(J))) {
2695 Dependence = true;
2696 return false;
2697 }
2698 if (IsLoopN(J) && ( IsDirectJump(I)
2699 || MCIDI.isCall()
2700 || QII->isDeallocRet(I))) {
2701 Dependence = true;
2702 return false;
2703 }
2704
2705 // dealloc_return cannot appear in the same packet as a conditional or
2706 // unconditional jump.
2707 if (QII->isDeallocRet(I) && ( MCIDJ.isBranch()
2708 || MCIDJ.isCall()
2709 || MCIDJ.isBarrier())) {
2710 Dependence = true;
2711 return false;
2712 }
2713
2714
2715 // V4 allows dual store. But does not allow second store, if the
2716 // first store is not in SLOT0. New value store, new value jump,
2717 // dealloc_return and memop always take SLOT0.
2718 // Arch spec 3.4.4.2
2719 if (QRI->Subtarget.hasV4TOps()) {
Jyotsna Verma9feabc22013-03-05 18:51:42 +00002720 if (MCIDI.mayStore() && MCIDJ.mayStore() &&
2721 (QII->isNewValueInst(J) || QII->isMemOp(J) || QII->isMemOp(I))) {
Sirish Pande26f61a12012-05-03 21:52:53 +00002722 Dependence = true;
2723 return false;
2724 }
2725
Jyotsna Verma9feabc22013-03-05 18:51:42 +00002726 if ((QII->isMemOp(J) && MCIDI.mayStore())
Sirish Pande26f61a12012-05-03 21:52:53 +00002727 || (MCIDJ.mayStore() && QII->isMemOp(I))
2728 || (QII->isMemOp(J) && QII->isMemOp(I))) {
2729 Dependence = true;
2730 return false;
2731 }
2732
2733 //if dealloc_return
2734 if (MCIDJ.mayStore() && QII->isDeallocRet(I)){
2735 Dependence = true;
2736 return false;
2737 }
2738
2739 // If an instruction feeds new value jump, glue it.
2740 MachineBasicBlock::iterator NextMII = I;
2741 ++NextMII;
2742 MachineInstr *NextMI = NextMII;
2743
2744 if (QII->isNewValueJump(NextMI)) {
2745
2746 bool secondRegMatch = false;
2747 bool maintainNewValueJump = false;
2748
2749 if (NextMI->getOperand(1).isReg() &&
2750 I->getOperand(0).getReg() == NextMI->getOperand(1).getReg()) {
2751 secondRegMatch = true;
2752 maintainNewValueJump = true;
2753 }
2754
2755 if (!secondRegMatch &&
2756 I->getOperand(0).getReg() == NextMI->getOperand(0).getReg()) {
2757 maintainNewValueJump = true;
2758 }
2759
2760 for (std::vector<MachineInstr*>::iterator
2761 VI = CurrentPacketMIs.begin(),
2762 VE = CurrentPacketMIs.end();
2763 (VI != VE && maintainNewValueJump); ++VI) {
2764 SUnit* PacketSU = MIToSUnit[*VI];
2765
2766 // NVJ can not be part of the dual jump - Arch Spec: section 7.8
2767 if (PacketSU->getInstr()->getDesc().isCall()) {
2768 Dependence = true;
2769 break;
2770 }
2771 // Validate
2772 // 1. Packet does not have a store in it.
2773 // 2. If the first operand of the nvj is newified, and the second
2774 // operand is also a reg, it (second reg) is not defined in
2775 // the same packet.
2776 // 3. If the second operand of the nvj is newified, (which means
2777 // first operand is also a reg), first reg is not defined in
2778 // the same packet.
2779 if (PacketSU->getInstr()->getDesc().mayStore() ||
2780 PacketSU->getInstr()->getOpcode() == Hexagon::ALLOCFRAME ||
2781 // Check #2.
2782 (!secondRegMatch && NextMI->getOperand(1).isReg() &&
2783 PacketSU->getInstr()->modifiesRegister(
2784 NextMI->getOperand(1).getReg(), QRI)) ||
2785 // Check #3.
2786 (secondRegMatch &&
2787 PacketSU->getInstr()->modifiesRegister(
2788 NextMI->getOperand(0).getReg(), QRI))) {
2789 Dependence = true;
2790 break;
2791 }
2792 }
2793 if (!Dependence)
2794 GlueToNewValueJump = true;
2795 else
2796 return false;
2797 }
2798 }
2799
2800 if (SUJ->isSucc(SUI)) {
2801 for (unsigned i = 0;
2802 (i < SUJ->Succs.size()) && !FoundSequentialDependence;
2803 ++i) {
2804
2805 if (SUJ->Succs[i].getSUnit() != SUI) {
2806 continue;
2807 }
2808
2809 SDep::Kind DepType = SUJ->Succs[i].getKind();
2810
2811 // For direct calls:
2812 // Ignore register dependences for call instructions for
2813 // packetization purposes except for those due to r31 and
2814 // predicate registers.
2815 //
2816 // For indirect calls:
2817 // Same as direct calls + check for true dependences to the register
2818 // used in the indirect call.
2819 //
2820 // We completely ignore Order dependences for call instructions
2821 //
2822 // For returns:
2823 // Ignore register dependences for return instructions like jumpr,
2824 // dealloc return unless we have dependencies on the explicit uses
2825 // of the registers used by jumpr (like r31) or dealloc return
2826 // (like r29 or r30).
2827 //
2828 // TODO: Currently, jumpr is handling only return of r31. So, the
2829 // following logic (specificaly IsCallDependent) is working fine.
2830 // We need to enable jumpr for register other than r31 and then,
2831 // we need to rework the last part, where it handles indirect call
2832 // of that (IsCallDependent) function. Bug 6216 is opened for this.
2833 //
2834 unsigned DepReg = 0;
2835 const TargetRegisterClass* RC = NULL;
2836 if (DepType == SDep::Data) {
2837 DepReg = SUJ->Succs[i].getReg();
2838 RC = QRI->getMinimalPhysRegClass(DepReg);
2839 }
2840 if ((MCIDI.isCall() || MCIDI.isReturn()) &&
2841 (!IsRegDependence(DepType) ||
2842 !IsCallDependent(I, DepType, SUJ->Succs[i].getReg()))) {
2843 /* do nothing */
2844 }
2845
2846 // For instructions that can be promoted to dot-new, try to promote.
2847 else if ((DepType == SDep::Data) &&
2848 CanPromoteToDotNew(I, SUJ, DepReg, MIToSUnit, II, RC) &&
2849 PromoteToDotNew(I, DepType, II, RC)) {
2850 PromotedToDotNew = true;
2851 /* do nothing */
2852 }
2853
2854 else if ((DepType == SDep::Data) &&
2855 (QII->isNewValueJump(I))) {
2856 /* do nothing */
2857 }
2858
2859 // For predicated instructions, if the predicates are complements
2860 // then there can be no dependence.
2861 else if (QII->isPredicated(I) &&
2862 QII->isPredicated(J) &&
2863 ArePredicatesComplements(I, J, MIToSUnit)) {
2864 /* do nothing */
2865
2866 }
2867 else if (IsDirectJump(I) &&
2868 !MCIDJ.isBranch() &&
2869 !MCIDJ.isCall() &&
2870 (DepType == SDep::Order)) {
2871 // Ignore Order dependences between unconditional direct branches
2872 // and non-control-flow instructions
2873 /* do nothing */
2874 }
2875 else if (MCIDI.isConditionalBranch() && (DepType != SDep::Data) &&
2876 (DepType != SDep::Output)) {
2877 // Ignore all dependences for jumps except for true and output
2878 // dependences
2879 /* do nothing */
2880 }
2881
2882 // Ignore output dependences due to superregs. We can
2883 // write to two different subregisters of R1:0 for instance
2884 // in the same cycle
2885 //
2886
2887 //
2888 // Let the
2889 // If neither I nor J defines DepReg, then this is a
2890 // superfluous output dependence. The dependence must be of the
2891 // form:
2892 // R0 = ...
2893 // R1 = ...
2894 // and there is an output dependence between the two instructions
2895 // with
2896 // DepReg = D0
2897 // We want to ignore these dependences.
2898 // Ideally, the dependence constructor should annotate such
2899 // dependences. We can then avoid this relatively expensive check.
2900 //
2901 else if (DepType == SDep::Output) {
2902 // DepReg is the register that's responsible for the dependence.
2903 unsigned DepReg = SUJ->Succs[i].getReg();
2904
2905 // Check if I and J really defines DepReg.
2906 if (I->definesRegister(DepReg) ||
2907 J->definesRegister(DepReg)) {
2908 FoundSequentialDependence = true;
2909 break;
2910 }
2911 }
2912
2913 // We ignore Order dependences for
2914 // 1. Two loads unless they are volatile.
2915 // 2. Two stores in V4 unless they are volatile.
2916 else if ((DepType == SDep::Order) &&
Jakob Stoklund Olesenf036f7a2012-08-29 21:19:21 +00002917 !I->hasOrderedMemoryRef() &&
2918 !J->hasOrderedMemoryRef()) {
Sirish Pande26f61a12012-05-03 21:52:53 +00002919 if (QRI->Subtarget.hasV4TOps() &&
2920 // hexagonv4 allows dual store.
2921 MCIDI.mayStore() && MCIDJ.mayStore()) {
2922 /* do nothing */
2923 }
2924 // store followed by store-- not OK on V2
2925 // store followed by load -- not OK on all (OK if addresses
2926 // are not aliased)
2927 // load followed by store -- OK on all
2928 // load followed by load -- OK on all
2929 else if ( !MCIDJ.mayStore()) {
2930 /* do nothing */
2931 }
2932 else {
2933 FoundSequentialDependence = true;
2934 break;
2935 }
2936 }
2937
2938 // For V4, special case ALLOCFRAME. Even though there is dependency
2939 // between ALLOCAFRAME and subsequent store, allow it to be
2940 // packetized in a same packet. This implies that the store is using
2941 // caller's SP. Hense, offset needs to be updated accordingly.
2942 else if (DepType == SDep::Data
2943 && QRI->Subtarget.hasV4TOps()
2944 && J->getOpcode() == Hexagon::ALLOCFRAME
2945 && (I->getOpcode() == Hexagon::STrid
2946 || I->getOpcode() == Hexagon::STriw
2947 || I->getOpcode() == Hexagon::STrib)
2948 && I->getOperand(0).getReg() == QRI->getStackRegister()
2949 && QII->isValidOffset(I->getOpcode(),
2950 I->getOperand(1).getImm() -
2951 (FrameSize + HEXAGON_LRFP_SIZE)))
2952 {
2953 GlueAllocframeStore = true;
2954 // Since this store is to be glued with allocframe in the same
2955 // packet, it will use SP of the previous stack frame, i.e
2956 // caller's SP. Therefore, we need to recalculate offset according
2957 // to this change.
2958 I->getOperand(1).setImm(I->getOperand(1).getImm() -
2959 (FrameSize + HEXAGON_LRFP_SIZE));
2960 }
2961
2962 //
2963 // Skip over anti-dependences. Two instructions that are
2964 // anti-dependent can share a packet
2965 //
2966 else if (DepType != SDep::Anti) {
2967 FoundSequentialDependence = true;
2968 break;
2969 }
2970 }
2971
2972 if (FoundSequentialDependence) {
2973 Dependence = true;
2974 return false;
2975 }
2976 }
2977
2978 return true;
2979}
2980
2981// isLegalToPruneDependencies
2982bool HexagonPacketizerList::isLegalToPruneDependencies(SUnit *SUI, SUnit *SUJ) {
2983 MachineInstr *I = SUI->getInstr();
2984 assert(I && SUJ->getInstr() && "Unable to packetize null instruction!");
2985
2986 const unsigned FrameSize = MF.getFrameInfo()->getStackSize();
2987
2988 if (Dependence) {
2989
2990 // Check if the instruction was promoted to a dot-new. If so, demote it
2991 // back into a dot-old.
2992 if (PromotedToDotNew) {
2993 DemoteToDotOld(I);
2994 }
2995
2996 // Check if the instruction (must be a store) was glued with an Allocframe
2997 // instruction. If so, restore its offset to its original value, i.e. use
2998 // curent SP instead of caller's SP.
2999 if (GlueAllocframeStore) {
3000 I->getOperand(1).setImm(I->getOperand(1).getImm() +
3001 FrameSize + HEXAGON_LRFP_SIZE);
3002 }
3003
3004 return false;
3005 }
3006 return true;
3007}
3008
3009MachineBasicBlock::iterator
3010HexagonPacketizerList::addToPacket(MachineInstr *MI) {
3011
3012 MachineBasicBlock::iterator MII = MI;
3013 MachineBasicBlock *MBB = MI->getParent();
3014
3015 const HexagonInstrInfo *QII = (const HexagonInstrInfo *) TII;
3016
3017 if (GlueToNewValueJump) {
3018
3019 ++MII;
3020 MachineInstr *nvjMI = MII;
3021 assert(ResourceTracker->canReserveResources(MI));
3022 ResourceTracker->reserveResources(MI);
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +00003023 if ((QII->isExtended(MI) || QII->isConstExtended(MI)) &&
Sirish Pande26f61a12012-05-03 21:52:53 +00003024 !tryAllocateResourcesForConstExt(MI)) {
3025 endPacket(MBB, MI);
3026 ResourceTracker->reserveResources(MI);
3027 assert(canReserveResourcesForConstExt(MI) &&
3028 "Ensure that there is a slot");
3029 reserveResourcesForConstExt(MI);
3030 // Reserve resources for new value jump constant extender.
3031 assert(canReserveResourcesForConstExt(MI) &&
3032 "Ensure that there is a slot");
3033 reserveResourcesForConstExt(nvjMI);
3034 assert(ResourceTracker->canReserveResources(nvjMI) &&
3035 "Ensure that there is a slot");
3036
3037 } else if ( // Extended instruction takes two slots in the packet.
3038 // Try reserve and allocate 4-byte in the current packet first.
3039 (QII->isExtended(nvjMI)
3040 && (!tryAllocateResourcesForConstExt(nvjMI)
3041 || !ResourceTracker->canReserveResources(nvjMI)))
3042 || // For non-extended instruction, no need to allocate extra 4 bytes.
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +00003043 (!QII->isExtended(nvjMI) &&
Sirish Pande26f61a12012-05-03 21:52:53 +00003044 !ResourceTracker->canReserveResources(nvjMI)))
3045 {
3046 endPacket(MBB, MI);
3047 // A new and empty packet starts.
3048 // We are sure that the resources requirements can be satisfied.
3049 // Therefore, do not need to call "canReserveResources" anymore.
3050 ResourceTracker->reserveResources(MI);
3051 if (QII->isExtended(nvjMI))
3052 reserveResourcesForConstExt(nvjMI);
3053 }
3054 // Here, we are sure that "reserveResources" would succeed.
3055 ResourceTracker->reserveResources(nvjMI);
3056 CurrentPacketMIs.push_back(MI);
3057 CurrentPacketMIs.push_back(nvjMI);
3058 } else {
Jyotsna Vermaef94c6c2013-03-01 17:37:13 +00003059 if ( (QII->isExtended(MI) || QII->isConstExtended(MI))
Sirish Pande26f61a12012-05-03 21:52:53 +00003060 && ( !tryAllocateResourcesForConstExt(MI)
3061 || !ResourceTracker->canReserveResources(MI)))
3062 {
3063 endPacket(MBB, MI);
3064 // Check if the instruction was promoted to a dot-new. If so, demote it
3065 // back into a dot-old
3066 if (PromotedToDotNew) {
3067 DemoteToDotOld(MI);
3068 }
3069 reserveResourcesForConstExt(MI);
3070 }
3071 // In case that "MI" is not an extended insn,
3072 // the resource availability has already been checked.
3073 ResourceTracker->reserveResources(MI);
3074 CurrentPacketMIs.push_back(MI);
3075 }
3076 return MII;
3077}
3078
3079//===----------------------------------------------------------------------===//
3080// Public Constructor Functions
3081//===----------------------------------------------------------------------===//
3082
3083FunctionPass *llvm::createHexagonPacketizer() {
3084 return new HexagonPacketizer();
3085}
3086