LLVM  5.0.0
HexagonShuffler.cpp
Go to the documentation of this file.
1 //===----- HexagonShuffler.cpp - Instruction bundle shuffling -------------===//
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 the shuffling of insns inside a bundle according to the
11 // packet formation rules of the Hexagon ISA.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #define DEBUG_TYPE "hexagon-shuffle"
16 
17 #include "HexagonShuffler.h"
18 #include "Hexagon.h"
22 #include "llvm/MC/MCContext.h"
23 #include "llvm/Support/Debug.h"
24 #include "llvm/Support/Format.h"
27 #include <algorithm>
28 #include <utility>
29 
30 using namespace llvm;
31 
32 namespace {
33 // Insn shuffling priority.
34 class HexagonBid {
35  // The priority is directly proportional to how restricted the insn is based
36  // on its flexibility to run on the available slots. So, the fewer slots it
37  // may run on, the higher its priority.
38  enum { MAX = 360360 }; // LCD of 1/2, 1/3, 1/4,... 1/15.
39  unsigned Bid;
40 
41 public:
42  HexagonBid() : Bid(0) {}
43  HexagonBid(unsigned B) { Bid = B ? MAX / countPopulation(B) : 0; }
44 
45  // Check if the insn priority is overflowed.
46  bool isSold() const { return (Bid >= MAX); }
47 
48  HexagonBid &operator+=(const HexagonBid &B) {
49  Bid += B.Bid;
50  return *this;
51  }
52 };
53 
54 // Slot shuffling allocation.
55 class HexagonUnitAuction {
56  HexagonBid Scores[HEXAGON_PACKET_SIZE];
57  // Mask indicating which slot is unavailable.
58  unsigned isSold : HEXAGON_PACKET_SIZE;
59 
60 public:
61  HexagonUnitAuction(unsigned cs = 0) : isSold(cs){};
62 
63  // Allocate slots.
64  bool bid(unsigned B) {
65  // Exclude already auctioned slots from the bid.
66  unsigned b = B & ~isSold;
67  if (b) {
68  for (unsigned i = 0; i < HEXAGON_PACKET_SIZE; ++i)
69  if (b & (1 << i)) {
70  // Request candidate slots.
71  Scores[i] += HexagonBid(b);
72  isSold |= Scores[i].isSold() << i;
73  }
74  return true;
75  } else
76  // Error if the desired slots are already full.
77  return false;
78  }
79 };
80 } // end anonymous namespace
81 
82 unsigned HexagonResource::setWeight(unsigned s) {
83  const unsigned SlotWeight = 8;
84  const unsigned MaskWeight = SlotWeight - 1;
85  unsigned Units = getUnits();
86  unsigned Key = ((1u << s) & Units) != 0;
87 
88  // Calculate relative weight of the insn for the given slot, weighing it the
89  // heavier the more restrictive the insn is and the lowest the slots that the
90  // insn may be executed in.
91  if (Key == 0 || Units == 0 || (SlotWeight * s >= 32))
92  return Weight = 0;
93 
94  unsigned Ctpop = countPopulation(Units);
95  unsigned Cttz = countTrailingZeros(Units);
96  Weight = (1u << (SlotWeight * s)) * ((MaskWeight - Ctpop) << Cttz);
97  return Weight;
98 }
99 
101  (*TUL)[HexagonII::TypeCVI_VA] =
102  UnitsAndLanes(CVI_XLANE | CVI_SHIFT | CVI_MPY0 | CVI_MPY1, 1);
103  (*TUL)[HexagonII::TypeCVI_VA_DV] = UnitsAndLanes(CVI_XLANE | CVI_MPY0, 2);
104  (*TUL)[HexagonII::TypeCVI_VX] = UnitsAndLanes(CVI_MPY0 | CVI_MPY1, 1);
105  (*TUL)[HexagonII::TypeCVI_VX_LATE] = UnitsAndLanes(CVI_MPY0 | CVI_MPY1, 1);
106  (*TUL)[HexagonII::TypeCVI_VX_DV] = UnitsAndLanes(CVI_MPY0, 2);
107  (*TUL)[HexagonII::TypeCVI_VP] = UnitsAndLanes(CVI_XLANE, 1);
108  (*TUL)[HexagonII::TypeCVI_VP_VS] = UnitsAndLanes(CVI_XLANE, 2);
109  (*TUL)[HexagonII::TypeCVI_VS] = UnitsAndLanes(CVI_SHIFT, 1);
111  (CPU == "hexagonv60")
112  ? UnitsAndLanes(CVI_SHIFT, 1)
113  : UnitsAndLanes(CVI_XLANE | CVI_SHIFT | CVI_MPY0 | CVI_MPY1, 1);
114  (*TUL)[HexagonII::TypeCVI_VM_LD] =
115  UnitsAndLanes(CVI_XLANE | CVI_SHIFT | CVI_MPY0 | CVI_MPY1, 1);
116  (*TUL)[HexagonII::TypeCVI_VM_TMP_LD] = UnitsAndLanes(CVI_NONE, 0);
117  (*TUL)[HexagonII::TypeCVI_VM_VP_LDU] = UnitsAndLanes(CVI_XLANE, 1);
118  (*TUL)[HexagonII::TypeCVI_VM_ST] =
119  UnitsAndLanes(CVI_XLANE | CVI_SHIFT | CVI_MPY0 | CVI_MPY1, 1);
120  (*TUL)[HexagonII::TypeCVI_VM_NEW_ST] = UnitsAndLanes(CVI_NONE, 0);
121  (*TUL)[HexagonII::TypeCVI_VM_STU] = UnitsAndLanes(CVI_XLANE, 1);
122  (*TUL)[HexagonII::TypeCVI_HIST] = UnitsAndLanes(CVI_XLANE, 4);
123 }
124 
126  MCInstrInfo const &MCII, unsigned s,
127  MCInst const *id)
128  : HexagonResource(s), TUL(TUL) {
129  unsigned T = HexagonMCInstrInfo::getType(MCII, *id);
130 
131  if (TUL->count(T)) {
132  // For an HVX insn.
133  Valid = true;
134  setUnits((*TUL)[T].first);
135  setLanes((*TUL)[T].second);
136  setLoad(HexagonMCInstrInfo::getDesc(MCII, *id).mayLoad());
137  setStore(HexagonMCInstrInfo::getDesc(MCII, *id).mayStore());
138  } else {
139  // For core insns.
140  Valid = false;
141  setUnits(0);
142  setLanes(0);
143  setLoad(false);
144  setStore(false);
145  }
146 }
147 
148 struct CVIUnits {
149  unsigned Units;
150  unsigned Lanes;
151 };
153 
154 static unsigned makeAllBits(unsigned startBit, unsigned Lanes)
155 
156 {
157  for (unsigned i = 1; i < Lanes; ++i)
158  startBit = (startBit << 1) | startBit;
159  return startBit;
160 }
161 
162 static bool checkHVXPipes(const HVXInstsT &hvxInsts, unsigned startIdx,
163  unsigned usedUnits)
164 
165 {
166  if (startIdx < hvxInsts.size()) {
167  if (!hvxInsts[startIdx].Units)
168  return checkHVXPipes(hvxInsts, startIdx + 1, usedUnits);
169  for (unsigned b = 0x1; b <= 0x8; b <<= 1) {
170  if ((hvxInsts[startIdx].Units & b) == 0)
171  continue;
172  unsigned allBits = makeAllBits(b, hvxInsts[startIdx].Lanes);
173  if ((allBits & usedUnits) == 0) {
174  if (checkHVXPipes(hvxInsts, startIdx + 1, usedUnits | allBits))
175  return true;
176  }
177  }
178  return false;
179  }
180  return true;
181 }
182 
184  MCInstrInfo const &MCII,
185  MCSubtargetInfo const &STI)
186  : Context(Context), MCII(MCII), STI(STI), ReportErrors(ReportErrors) {
187  reset();
189 }
190 
192  Packet.clear();
193  BundleFlags = 0;
194 }
195 
196 void HexagonShuffler::append(MCInst const &ID, MCInst const *Extender,
197  unsigned S) {
198  HexagonInstr PI(&TUL, MCII, &ID, Extender, S);
199 
200  Packet.push_back(PI);
201 }
202 
203 static struct {
204  unsigned first;
205  unsigned second;
206 } jumpSlots[] = {{8, 4}, {8, 2}, {8, 1}, {4, 2}, {4, 1}, {2, 1}};
207 #define MAX_JUMP_SLOTS (sizeof(jumpSlots) / sizeof(jumpSlots[0]))
208 
209 /// Check that the packet is legal and enforce relative insn order.
211  // Descriptive slot masks.
212  const unsigned slotSingleLoad = 0x1, slotSingleStore = 0x1, slotOne = 0x2,
213  slotThree = 0x8, // slotFirstJump = 0x8,
214  slotFirstLoadStore = 0x2, slotLastLoadStore = 0x1;
215  // Highest slots for branches and stores used to keep their original order.
216  // unsigned slotJump = slotFirstJump;
217  unsigned slotLoadStore = slotFirstLoadStore;
218  // Number of branches, solo branches, indirect branches.
219  unsigned jumps = 0, jump1 = 0;
220  // Number of memory operations, loads, solo loads, stores, solo stores, single
221  // stores.
222  unsigned memory = 0, loads = 0, load0 = 0, stores = 0, store0 = 0, store1 = 0;
223  // Number of duplex insns
224  unsigned duplex = 0;
225  // Number of insns restricting other insns in slot #1 to A type.
226  unsigned onlyAin1 = 0;
227  // Number of insns restricting any insn in slot #1, except A2_nop.
228  unsigned onlyNo1 = 0;
229  unsigned pSlot3Cnt = 0;
230  unsigned nvstores = 0;
231  unsigned memops = 0;
232  unsigned deallocs = 0;
233  iterator slot3ISJ = end();
234  std::vector<iterator> foundBranches;
235  unsigned reservedSlots = 0;
236 
237  // Collect information from the insns in the packet.
238  for (iterator ISJ = begin(); ISJ != end(); ++ISJ) {
239  MCInst const &ID = ISJ->getDesc();
240 
242  ++onlyAin1;
244  ++pSlot3Cnt;
245  slot3ISJ = ISJ;
246  }
247  reservedSlots |= HexagonMCInstrInfo::getOtherReservedSlots(MCII, STI, ID);
249  ++jump1;
250 
251  switch (HexagonMCInstrInfo::getType(MCII, ID)) {
255  break;
256  case HexagonII::TypeJ:
257  ++jumps;
258  foundBranches.push_back(ISJ);
259  break;
261  ++onlyNo1;
265  case HexagonII::TypeLD:
266  ++loads;
267  ++memory;
268  if (ISJ->Core.getUnits() == slotSingleLoad ||
270  ++load0;
272  ++deallocs, ++jumps, ++jump1; // DEALLOC_RETURN is of type LD.
273  foundBranches.push_back(ISJ);
274  }
275  break;
277  ++onlyNo1;
281  case HexagonII::TypeST:
282  ++stores;
283  ++memory;
284  if (ISJ->Core.getUnits() == slotSingleStore ||
286  ++store0;
287  break;
289  ++loads;
290  ++stores;
291  ++store1;
292  ++memops;
293  ++memory;
294  break;
295  case HexagonII::TypeNCJ:
296  ++memory; // NV insns are memory-like.
297  ++jumps, ++jump1;
298  foundBranches.push_back(ISJ);
299  break;
301  if (HexagonMCInstrInfo::getDesc(MCII, ID).mayLoad()) {
302  ++loads;
303  ++memory;
304  if (ISJ->Core.getUnits() == slotSingleLoad ||
307  ++load0;
308  } else {
309  assert(HexagonMCInstrInfo::getDesc(MCII, ID).mayStore());
310  ++memory;
311  ++stores;
313  ++nvstores;
314  }
315  break;
316  case HexagonII::TypeCR:
317  // Legacy conditional branch predicated on a register.
318  case HexagonII::TypeCJ:
320  ++jumps;
321  foundBranches.push_back(ISJ);
322  }
323  break;
324  case HexagonII::TypeDUPLEX: {
325  ++duplex;
326  MCInst const &Inst0 = *ID.getOperand(0).getInst();
327  MCInst const &Inst1 = *ID.getOperand(1).getInst();
329  ++jump1;
331  ++jump1;
332  if (HexagonMCInstrInfo::getDesc(MCII, Inst0).isBranch()) {
333  ++jumps;
334  foundBranches.push_back(ISJ);
335  }
336  if (HexagonMCInstrInfo::getDesc(MCII, Inst1).isBranch()) {
337  ++jumps;
338  foundBranches.push_back(ISJ);
339  }
340  if (HexagonMCInstrInfo::getDesc(MCII, Inst0).isReturn()) {
341  ++deallocs, ++jumps, ++jump1; // DEALLOC_RETURN is of type LD.
342  foundBranches.push_back(ISJ);
343  }
344  if (HexagonMCInstrInfo::getDesc(MCII, Inst1).isReturn()) {
345  ++deallocs, ++jumps, ++jump1; // DEALLOC_RETURN is of type LD.
346  foundBranches.push_back(ISJ);
347  }
348  break;
349  }
350  }
351  }
352 
353  // Check if the packet is legal.
354  if ((load0 > 1 || store0 > 1) ||
355  (duplex > 1 || (duplex && memory))) {
356  reportError(llvm::Twine("invalid instruction packet"));
357  return false;
358  }
359 
360  if (jump1 && jumps > 1) {
361  // Error if single branch with another branch.
362  reportError(llvm::Twine("too many branches in packet"));
363  return false;
364  }
365  if ((nvstores || memops) && stores > 1) {
366  reportError(llvm::Twine("slot 0 instruction does not allow slot 1 store"));
367  return false;
368  }
369  if (deallocs && stores) {
370  reportError(llvm::Twine("slot 0 instruction does not allow slot 1 store"));
371  return false;
372  }
373 
374  // Modify packet accordingly.
375  // TODO: need to reserve slots #0 and #1 for duplex insns.
376  bool bOnlySlot3 = false;
377  for (iterator ISJ = begin(); ISJ != end(); ++ISJ) {
378  MCInst const &ID = ISJ->getDesc();
379 
380  if (!ISJ->Core.getUnits()) {
381  // Error if insn may not be executed in any slot.
382  return false;
383  }
384 
385  // Exclude from slot #1 any insn but A2_nop.
386  if (HexagonMCInstrInfo::getDesc(MCII, ID).getOpcode() != Hexagon::A2_nop)
387  if (onlyNo1)
388  ISJ->Core.setUnits(ISJ->Core.getUnits() & ~slotOne);
389 
390  // Exclude from slot #1 any insn but A-type.
394  if (onlyAin1)
395  ISJ->Core.setUnits(ISJ->Core.getUnits() & ~slotOne);
396 
397  // A single load must use slot #0.
399  if (loads == 1 && loads == memory && memops == 0)
400  // Pin the load to slot #0.
401  ISJ->Core.setUnits(ISJ->Core.getUnits() & slotSingleLoad);
402  }
403 
404  // A single store must use slot #0.
406  if (!store0) {
407  if (stores == 1)
408  ISJ->Core.setUnits(ISJ->Core.getUnits() & slotSingleStore);
409  else if (stores > 1) {
410  if (slotLoadStore < slotLastLoadStore) {
411  // Error if no more slots available for stores.
412  reportError(
413  llvm::Twine("invalid instruction packet: too many stores"));
414  return false;
415  }
416  // Pin the store to the highest slot available to it.
417  ISJ->Core.setUnits(ISJ->Core.getUnits() & slotLoadStore);
418  // Update the next highest slot available to stores.
419  slotLoadStore >>= 1;
420  }
421  }
422  if (store1 && stores > 1) {
423  // Error if a single store with another store.
424  reportError(llvm::Twine("invalid instruction packet: too many stores"));
425  return false;
426  }
427  }
428 
429  // flag if an instruction requires to be in slot 3
430  if (ISJ->Core.getUnits() == slotThree)
431  bOnlySlot3 = true;
432 
433  if (!ISJ->Core.getUnits()) {
434  // Error if insn may not be executed in any slot.
435  reportError(llvm::Twine("invalid instruction packet: out of slots"));
436  return false;
437  }
438  }
439 
440  // preserve branch order
441  bool validateSlots = true;
442  if (jumps > 1) {
443  if (foundBranches.size() > 2) {
444  reportError(llvm::Twine("too many branches in packet"));
445  return false;
446  }
447 
448  // try all possible choices
449  for (unsigned int i = 0; i < MAX_JUMP_SLOTS; ++i) {
450  // validate first jump with this slot rule
451  if (!(jumpSlots[i].first & foundBranches[0]->Core.getUnits()))
452  continue;
453 
454  // validate second jump with this slot rule
455  if (!(jumpSlots[i].second & foundBranches[1]->Core.getUnits()))
456  continue;
457 
458  // both valid for this configuration, set new slot rules
459  PacketSave = Packet;
460  foundBranches[0]->Core.setUnits(jumpSlots[i].first);
461  foundBranches[1]->Core.setUnits(jumpSlots[i].second);
462 
463  HexagonUnitAuction AuctionCore(reservedSlots);
465 
466  // see if things ok with that instruction being pinned to slot "slotJump"
467  bool bFail = false;
468  for (iterator I = begin(); I != end() && bFail != true; ++I)
469  if (!AuctionCore.bid(I->Core.getUnits()))
470  bFail = true;
471 
472  // if yes, great, if not then restore original slot mask
473  if (!bFail) {
474  validateSlots = false; // all good, no need to re-do auction
475  break;
476  } else
477  // restore original values
478  Packet = PacketSave;
479  }
480  if (validateSlots == true) {
481  reportError(llvm::Twine("invalid instruction packet: out of slots"));
482  return false;
483  }
484  }
485 
486  if (jumps <= 1 && bOnlySlot3 == false && pSlot3Cnt == 1 &&
487  slot3ISJ != end()) {
488  validateSlots = true;
489  // save off slot mask of instruction marked with A_PREFER_SLOT3
490  // and then pin it to slot #3
491  unsigned saveUnits = slot3ISJ->Core.getUnits();
492  slot3ISJ->Core.setUnits(saveUnits & slotThree);
493 
494  HexagonUnitAuction AuctionCore(reservedSlots);
496 
497  // see if things ok with that instruction being pinned to slot #3
498  bool bFail = false;
499  for (iterator I = begin(); I != end() && bFail != true; ++I)
500  if (!AuctionCore.bid(I->Core.getUnits()))
501  bFail = true;
502 
503  // if yes, great, if not then restore original slot mask
504  if (!bFail)
505  validateSlots = false; // all good, no need to re-do auction
506  else
507  for (iterator ISJ = begin(); ISJ != end(); ++ISJ) {
508  MCInst const &ID = ISJ->getDesc();
510  ISJ->Core.setUnits(saveUnits);
511  }
512  }
513 
514  // Check if any slot, core or CVI, is over-subscribed.
515  // Verify the core slot subscriptions.
516  if (validateSlots) {
517  HexagonUnitAuction AuctionCore(reservedSlots);
518 
520 
521  for (iterator I = begin(); I != end(); ++I)
522  if (!AuctionCore.bid(I->Core.getUnits())) {
523  reportError(llvm::Twine("invalid instruction packet: slot error"));
524  return false;
525  }
526  }
527  // Verify the CVI slot subscriptions.
529  // create vector of hvx instructions to check
530  HVXInstsT hvxInsts;
531  hvxInsts.clear();
532  for (iterator I = begin(); I != end(); ++I) {
533  struct CVIUnits inst;
534  inst.Units = I->CVI.getUnits();
535  inst.Lanes = I->CVI.getLanes();
536  if (inst.Units == 0)
537  continue; // not an hvx inst or an hvx inst that doesn't uses any pipes
538  hvxInsts.push_back(inst);
539  }
540  // if there are any hvx instructions in this packet, check pipe usage
541  if (hvxInsts.size() > 0) {
542  unsigned startIdx, usedUnits;
543  startIdx = usedUnits = 0x0;
544  if (checkHVXPipes(hvxInsts, startIdx, usedUnits) == false) {
545  // too many pipes used to be valid
546  reportError(llvm::Twine("invalid instruction packet: slot error"));
547  return false;
548  }
549  }
550 
551  return true;
552 }
553 
555  if (size() > HEXAGON_PACKET_SIZE) {
556  // Ignore a packet with with more than what a packet can hold
557  // or with compound or duplex insns for now.
558  reportError(llvm::Twine("invalid instruction packet"));
559  return false;
560  }
561 
562  // Check and prepare packet.
563  bool Ok = true;
564  if (size() > 1 && (Ok = check()))
565  // Reorder the handles for each slot.
566  for (unsigned nSlot = 0, emptySlots = 0; nSlot < HEXAGON_PACKET_SIZE;
567  ++nSlot) {
568  iterator ISJ, ISK;
569  unsigned slotSkip, slotWeight;
570 
571  // Prioritize the handles considering their restrictions.
572  for (ISJ = ISK = Packet.begin(), slotSkip = slotWeight = 0;
573  ISK != Packet.end(); ++ISK, ++slotSkip)
574  if (slotSkip < nSlot - emptySlots)
575  // Note which handle to begin at.
576  ++ISJ;
577  else
578  // Calculate the weight of the slot.
579  slotWeight += ISK->Core.setWeight(HEXAGON_PACKET_SIZE - nSlot - 1);
580 
581  if (slotWeight)
582  // Sort the packet, favoring source order,
583  // beginning after the previous slot.
584  std::sort(ISJ, Packet.end());
585  else
586  // Skip unused slot.
587  ++emptySlots;
588  }
589 
590  for (iterator ISJ = begin(); ISJ != end(); ++ISJ)
591  DEBUG(dbgs().write_hex(ISJ->Core.getUnits()); if (ISJ->CVI.isValid()) {
592  dbgs() << '/';
593  dbgs().write_hex(ISJ->CVI.getUnits()) << '|';
594  dbgs() << ISJ->CVI.getLanes();
595  } dbgs() << ':'
596  << HexagonMCInstrInfo::getDesc(MCII, ISJ->getDesc()).getOpcode();
597  dbgs() << '\n');
598  DEBUG(dbgs() << '\n');
599 
600  return Ok;
601 }
602 
604  if (ReportErrors)
605  Context.reportError(Loc, Msg);
606 }
bool isSoloAin1(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn can be packaged only with an A-type insn in slot #1.
std::string & operator+=(std::string &buffer, StringRef string)
Definition: StringRef.h:899
void push_back(const T &Elt)
Definition: SmallVector.h:211
static bool lessCore(const HexagonInstr &A, const HexagonInstr &B)
#define MAX_JUMP_SLOTS
void setUnits(unsigned s)
LLVMContext & Context
unsigned getOtherReservedSlots(MCInstrInfo const &MCII, MCSubtargetInfo const &STI, MCInst const &MCI)
Return the slots this instruction consumes in addition to the slot(s) it can execute out of...
bool isReturn() const
Return true if the instruction is a return.
Definition: MCInstrDesc.h:245
bool mayStore() const
Return true if this instruction could possibly modify memory.
Definition: MCInstrDesc.h:393
void append(MCInst const &ID, MCInst const *Extender, unsigned S)
unsigned second
unsigned setWeight(unsigned s)
static struct @366 jumpSlots[]
bool isNewValue(MCInstrInfo const &MCII, MCInst const &MCI)
Return whether the insn expects newly produced value.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
#define HEXAGON_PACKET_SIZE
Definition: Hexagon.h:33
bool isCofMax1(MCInstrInfo const &MCII, MCInst const &MCI)
StringRef getCPU() const
getCPU - Return the CPU string.
Context object for machine code objects.
Definition: MCContext.h:59
unsigned getUnits() const
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
void reportError(llvm::Twine const &Msg)
Instances of this class represent a single low-level machine instruction.
Definition: MCInst.h:159
HexagonCVIResource(TypeUnitsAndLanes *TUL, MCInstrInfo const &MCII, unsigned s, MCInst const *id)
std::size_t countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
Definition: MathExtras.h:112
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
Definition: SmallVector.h:115
MCSubtargetInfo const & STI
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:24
unsigned size() const
void reportError(SMLoc L, const Twine &Msg)
Definition: MCContext.cpp:608
SmallVector< struct CVIUnits, 8 > HVXInstsT
bool prefersSlot3(MCInstrInfo const &MCII, MCInst const &MCI)
static unsigned makeAllBits(unsigned startBit, unsigned Lanes)
unsigned Units
unsigned first
unsigned getOpcode() const
Return the opcode number for this descriptor.
Definition: MCInstrDesc.h:203
HexagonPacket::iterator iterator
unsigned countPopulation(T Value)
Count the number of set bits in a value.
Definition: MathExtras.h:512
#define B
Definition: LargeTest.cpp:24
MCInstrInfo const & MCII
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
bool mayLoad() const
Return true if this instruction could possibly read memory.
Definition: MCInstrDesc.h:387
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Definition: DenseMap.h:126
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
Definition: SmallVector.h:119
HexagonShuffler(MCContext &Context, bool ReportErrors, MCInstrInfo const &MCII, MCSubtargetInfo const &STI)
#define I(x, y, z)
Definition: MD5.cpp:58
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
Definition: SmallVector.h:135
MCSubtargetInfo - Generic base class for all target subtargets.
const MCInst * getInst() const
Definition: MCInst.h:106
MCInstrDesc const & getDesc(MCInstrInfo const &MCII, MCInst const &MCI)
static bool checkHVXPipes(const HVXInstsT &hvxInsts, unsigned startIdx, unsigned usedUnits)
unsigned Lanes
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isBranch(unsigned Opcode)
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:235
std::pair< unsigned, unsigned > UnitsAndLanes
#define DEBUG(X)
Definition: Debug.h:118
static bool lessCVI(const HexagonInstr &A, const HexagonInstr &B)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
unsigned getType(MCInstrInfo const &MCII, MCInst const &MCI)
Return the Hexagon ISA class for the insn.
void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp=Comparator())
Definition: Parallel.h:201
static void SetupTUL(TypeUnitsAndLanes *TUL, StringRef CPU)
const MCOperand & getOperand(unsigned i) const
Definition: MCInst.h:173
hexagon widen stores
bool check()
Check that the packet is legal and enforce relative insn order.