blob: 2731278f0e41af767ae5b001b9ccc1e61a528e4e [file] [log] [blame]
Colin LeMahieuaf304e52015-02-19 19:00:00 +00001//===- HexagonMCInstrInfo.cpp - Hexagon sub-class of MCInst ---------------===//
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 class extends MCInstrInfo to allow Hexagon specific MCInstr queries
11//
12//===----------------------------------------------------------------------===//
13
Colin LeMahieub23c47b2015-05-31 21:57:09 +000014#include "HexagonMCInstrInfo.h"
15
Colin LeMahieu68d967d2015-05-29 14:44:13 +000016#include "Hexagon.h"
Colin LeMahieuaf304e52015-02-19 19:00:00 +000017#include "HexagonBaseInfo.h"
Colin LeMahieub23c47b2015-05-31 21:57:09 +000018
Colin LeMahieube8c4532015-06-05 16:00:11 +000019#include "llvm/MC/MCContext.h"
20#include "llvm/MC/MCInstrInfo.h"
Colin LeMahieub23c47b2015-05-31 21:57:09 +000021#include "llvm/MC/MCSubtargetInfo.h"
Colin LeMahieuaf304e52015-02-19 19:00:00 +000022
23namespace llvm {
Colin LeMahieu68d967d2015-05-29 14:44:13 +000024iterator_range<MCInst::const_iterator>
25HexagonMCInstrInfo::bundleInstructions(MCInst const &MCI) {
26 assert(isBundle(MCI));
27 return iterator_range<MCInst::const_iterator>(
28 MCI.begin() + bundleInstructionsOffset, MCI.end());
29}
30
31size_t HexagonMCInstrInfo::bundleSize(MCInst const &MCI) {
32 if (HexagonMCInstrInfo::isBundle(MCI))
33 return (MCI.size() - bundleInstructionsOffset);
34 else
35 return (1);
Colin LeMahieu1174fea2015-02-19 21:10:50 +000036}
37
Colin LeMahieube8c4532015-06-05 16:00:11 +000038MCInst *HexagonMCInstrInfo::deriveDuplex(MCContext &Context, unsigned iClass,
39 MCInst const &inst0,
40 MCInst const &inst1) {
41 assert((iClass <= 0xf) && "iClass must have range of 0 to 0xf");
42 MCInst *duplexInst = new (Context) MCInst;
43 duplexInst->setOpcode(Hexagon::DuplexIClass0 + iClass);
44
45 MCInst *SubInst0 = new (Context) MCInst(deriveSubInst(inst0));
46 MCInst *SubInst1 = new (Context) MCInst(deriveSubInst(inst1));
47 duplexInst->addOperand(MCOperand::createInst(SubInst0));
48 duplexInst->addOperand(MCOperand::createInst(SubInst1));
49 return duplexInst;
50}
51
52MCInst const *HexagonMCInstrInfo::extenderForIndex(MCInst const &MCB,
53 size_t Index) {
54 assert(Index <= bundleSize(MCB));
55 if (Index == 0)
56 return nullptr;
57 MCInst const *Inst =
58 MCB.getOperand(Index + bundleInstructionsOffset - 1).getInst();
59 if (isImmext(*Inst))
60 return Inst;
61 return nullptr;
62}
63
Colin LeMahieub6625652015-05-01 21:14:21 +000064HexagonII::MemAccessSize
65HexagonMCInstrInfo::getAccessSize(MCInstrInfo const &MCII, MCInst const &MCI) {
66 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
67
68 return (HexagonII::MemAccessSize((F >> HexagonII::MemAccessSizePos) &
69 HexagonII::MemAccesSizeMask));
70}
71
Colin LeMahieu745c4712015-02-19 19:49:27 +000072unsigned HexagonMCInstrInfo::getBitCount(MCInstrInfo const &MCII,
73 MCInst const &MCI) {
74 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
75 return ((F >> HexagonII::ExtentBitsPos) & HexagonII::ExtentBitsMask);
76}
77
Colin LeMahieu745c4712015-02-19 19:49:27 +000078// Return constant extended operand number.
79unsigned short HexagonMCInstrInfo::getCExtOpNum(MCInstrInfo const &MCII,
80 MCInst const &MCI) {
81 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
82 return ((F >> HexagonII::ExtendableOpPos) & HexagonII::ExtendableOpMask);
83}
84
Colin LeMahieu1174fea2015-02-19 21:10:50 +000085MCInstrDesc const &HexagonMCInstrInfo::getDesc(MCInstrInfo const &MCII,
86 MCInst const &MCI) {
87 return (MCII.get(MCI.getOpcode()));
88}
89
Colin LeMahieu86f218e2015-05-30 18:55:47 +000090unsigned short HexagonMCInstrInfo::getExtendableOp(MCInstrInfo const &MCII,
91 MCInst const &MCI) {
92 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
93 return ((F >> HexagonII::ExtendableOpPos) & HexagonII::ExtendableOpMask);
94}
95
96MCOperand const &
97HexagonMCInstrInfo::getExtendableOperand(MCInstrInfo const &MCII,
98 MCInst const &MCI) {
99 unsigned O = HexagonMCInstrInfo::getExtendableOp(MCII, MCI);
100 MCOperand const &MO = MCI.getOperand(O);
101
102 assert((HexagonMCInstrInfo::isExtendable(MCII, MCI) ||
103 HexagonMCInstrInfo::isExtended(MCII, MCI)) &&
104 (MO.isImm() || MO.isExpr()));
105 return (MO);
106}
107
Colin LeMahieub6625652015-05-01 21:14:21 +0000108unsigned HexagonMCInstrInfo::getExtentAlignment(MCInstrInfo const &MCII,
109 MCInst const &MCI) {
110 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
111 return ((F >> HexagonII::ExtentAlignPos) & HexagonII::ExtentAlignMask);
112}
113
114unsigned HexagonMCInstrInfo::getExtentBits(MCInstrInfo const &MCII,
115 MCInst const &MCI) {
116 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
117 return ((F >> HexagonII::ExtentBitsPos) & HexagonII::ExtentBitsMask);
118}
119
Colin LeMahieuaf304e52015-02-19 19:00:00 +0000120// Return the max value that a constant extendable operand can have
121// without being extended.
122int HexagonMCInstrInfo::getMaxValue(MCInstrInfo const &MCII,
123 MCInst const &MCI) {
Colin LeMahieu745c4712015-02-19 19:49:27 +0000124 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
Colin LeMahieuaf304e52015-02-19 19:00:00 +0000125 unsigned isSigned =
126 (F >> HexagonII::ExtentSignedPos) & HexagonII::ExtentSignedMask;
127 unsigned bits = (F >> HexagonII::ExtentBitsPos) & HexagonII::ExtentBitsMask;
128
129 if (isSigned) // if value is signed
130 return ~(-1U << (bits - 1));
131 else
132 return ~(-1U << bits);
133}
Colin LeMahieu745c4712015-02-19 19:49:27 +0000134
135// Return the min value that a constant extendable operand can have
136// without being extended.
137int HexagonMCInstrInfo::getMinValue(MCInstrInfo const &MCII,
138 MCInst const &MCI) {
139 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
140 unsigned isSigned =
141 (F >> HexagonII::ExtentSignedPos) & HexagonII::ExtentSignedMask;
142 unsigned bits = (F >> HexagonII::ExtentBitsPos) & HexagonII::ExtentBitsMask;
143
144 if (isSigned) // if value is signed
145 return -1U << (bits - 1);
146 else
147 return 0;
148}
149
Colin LeMahieub6625652015-05-01 21:14:21 +0000150char const *HexagonMCInstrInfo::getName(MCInstrInfo const &MCII,
151 MCInst const &MCI) {
152 return MCII.getName(MCI.getOpcode());
153}
154
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000155unsigned short HexagonMCInstrInfo::getNewValueOp(MCInstrInfo const &MCII,
Colin LeMahieu745c4712015-02-19 19:49:27 +0000156 MCInst const &MCI) {
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000157 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
158 return ((F >> HexagonII::NewValueOpPos) & HexagonII::NewValueOpMask);
159}
160
161MCOperand const &HexagonMCInstrInfo::getNewValueOperand(MCInstrInfo const &MCII,
162 MCInst const &MCI) {
Colin LeMahieu745c4712015-02-19 19:49:27 +0000163 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
164 unsigned const O =
165 (F >> HexagonII::NewValueOpPos) & HexagonII::NewValueOpMask;
166 MCOperand const &MCO = MCI.getOperand(O);
167
168 assert((HexagonMCInstrInfo::isNewValue(MCII, MCI) ||
169 HexagonMCInstrInfo::hasNewValue(MCII, MCI)) &&
170 MCO.isReg());
171 return (MCO);
172}
173
Colin LeMahieub23c47b2015-05-31 21:57:09 +0000174int HexagonMCInstrInfo::getSubTarget(MCInstrInfo const &MCII,
175 MCInst const &MCI) {
176 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
177
178 HexagonII::SubTarget Target = static_cast<HexagonII::SubTarget>(
179 (F >> HexagonII::validSubTargetPos) & HexagonII::validSubTargetMask);
180
181 switch (Target) {
182 default:
183 return Hexagon::ArchV4;
184 case HexagonII::HasV5SubT:
185 return Hexagon::ArchV5;
186 }
187}
188
Colin LeMahieu745c4712015-02-19 19:49:27 +0000189// Return the Hexagon ISA class for the insn.
190unsigned HexagonMCInstrInfo::getType(MCInstrInfo const &MCII,
191 MCInst const &MCI) {
192 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
193
194 return ((F >> HexagonII::TypePos) & HexagonII::TypeMask);
195}
196
Colin LeMahieub23c47b2015-05-31 21:57:09 +0000197unsigned HexagonMCInstrInfo::getUnits(MCInstrInfo const &MCII,
198 MCSubtargetInfo const &STI,
199 MCInst const &MCI) {
200
201 const InstrItinerary *II = STI.getSchedModel().InstrItineraries;
202 int SchedClass = HexagonMCInstrInfo::getDesc(MCII, MCI).getSchedClass();
203 return ((II[SchedClass].FirstStage + HexagonStages)->getUnits());
204}
205
206bool HexagonMCInstrInfo::hasImmExt(MCInst const &MCI) {
207 if (!HexagonMCInstrInfo::isBundle(MCI))
208 return false;
209
210 for (const auto &I : HexagonMCInstrInfo::bundleInstructions(MCI)) {
211 auto MI = I.getInst();
212 if (isImmext(*MI))
213 return true;
214 }
215
216 return false;
217}
218
Colin LeMahieube8c4532015-06-05 16:00:11 +0000219bool HexagonMCInstrInfo::hasExtenderForIndex(MCInst const &MCB, size_t Index) {
220 return extenderForIndex(MCB, Index) != nullptr;
221}
222
Colin LeMahieu745c4712015-02-19 19:49:27 +0000223// Return whether the instruction is a legal new-value producer.
224bool HexagonMCInstrInfo::hasNewValue(MCInstrInfo const &MCII,
225 MCInst const &MCI) {
226 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
227 return ((F >> HexagonII::hasNewValuePos) & HexagonII::hasNewValueMask);
228}
229
Colin LeMahieu86f218e2015-05-30 18:55:47 +0000230MCInst const &HexagonMCInstrInfo::instruction(MCInst const &MCB, size_t Index) {
231 assert(isBundle(MCB));
232 assert(Index < HEXAGON_PACKET_SIZE);
233 return *MCB.getOperand(bundleInstructionsOffset + Index).getInst();
234}
235
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000236bool HexagonMCInstrInfo::isBundle(MCInst const &MCI) {
237 auto Result = Hexagon::BUNDLE == MCI.getOpcode();
238 assert(!Result || (MCI.size() > 0 && MCI.getOperand(0).isImm()));
239 return Result;
240}
241
Colin LeMahieu745c4712015-02-19 19:49:27 +0000242// Return whether the insn is an actual insn.
243bool HexagonMCInstrInfo::isCanon(MCInstrInfo const &MCII, MCInst const &MCI) {
244 return (!HexagonMCInstrInfo::getDesc(MCII, MCI).isPseudo() &&
245 !HexagonMCInstrInfo::isPrefix(MCII, MCI) &&
246 HexagonMCInstrInfo::getType(MCII, MCI) != HexagonII::TypeENDLOOP);
247}
248
Colin LeMahieube8c4532015-06-05 16:00:11 +0000249bool HexagonMCInstrInfo::isDblRegForSubInst(unsigned Reg) {
250 return ((Reg >= Hexagon::D0 && Reg <= Hexagon::D3) ||
251 (Reg >= Hexagon::D8 && Reg <= Hexagon::D11));
252}
253
254bool HexagonMCInstrInfo::isDuplex(MCInstrInfo const &MCII, MCInst const &MCI) {
255 return HexagonII::TypeDUPLEX == HexagonMCInstrInfo::getType(MCII, MCI);
256}
257
Colin LeMahieu745c4712015-02-19 19:49:27 +0000258// Return whether the instruction needs to be constant extended.
259// 1) Always return true if the instruction has 'isExtended' flag set.
260//
261// isExtendable:
262// 2) For immediate extended operands, return true only if the value is
263// out-of-range.
264// 3) For global address, always return true.
265
266bool HexagonMCInstrInfo::isConstExtended(MCInstrInfo const &MCII,
267 MCInst const &MCI) {
268 if (HexagonMCInstrInfo::isExtended(MCII, MCI))
269 return true;
270
271 if (!HexagonMCInstrInfo::isExtendable(MCII, MCI))
272 return false;
273
274 short ExtOpNum = HexagonMCInstrInfo::getCExtOpNum(MCII, MCI);
275 int MinValue = HexagonMCInstrInfo::getMinValue(MCII, MCI);
276 int MaxValue = HexagonMCInstrInfo::getMaxValue(MCII, MCI);
277 MCOperand const &MO = MCI.getOperand(ExtOpNum);
278
279 // We could be using an instruction with an extendable immediate and shoehorn
280 // a global address into it. If it is a global address it will be constant
281 // extended. We do this for COMBINE.
282 // We currently only handle isGlobal() because it is the only kind of
283 // object we are going to end up with here for now.
284 // In the future we probably should add isSymbol(), etc.
285 if (MO.isExpr())
286 return true;
287
288 // If the extendable operand is not 'Immediate' type, the instruction should
289 // have 'isExtended' flag set.
290 assert(MO.isImm() && "Extendable operand must be Immediate type");
291
292 int ImmValue = MO.getImm();
293 return (ImmValue < MinValue || ImmValue > MaxValue);
294}
295
Colin LeMahieu745c4712015-02-19 19:49:27 +0000296bool HexagonMCInstrInfo::isExtendable(MCInstrInfo const &MCII,
297 MCInst const &MCI) {
298 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
299 return (F >> HexagonII::ExtendablePos) & HexagonII::ExtendableMask;
300}
301
Colin LeMahieu745c4712015-02-19 19:49:27 +0000302bool HexagonMCInstrInfo::isExtended(MCInstrInfo const &MCII,
303 MCInst const &MCI) {
304 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
305 return (F >> HexagonII::ExtendedPos) & HexagonII::ExtendedMask;
306}
307
Colin LeMahieub23c47b2015-05-31 21:57:09 +0000308bool HexagonMCInstrInfo::isFloat(MCInstrInfo const &MCII, MCInst const &MCI) {
309 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
310 return ((F >> HexagonII::FPPos) & HexagonII::FPMask);
311}
312
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000313bool HexagonMCInstrInfo::isImmext(MCInst const &MCI) {
314 auto Op = MCI.getOpcode();
315 return (Op == Hexagon::A4_ext_b || Op == Hexagon::A4_ext_c ||
316 Op == Hexagon::A4_ext_g || Op == Hexagon::A4_ext);
317}
318
319bool HexagonMCInstrInfo::isInnerLoop(MCInst const &MCI) {
320 assert(isBundle(MCI));
321 int64_t Flags = MCI.getOperand(0).getImm();
322 return (Flags & innerLoopMask) != 0;
323}
324
Colin LeMahieube8c4532015-06-05 16:00:11 +0000325bool HexagonMCInstrInfo::isIntReg(unsigned Reg) {
326 return (Reg >= Hexagon::R0 && Reg <= Hexagon::R31);
327}
328
329bool HexagonMCInstrInfo::isIntRegForSubInst(unsigned Reg) {
330 return ((Reg >= Hexagon::R0 && Reg <= Hexagon::R7) ||
331 (Reg >= Hexagon::R16 && Reg <= Hexagon::R23));
332}
333
Colin LeMahieu745c4712015-02-19 19:49:27 +0000334// Return whether the insn is a new-value consumer.
335bool HexagonMCInstrInfo::isNewValue(MCInstrInfo const &MCII,
336 MCInst const &MCI) {
337 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
338 return ((F >> HexagonII::NewValuePos) & HexagonII::NewValueMask);
339}
340
341// Return whether the operand can be constant extended.
342bool HexagonMCInstrInfo::isOperandExtended(MCInstrInfo const &MCII,
343 MCInst const &MCI,
344 unsigned short OperandNum) {
345 uint64_t const F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
346 return ((F >> HexagonII::ExtendableOpPos) & HexagonII::ExtendableOpMask) ==
347 OperandNum;
348}
349
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000350bool HexagonMCInstrInfo::isOuterLoop(MCInst const &MCI) {
351 assert(isBundle(MCI));
352 int64_t Flags = MCI.getOperand(0).getImm();
353 return (Flags & outerLoopMask) != 0;
Colin LeMahieu1174fea2015-02-19 21:10:50 +0000354}
355
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000356bool HexagonMCInstrInfo::isPredicated(MCInstrInfo const &MCII,
357 MCInst const &MCI) {
358 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
359 return ((F >> HexagonII::PredicatedPos) & HexagonII::PredicatedMask);
360}
361
362bool HexagonMCInstrInfo::isPredicatedTrue(MCInstrInfo const &MCII,
363 MCInst const &MCI) {
364 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
365 return (
366 !((F >> HexagonII::PredicatedFalsePos) & HexagonII::PredicatedFalseMask));
Colin LeMahieu1174fea2015-02-19 21:10:50 +0000367}
368
Colin LeMahieube8c4532015-06-05 16:00:11 +0000369bool HexagonMCInstrInfo::isPredReg(unsigned Reg) {
370 return (Reg >= Hexagon::P0 && Reg <= Hexagon::P3_0);
371}
372
Colin LeMahieu745c4712015-02-19 19:49:27 +0000373bool HexagonMCInstrInfo::isPrefix(MCInstrInfo const &MCII, MCInst const &MCI) {
374 return (HexagonMCInstrInfo::getType(MCII, MCI) == HexagonII::TypePREFIX);
375}
376
Colin LeMahieu745c4712015-02-19 19:49:27 +0000377bool HexagonMCInstrInfo::isSolo(MCInstrInfo const &MCII, MCInst const &MCI) {
378 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
379 return ((F >> HexagonII::SoloPos) & HexagonII::SoloMask);
380}
Colin LeMahieu1174fea2015-02-19 21:10:50 +0000381
Colin LeMahieub23c47b2015-05-31 21:57:09 +0000382bool HexagonMCInstrInfo::isSoloAX(MCInstrInfo const &MCII, MCInst const &MCI) {
383 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
384 return ((F >> HexagonII::SoloAXPos) & HexagonII::SoloAXMask);
385}
386
387bool HexagonMCInstrInfo::isSoloAin1(MCInstrInfo const &MCII,
388 MCInst const &MCI) {
389 const uint64_t F = HexagonMCInstrInfo::getDesc(MCII, MCI).TSFlags;
390 return ((F >> HexagonII::SoloAin1Pos) & HexagonII::SoloAin1Mask);
391}
392
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000393void HexagonMCInstrInfo::padEndloop(MCInst &MCB) {
394 MCInst Nop;
395 Nop.setOpcode(Hexagon::A2_nop);
396 assert(isBundle(MCB));
397 while ((HexagonMCInstrInfo::isInnerLoop(MCB) &&
398 (HexagonMCInstrInfo::bundleSize(MCB) < HEXAGON_PACKET_INNER_SIZE)) ||
399 ((HexagonMCInstrInfo::isOuterLoop(MCB) &&
400 (HexagonMCInstrInfo::bundleSize(MCB) < HEXAGON_PACKET_OUTER_SIZE))))
401 MCB.addOperand(MCOperand::createInst(new MCInst(Nop)));
Colin LeMahieu1174fea2015-02-19 21:10:50 +0000402}
403
Colin LeMahieub23c47b2015-05-31 21:57:09 +0000404bool HexagonMCInstrInfo::prefersSlot3(MCInstrInfo const &MCII,
405 MCInst const &MCI) {
406 if (HexagonMCInstrInfo::getType(MCII, MCI) == HexagonII::TypeCR)
407 return false;
408
409 unsigned SchedClass = HexagonMCInstrInfo::getDesc(MCII, MCI).getSchedClass();
410 switch (SchedClass) {
411 case Hexagon::Sched::ALU32_3op_tc_2_SLOT0123:
412 case Hexagon::Sched::ALU64_tc_2_SLOT23:
413 case Hexagon::Sched::ALU64_tc_3x_SLOT23:
414 case Hexagon::Sched::M_tc_2_SLOT23:
415 case Hexagon::Sched::M_tc_3x_SLOT23:
416 case Hexagon::Sched::S_2op_tc_2_SLOT23:
417 case Hexagon::Sched::S_3op_tc_2_SLOT23:
418 case Hexagon::Sched::S_3op_tc_3x_SLOT23:
419 return true;
420 }
421 return false;
422}
423
Colin LeMahieube8c4532015-06-05 16:00:11 +0000424void HexagonMCInstrInfo::replaceDuplex(MCContext &Context, MCInst &MCB,
425 DuplexCandidate Candidate) {
426 assert(Candidate.packetIndexI < MCB.size());
427 assert(Candidate.packetIndexJ < MCB.size());
428 assert(isBundle(MCB));
429 MCInst *Duplex =
430 deriveDuplex(Context, Candidate.iClass,
431 *MCB.getOperand(Candidate.packetIndexJ).getInst(),
432 *MCB.getOperand(Candidate.packetIndexI).getInst());
433 assert(Duplex != nullptr);
434 MCB.getOperand(Candidate.packetIndexI).setInst(Duplex);
435 MCB.erase(MCB.begin() + Candidate.packetIndexJ);
436}
437
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000438void HexagonMCInstrInfo::setInnerLoop(MCInst &MCI) {
439 assert(isBundle(MCI));
440 MCOperand &Operand = MCI.getOperand(0);
441 Operand.setImm(Operand.getImm() | innerLoopMask);
Colin LeMahieu1174fea2015-02-19 21:10:50 +0000442}
443
Colin LeMahieu68d967d2015-05-29 14:44:13 +0000444void HexagonMCInstrInfo::setOuterLoop(MCInst &MCI) {
445 assert(isBundle(MCI));
446 MCOperand &Operand = MCI.getOperand(0);
447 Operand.setImm(Operand.getImm() | outerLoopMask);
Colin LeMahieu1174fea2015-02-19 21:10:50 +0000448}
Colin LeMahieuaf304e52015-02-19 19:00:00 +0000449}