LLVM  5.0.0
TargetRegisterInfo.cpp
Go to the documentation of this file.
1 //==- TargetRegisterInfo.cpp - Target Register Information Implementation --==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the TargetRegisterInfo interface.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "llvm/ADT/ArrayRef.h"
15 #include "llvm/ADT/BitVector.h"
16 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/IR/Attributes.h"
23 #include "llvm/IR/Function.h"
24 #include "llvm/MC/MCRegisterInfo.h"
25 #include "llvm/Support/Compiler.h"
26 #include "llvm/Support/Debug.h"
28 #include "llvm/Support/Printable.h"
33 #include <cassert>
34 #include <utility>
35 
36 #define DEBUG_TYPE "target-reg-info"
37 
38 using namespace llvm;
39 
42  const char *const *SRINames,
43  const LaneBitmask *SRILaneMasks,
44  LaneBitmask SRICoveringLanes)
45  : InfoDesc(ID), SubRegIndexNames(SRINames),
46  SubRegIndexLaneMasks(SRILaneMasks),
47  RegClassBegin(RCB), RegClassEnd(RCE),
48  CoveringLanes(SRICoveringLanes) {
49 }
50 
52 
54  const {
55  for (MCSuperRegIterator AI(Reg, this, true); AI.isValid(); ++AI)
56  RegisterSet.set(*AI);
57 }
58 
60  ArrayRef<MCPhysReg> Exceptions) const {
61  // Check that all super registers of reserved regs are reserved as well.
62  BitVector Checked(getNumRegs());
63  for (unsigned Reg : RegisterSet.set_bits()) {
64  if (Checked[Reg])
65  continue;
66  for (MCSuperRegIterator SR(Reg, this); SR.isValid(); ++SR) {
67  if (!RegisterSet[*SR] && !is_contained(Exceptions, Reg)) {
68  dbgs() << "Error: Super register " << PrintReg(*SR, this)
69  << " of reserved register " << PrintReg(Reg, this)
70  << " is not reserved.\n";
71  return false;
72  }
73 
74  // We transitively check superregs. So we can remember this for later
75  // to avoid compiletime explosion in deep register hierarchies.
76  Checked.set(*SR);
77  }
78  }
79  return true;
80 }
81 
82 namespace llvm {
83 
85  unsigned SubIdx) {
86  return Printable([Reg, TRI, SubIdx](raw_ostream &OS) {
87  if (!Reg)
88  OS << "%noreg";
89  else if (TargetRegisterInfo::isStackSlot(Reg))
90  OS << "SS#" << TargetRegisterInfo::stackSlot2Index(Reg);
92  OS << "%vreg" << TargetRegisterInfo::virtReg2Index(Reg);
93  else if (TRI && Reg < TRI->getNumRegs())
94  OS << '%' << TRI->getName(Reg);
95  else
96  OS << "%physreg" << Reg;
97  if (SubIdx) {
98  if (TRI)
99  OS << ':' << TRI->getSubRegIndexName(SubIdx);
100  else
101  OS << ":sub(" << SubIdx << ')';
102  }
103  });
104 }
105 
107  return Printable([Unit, TRI](raw_ostream &OS) {
108  // Generic printout when TRI is missing.
109  if (!TRI) {
110  OS << "Unit~" << Unit;
111  return;
112  }
113 
114  // Check for invalid register units.
115  if (Unit >= TRI->getNumRegUnits()) {
116  OS << "BadUnit~" << Unit;
117  return;
118  }
119 
120  // Normal units have at least one root.
121  MCRegUnitRootIterator Roots(Unit, TRI);
122  assert(Roots.isValid() && "Unit has no roots.");
123  OS << TRI->getName(*Roots);
124  for (++Roots; Roots.isValid(); ++Roots)
125  OS << '~' << TRI->getName(*Roots);
126  });
127 }
128 
130  return Printable([Unit, TRI](raw_ostream &OS) {
131  if (TRI && TRI->isVirtualRegister(Unit)) {
132  OS << "%vreg" << TargetRegisterInfo::virtReg2Index(Unit);
133  } else {
134  OS << PrintRegUnit(Unit, TRI);
135  }
136  });
137 }
138 
139 } // end namespace llvm
140 
141 /// getAllocatableClass - Return the maximal subclass of the given register
142 /// class that is alloctable, or NULL.
143 const TargetRegisterClass *
145  if (!RC || RC->isAllocatable())
146  return RC;
147 
148  for (BitMaskClassIterator It(RC->getSubClassMask(), *this); It.isValid();
149  ++It) {
150  const TargetRegisterClass *SubRC = getRegClass(It.getID());
151  if (SubRC->isAllocatable())
152  return SubRC;
153  }
154  return nullptr;
155 }
156 
157 /// getMinimalPhysRegClass - Returns the Register Class of a physical
158 /// register of the given type, picking the most sub register class of
159 /// the right type that contains this physreg.
160 const TargetRegisterClass *
162  assert(isPhysicalRegister(reg) && "reg must be a physical register");
163 
164  // Pick the most sub register class of the right type that contains
165  // this physreg.
166  const TargetRegisterClass* BestRC = nullptr;
167  for (const TargetRegisterClass* RC : regclasses()) {
168  if ((VT == MVT::Other || isTypeLegalForClass(*RC, VT)) &&
169  RC->contains(reg) && (!BestRC || BestRC->hasSubClass(RC)))
170  BestRC = RC;
171  }
172 
173  assert(BestRC && "Couldn't find the register class");
174  return BestRC;
175 }
176 
177 /// getAllocatableSetForRC - Toggle the bits that represent allocatable
178 /// registers for the specific register class.
180  const TargetRegisterClass *RC, BitVector &R){
181  assert(RC->isAllocatable() && "invalid for nonallocatable sets");
183  for (unsigned i = 0; i != Order.size(); ++i)
184  R.set(Order[i]);
185 }
186 
188  const TargetRegisterClass *RC) const {
189  BitVector Allocatable(getNumRegs());
190  if (RC) {
191  // A register class with no allocatable subclass returns an empty set.
192  const TargetRegisterClass *SubClass = getAllocatableClass(RC);
193  if (SubClass)
194  getAllocatableSetForRC(MF, SubClass, Allocatable);
195  } else {
196  for (const TargetRegisterClass *C : regclasses())
197  if (C->isAllocatable())
198  getAllocatableSetForRC(MF, C, Allocatable);
199  }
200 
201  // Mask out the reserved registers
202  BitVector Reserved = getReservedRegs(MF);
203  Allocatable &= Reserved.flip();
204 
205  return Allocatable;
206 }
207 
208 static inline
210  const uint32_t *B,
211  const TargetRegisterInfo *TRI,
212  const MVT::SimpleValueType SVT =
214  const MVT VT(SVT);
215  for (unsigned I = 0, E = TRI->getNumRegClasses(); I < E; I += 32)
216  if (unsigned Common = *A++ & *B++) {
217  const TargetRegisterClass *RC =
218  TRI->getRegClass(I + countTrailingZeros(Common));
219  if (SVT == MVT::SimpleValueType::Any || TRI->isTypeLegalForClass(*RC, VT))
220  return RC;
221  }
222  return nullptr;
223 }
224 
225 const TargetRegisterClass *
227  const TargetRegisterClass *B,
228  const MVT::SimpleValueType SVT) const {
229  // First take care of the trivial cases.
230  if (A == B)
231  return A;
232  if (!A || !B)
233  return nullptr;
234 
235  // Register classes are ordered topologically, so the largest common
236  // sub-class it the common sub-class with the smallest ID.
237  return firstCommonClass(A->getSubClassMask(), B->getSubClassMask(), this, SVT);
238 }
239 
240 const TargetRegisterClass *
242  const TargetRegisterClass *B,
243  unsigned Idx) const {
244  assert(A && B && "Missing register class");
245  assert(Idx && "Bad sub-register index");
246 
247  // Find Idx in the list of super-register indices.
248  for (SuperRegClassIterator RCI(B, this); RCI.isValid(); ++RCI)
249  if (RCI.getSubReg() == Idx)
250  // The bit mask contains all register classes that are projected into B
251  // by Idx. Find a class that is also a sub-class of A.
252  return firstCommonClass(RCI.getMask(), A->getSubClassMask(), this);
253  return nullptr;
254 }
255 
257 getCommonSuperRegClass(const TargetRegisterClass *RCA, unsigned SubA,
258  const TargetRegisterClass *RCB, unsigned SubB,
259  unsigned &PreA, unsigned &PreB) const {
260  assert(RCA && SubA && RCB && SubB && "Invalid arguments");
261 
262  // Search all pairs of sub-register indices that project into RCA and RCB
263  // respectively. This is quadratic, but usually the sets are very small. On
264  // most targets like X86, there will only be a single sub-register index
265  // (e.g., sub_16bit projecting into GR16).
266  //
267  // The worst case is a register class like DPR on ARM.
268  // We have indices dsub_0..dsub_7 projecting into that class.
269  //
270  // It is very common that one register class is a sub-register of the other.
271  // Arrange for RCA to be the larger register so the answer will be found in
272  // the first iteration. This makes the search linear for the most common
273  // case.
274  const TargetRegisterClass *BestRC = nullptr;
275  unsigned *BestPreA = &PreA;
276  unsigned *BestPreB = &PreB;
277  if (getRegSizeInBits(*RCA) < getRegSizeInBits(*RCB)) {
278  std::swap(RCA, RCB);
279  std::swap(SubA, SubB);
280  std::swap(BestPreA, BestPreB);
281  }
282 
283  // Also terminate the search one we have found a register class as small as
284  // RCA.
285  unsigned MinSize = getRegSizeInBits(*RCA);
286 
287  for (SuperRegClassIterator IA(RCA, this, true); IA.isValid(); ++IA) {
288  unsigned FinalA = composeSubRegIndices(IA.getSubReg(), SubA);
289  for (SuperRegClassIterator IB(RCB, this, true); IB.isValid(); ++IB) {
290  // Check if a common super-register class exists for this index pair.
291  const TargetRegisterClass *RC =
292  firstCommonClass(IA.getMask(), IB.getMask(), this);
293  if (!RC || getRegSizeInBits(*RC) < MinSize)
294  continue;
295 
296  // The indexes must compose identically: PreA+SubA == PreB+SubB.
297  unsigned FinalB = composeSubRegIndices(IB.getSubReg(), SubB);
298  if (FinalA != FinalB)
299  continue;
300 
301  // Is RC a better candidate than BestRC?
302  if (BestRC && getRegSizeInBits(*RC) >= getRegSizeInBits(*BestRC))
303  continue;
304 
305  // Yes, RC is the smallest super-register seen so far.
306  BestRC = RC;
307  *BestPreA = IA.getSubReg();
308  *BestPreB = IB.getSubReg();
309 
310  // Bail early if we reached MinSize. We won't find a better candidate.
311  if (getRegSizeInBits(*BestRC) == MinSize)
312  return BestRC;
313  }
314  }
315  return BestRC;
316 }
317 
318 /// \brief Check if the registers defined by the pair (RegisterClass, SubReg)
319 /// share the same register file.
321  const TargetRegisterClass *DefRC,
322  unsigned DefSubReg,
323  const TargetRegisterClass *SrcRC,
324  unsigned SrcSubReg) {
325  // Same register class.
326  if (DefRC == SrcRC)
327  return true;
328 
329  // Both operands are sub registers. Check if they share a register class.
330  unsigned SrcIdx, DefIdx;
331  if (SrcSubReg && DefSubReg) {
332  return TRI.getCommonSuperRegClass(SrcRC, SrcSubReg, DefRC, DefSubReg,
333  SrcIdx, DefIdx) != nullptr;
334  }
335 
336  // At most one of the register is a sub register, make it Src to avoid
337  // duplicating the test.
338  if (!SrcSubReg) {
339  std::swap(DefSubReg, SrcSubReg);
340  std::swap(DefRC, SrcRC);
341  }
342 
343  // One of the register is a sub register, check if we can get a superclass.
344  if (SrcSubReg)
345  return TRI.getMatchingSuperRegClass(SrcRC, DefRC, SrcSubReg) != nullptr;
346 
347  // Plain copy.
348  return TRI.getCommonSubClass(DefRC, SrcRC) != nullptr;
349 }
350 
352  unsigned DefSubReg,
353  const TargetRegisterClass *SrcRC,
354  unsigned SrcSubReg) const {
355  // If this source does not incur a cross register bank copy, use it.
356  return shareSameRegisterFile(*this, DefRC, DefSubReg, SrcRC, SrcSubReg);
357 }
358 
359 // Compute target-independent register allocator hints to help eliminate copies.
360 void
362  ArrayRef<MCPhysReg> Order,
364  const MachineFunction &MF,
365  const VirtRegMap *VRM,
366  const LiveRegMatrix *Matrix) const {
367  const MachineRegisterInfo &MRI = MF.getRegInfo();
368  std::pair<unsigned, unsigned> Hint = MRI.getRegAllocationHint(VirtReg);
369 
370  // Hints with HintType != 0 were set by target-dependent code.
371  // Such targets must provide their own implementation of
372  // TRI::getRegAllocationHints to interpret those hint types.
373  assert(Hint.first == 0 && "Target must implement TRI::getRegAllocationHints");
374 
375  // Target-independent hints are either a physical or a virtual register.
376  unsigned Phys = Hint.second;
377  if (VRM && isVirtualRegister(Phys))
378  Phys = VRM->getPhys(Phys);
379 
380  // Check that Phys is a valid hint in VirtReg's register class.
381  if (!isPhysicalRegister(Phys))
382  return;
383  if (MRI.isReserved(Phys))
384  return;
385  // Check that Phys is in the allocation order. We shouldn't heed hints
386  // from VirtReg's register class if they aren't in the allocation order. The
387  // target probably has a reason for removing the register.
388  if (!is_contained(Order, Phys))
389  return;
390 
391  // All clear, tell the register allocator to prefer this register.
392  Hints.push_back(Phys);
393 }
394 
396  return !MF.getFunction()->hasFnAttribute("no-realign-stack");
397 }
398 
400  const MachineFunction &MF) const {
401  const MachineFrameInfo &MFI = MF.getFrameInfo();
403  const Function *F = MF.getFunction();
404  unsigned StackAlign = TFI->getStackAlignment();
405  bool requiresRealignment = ((MFI.getMaxAlignment() > StackAlign) ||
406  F->hasFnAttribute(Attribute::StackAlignment));
407  if (MF.getFunction()->hasFnAttribute("stackrealign") || requiresRealignment) {
408  if (canRealignStack(MF))
409  return true;
410  DEBUG(dbgs() << "Can't realign function's stack: " << F->getName() << "\n");
411  }
412  return false;
413 }
414 
416  const uint32_t *mask1) const {
417  unsigned N = (getNumRegs()+31) / 32;
418  for (unsigned I = 0; I < N; ++I)
419  if ((mask0[I] & mask1[I]) != mask0[I])
420  return false;
421  return true;
422 }
423 
424 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
426 void TargetRegisterInfo::dumpReg(unsigned Reg, unsigned SubRegIndex,
427  const TargetRegisterInfo *TRI) {
428  dbgs() << PrintReg(Reg, TRI, SubRegIndex) << "\n";
429 }
430 #endif
unsigned getStackAlignment() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
void push_back(const T &Elt)
Definition: SmallVector.h:211
BitVector & set()
Definition: BitVector.h:398
bool isValid() const
Check if the iterator is at the end of the list.
static unsigned virtReg2Index(unsigned Reg)
Convert a virtual register number to a 0-based index.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
Definition: Compiler.h:449
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
void markSuperRegs(BitVector &RegisterSet, unsigned Reg) const
Mark a register and all its aliases as reserved in the given set.
iterator_range< const_set_bits_iterator > set_bits() const
Definition: BitVector.h:130
unsigned getRegSizeInBits(const TargetRegisterClass &RC) const
Return the size in bits of a register from class RC.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
const Function * getFunction() const
getFunction - Return the LLVM function that this machine code represents
Live Register Matrix
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:218
unsigned getMaxAlignment() const
Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...
static int stackSlot2Index(unsigned Reg)
Compute the frame index from a register value representing a stack slot.
iterator_range< regclass_iterator > regclasses() const
unsigned getNumRegClasses() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MCSuperRegIterator enumerates all super-registers of Reg.
const TargetRegisterClass * getRegClass(unsigned i) const
Returns the register class associated with the enumeration value.
ArrayRef< MCPhysReg > getRawAllocationOrder(const MachineFunction &MF) const
Returns the preferred order for allocating registers from this register class in MF.
Reg
All possible values of the reg field in the ModR/M byte.
This file contains the simple types necessary to represent the attributes associated with functions a...
virtual bool shouldRewriteCopySrc(const TargetRegisterClass *DefRC, unsigned DefSubReg, const TargetRegisterClass *SrcRC, unsigned SrcSubReg) const
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
unsigned getNumRegs() const
Return the number of registers this target has (useful for sizing arrays holding per register informa...
#define F(x, y, z)
Definition: MD5.cpp:55
MCRegUnitRootIterator enumerates the root registers of a register unit.
virtual const TargetRegisterClass * getMatchingSuperRegClass(const TargetRegisterClass *A, const TargetRegisterClass *B, unsigned Idx) const
Return a subclass of the specified register class A so that each register in it has a sub-register of...
BitVector getAllocatableSet(const MachineFunction &MF, const TargetRegisterClass *RC=nullptr) const
Returns a bitset indexed by register number indicating if a register is allocatable or not...
Printable PrintReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubRegIdx=0)
Prints virtual and physical registers with or without a TRI instance.
MCRegisterClass - Base class of TargetRegisterClass.
bool regmaskSubsetEqual(const uint32_t *mask0, const uint32_t *mask1) const
Return true if all bits that are set in mask mask0 are also set in mask1.
const TargetRegisterClass * getCommonSuperRegClass(const TargetRegisterClass *RCA, unsigned SubA, const TargetRegisterClass *RCB, unsigned SubB, unsigned &PreA, unsigned &PreB) const
Find a common super-register class if it exists.
This class encapuslates the logic to iterate over bitmask returned by the various RegClass related AP...
static const TargetRegisterClass * firstCommonClass(const uint32_t *A, const uint32_t *B, const TargetRegisterInfo *TRI, const MVT::SimpleValueType SVT=MVT::SimpleValueType::Any)
unsigned const MachineRegisterInfo * MRI
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
Machine Value Type.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
bool isReserved(unsigned PhysReg) const
isReserved - Returns true when PhysReg is a reserved register.
#define A
Definition: LargeTest.cpp:12
bool checkAllSuperRegsMarked(const BitVector &RegisterSet, ArrayRef< MCPhysReg > Exceptions=ArrayRef< MCPhysReg >()) const
Returns true if for every register in the set all super registers are part of the set as well...
Extra information, not in MCRegisterDesc, about registers.
const TargetRegisterClass * getAllocatableClass(const TargetRegisterClass *RC) const
Return the maximal subclass of the given register class that is allocatable or NULL.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
bool hasSubClass(const TargetRegisterClass *RC) const
Return true if the specified TargetRegisterClass is a proper sub-class of this TargetRegisterClass.
static bool isStackSlot(unsigned Reg)
isStackSlot - Sometimes it is useful the be able to store a non-negative frame index in a variable th...
virtual const TargetFrameLowering * getFrameLowering() const
static bool shareSameRegisterFile(const TargetRegisterInfo &TRI, const TargetRegisterClass *DefRC, unsigned DefSubReg, const TargetRegisterClass *SrcRC, unsigned SrcSubReg)
Check if the registers defined by the pair (RegisterClass, SubReg) share the same register file...
Printable PrintRegUnit(unsigned Unit, const TargetRegisterInfo *TRI)
Create Printable object to print register units on a raw_ostream.
#define E
Definition: LargeTest.cpp:27
#define B
Definition: LargeTest.cpp:24
bool isValid() const
Returns true if this iterator is still pointing at a valid entry.
Information about stack frame layout on the target.
const size_t N
static void getAllocatableSetForRC(const MachineFunction &MF, const TargetRegisterClass *RC, BitVector &R)
getAllocatableSetForRC - Toggle the bits that represent allocatable registers for the specific regist...
BitVector & flip()
Definition: BitVector.h:478
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:923
virtual BitVector getReservedRegs(const MachineFunction &MF) const =0
Returns a bitset indexed by physical register number indicating if a register is a special register t...
const TargetRegisterClass * getMinimalPhysRegClass(unsigned Reg, MVT VT=MVT::Other) const
Returns the Register Class of a physical register of the given type, picking the most sub register cl...
const char * getSubRegIndexName(unsigned SubIdx) const
Return the human-readable symbolic target-specific name for the specified SubRegIndex.
unsigned getNumRegUnits() const
Return the number of (native) register units in the target.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.h:254
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
TargetRegisterInfo(const TargetRegisterInfoDesc *ID, regclass_iterator RegClassBegin, regclass_iterator RegClassEnd, const char *const *SRINames, const LaneBitmask *SRILaneMasks, LaneBitmask CoveringLanes)
#define C
Definition: LargeTest.cpp:25
#define I(x, y, z)
Definition: MD5.cpp:58
bool isAllocatable() const
Return true if this register class may be used to create virtual registers.
const TargetRegisterClass * getCommonSubClass(const TargetRegisterClass *A, const TargetRegisterClass *B, const MVT::SimpleValueType SVT=MVT::SimpleValueType::Any) const
Find the largest common subclass of A and B.
virtual bool canRealignStack(const MachineFunction &MF) const
True if the stack can be realigned for the target.
std::vector< uint8_t > Unit
Definition: FuzzerDefs.h:105
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isTypeLegalForClass(const TargetRegisterClass &RC, MVT T) const
Return true if the given TargetRegisterClass has the ValueType T.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
#define DEBUG(X)
Definition: Debug.h:118
const char * getName(unsigned RegNo) const
Return the human-readable symbolic target-specific name for the specified physical register...
unsigned getPhys(unsigned virtReg) const
returns the physical register mapped to the specified virtual register
Definition: VirtRegMap.h:98
unsigned composeSubRegIndices(unsigned a, unsigned b) const
Return the subregister index you get from composing two subregister indices.
std::set< RegisterRef > RegisterSet
Definition: RDFGraph.h:415
bool needsStackRealignment(const MachineFunction &MF) const
True if storage within the function requires the stack pointer to be aligned more than the normal cal...
std::pair< unsigned, unsigned > getRegAllocationHint(unsigned VReg) const
getRegAllocationHint - Return the register allocation hint for the specified virtual register...
Simple wrapper around std::function<void(raw_ostream&)>.
Definition: Printable.h:38
Printable PrintVRegOrUnit(unsigned VRegOrUnit, const TargetRegisterInfo *TRI)
Create Printable object to print virtual registers and physical registers on a raw_ostream.
bool isValid() const
Returns true if this iterator is still pointing at a valid entry.
virtual void getRegAllocationHints(unsigned VirtReg, ArrayRef< MCPhysReg > Order, SmallVectorImpl< MCPhysReg > &Hints, const MachineFunction &MF, const VirtRegMap *VRM=nullptr, const LiveRegMatrix *Matrix=nullptr) const
Get a list of 'hint' registers that the register allocator should try first when allocating a physica...
const uint32_t * getSubClassMask() const
Returns a bit vector of subclasses, including this one.
static void dumpReg(unsigned Reg, unsigned SubRegIndex=0, const TargetRegisterInfo *TRI=nullptr)
Debugging helper: dump register in human readable form to dbgs() stream.
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
Definition: STLExtras.h:872