1 //=== Target/TargetRegisterInfo.h - Target Register Information -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes an abstract interface used to get information about a
11 // target machines register file. This information is used for a variety of
12 // purposed, especially register allocation.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TARGET_TARGETREGISTERINFO_H
17 #define LLVM_TARGET_TARGETREGISTERINFO_H
19 #include "llvm/MC/MCRegisterInfo.h"
20 #include "llvm/CodeGen/MachineBasicBlock.h"
21 #include "llvm/CodeGen/ValueTypes.h"
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/DenseSet.h"
30 class MachineFunction;
32 template<class T> class SmallVectorImpl;
35 class TargetRegisterClass : public MCRegisterClass {
37 typedef const EVT* vt_iterator;
38 typedef const TargetRegisterClass* const * sc_iterator;
40 const vt_iterator VTs;
41 const sc_iterator SubClasses;
42 const sc_iterator SuperClasses;
43 const sc_iterator SubRegClasses;
44 const sc_iterator SuperRegClasses;
46 TargetRegisterClass(unsigned id, const char *name, const EVT *vts,
47 const TargetRegisterClass * const *subcs,
48 const TargetRegisterClass * const *supcs,
49 const TargetRegisterClass * const *subregcs,
50 const TargetRegisterClass * const *superregcs,
51 unsigned RS, unsigned Al, int CC, bool Allocable,
52 iterator RB, iterator RE)
53 : MCRegisterClass(id, name, RS, Al, CC, Allocable, RB, RE),
54 VTs(vts), SubClasses(subcs), SuperClasses(supcs), SubRegClasses(subregcs),
55 SuperRegClasses(superregcs) {
56 initMCRegisterClass();
59 virtual ~TargetRegisterClass() {} // Allow subclasses
61 /// hasType - return true if this TargetRegisterClass has the ValueType vt.
63 bool hasType(EVT vt) const {
64 for(int i = 0; VTs[i] != MVT::Other; ++i)
70 /// vt_begin / vt_end - Loop over all of the value types that can be
71 /// represented by values in this register class.
72 vt_iterator vt_begin() const {
76 vt_iterator vt_end() const {
78 while (*I != MVT::Other) ++I;
82 /// subregclasses_begin / subregclasses_end - Loop over all of
83 /// the subreg register classes of this register class.
84 sc_iterator subregclasses_begin() const {
88 sc_iterator subregclasses_end() const {
89 sc_iterator I = SubRegClasses;
90 while (*I != NULL) ++I;
94 /// getSubRegisterRegClass - Return the register class of subregisters with
95 /// index SubIdx, or NULL if no such class exists.
96 const TargetRegisterClass* getSubRegisterRegClass(unsigned SubIdx) const {
97 assert(SubIdx>0 && "Invalid subregister index");
98 return SubRegClasses[SubIdx-1];
101 /// superregclasses_begin / superregclasses_end - Loop over all of
102 /// the superreg register classes of this register class.
103 sc_iterator superregclasses_begin() const {
104 return SuperRegClasses;
107 sc_iterator superregclasses_end() const {
108 sc_iterator I = SuperRegClasses;
109 while (*I != NULL) ++I;
113 /// hasSubClass - return true if the specified TargetRegisterClass
114 /// is a proper subset of this TargetRegisterClass.
115 bool hasSubClass(const TargetRegisterClass *cs) const {
116 for (int i = 0; SubClasses[i] != NULL; ++i)
117 if (SubClasses[i] == cs)
122 /// hasSubClassEq - Returns true if RC is a subclass of or equal to this
124 bool hasSubClassEq(const TargetRegisterClass *RC) const {
125 return RC == this || hasSubClass(RC);
128 /// subclasses_begin / subclasses_end - Loop over all of the classes
129 /// that are proper subsets of this register class.
130 sc_iterator subclasses_begin() const {
134 sc_iterator subclasses_end() const {
135 sc_iterator I = SubClasses;
136 while (*I != NULL) ++I;
140 /// hasSuperClass - return true if the specified TargetRegisterClass is a
141 /// proper superset of this TargetRegisterClass.
142 bool hasSuperClass(const TargetRegisterClass *cs) const {
143 for (int i = 0; SuperClasses[i] != NULL; ++i)
144 if (SuperClasses[i] == cs)
149 /// hasSuperClassEq - Returns true if RC is a superclass of or equal to this
151 bool hasSuperClassEq(const TargetRegisterClass *RC) const {
152 return RC == this || hasSuperClass(RC);
155 /// superclasses_begin / superclasses_end - Loop over all of the classes
156 /// that are proper supersets of this register class.
157 sc_iterator superclasses_begin() const {
161 sc_iterator superclasses_end() const {
162 sc_iterator I = SuperClasses;
163 while (*I != NULL) ++I;
167 /// isASubClass - return true if this TargetRegisterClass is a subset
168 /// class of at least one other TargetRegisterClass.
169 bool isASubClass() const {
170 return SuperClasses[0] != 0;
173 /// getRawAllocationOrder - Returns the preferred order for allocating
174 /// registers from this register class in MF. The raw order comes directly
175 /// from the .td file and may include reserved registers that are not
176 /// allocatable. Register allocators should also make sure to allocate
177 /// callee-saved registers only after all the volatiles are used. The
178 /// RegisterClassInfo class provides filtered allocation orders with
179 /// callee-saved registers moved to the end.
181 /// The MachineFunction argument can be used to tune the allocatable
182 /// registers based on the characteristics of the function, subtarget, or
185 /// By default, this method returns all registers in the class.
188 ArrayRef<unsigned> getRawAllocationOrder(const MachineFunction &MF) const {
189 return makeArrayRef(begin(), getNumRegs());
193 /// TargetRegisterInfoDesc - Extra information, not in MCRegisterDesc, about
194 /// registers. These are used by codegen, not by MC.
195 struct TargetRegisterInfoDesc {
196 unsigned CostPerUse; // Extra cost of instructions using register.
197 bool inAllocatableClass; // Register belongs to an allocatable regclass.
200 /// TargetRegisterInfo base class - We assume that the target defines a static
201 /// array of TargetRegisterDesc objects that represent all of the machine
202 /// registers that the target has. As such, we simply have to track a pointer
203 /// to this array so that we can turn register number into a register
206 class TargetRegisterInfo : public MCRegisterInfo {
208 typedef const TargetRegisterClass * const * regclass_iterator;
210 const TargetRegisterInfoDesc *InfoDesc; // Extra desc array for codegen
211 const char *const *SubRegIndexNames; // Names of subreg indexes.
212 regclass_iterator RegClassBegin, RegClassEnd; // List of regclasses
215 TargetRegisterInfo(const TargetRegisterInfoDesc *ID,
216 regclass_iterator RegClassBegin,
217 regclass_iterator RegClassEnd,
218 const char *const *subregindexnames);
219 virtual ~TargetRegisterInfo();
222 // Register numbers can represent physical registers, virtual registers, and
223 // sometimes stack slots. The unsigned values are divided into these ranges:
225 // 0 Not a register, can be used as a sentinel.
226 // [1;2^30) Physical registers assigned by TableGen.
227 // [2^30;2^31) Stack slots. (Rarely used.)
228 // [2^31;2^32) Virtual registers assigned by MachineRegisterInfo.
230 // Further sentinels can be allocated from the small negative integers.
231 // DenseMapInfo<unsigned> uses -1u and -2u.
233 /// isStackSlot - Sometimes it is useful the be able to store a non-negative
234 /// frame index in a variable that normally holds a register. isStackSlot()
235 /// returns true if Reg is in the range used for stack slots.
237 /// Note that isVirtualRegister() and isPhysicalRegister() cannot handle stack
238 /// slots, so if a variable may contains a stack slot, always check
239 /// isStackSlot() first.
241 static bool isStackSlot(unsigned Reg) {
242 return int(Reg) >= (1 << 30);
245 /// stackSlot2Index - Compute the frame index from a register value
246 /// representing a stack slot.
247 static int stackSlot2Index(unsigned Reg) {
248 assert(isStackSlot(Reg) && "Not a stack slot");
249 return int(Reg - (1u << 30));
252 /// index2StackSlot - Convert a non-negative frame index to a stack slot
254 static unsigned index2StackSlot(int FI) {
255 assert(FI >= 0 && "Cannot hold a negative frame index.");
256 return FI + (1u << 30);
259 /// isPhysicalRegister - Return true if the specified register number is in
260 /// the physical register namespace.
261 static bool isPhysicalRegister(unsigned Reg) {
262 assert(!isStackSlot(Reg) && "Not a register! Check isStackSlot() first.");
266 /// isVirtualRegister - Return true if the specified register number is in
267 /// the virtual register namespace.
268 static bool isVirtualRegister(unsigned Reg) {
269 assert(!isStackSlot(Reg) && "Not a register! Check isStackSlot() first.");
273 /// virtReg2Index - Convert a virtual register number to a 0-based index.
274 /// The first virtual register in a function will get the index 0.
275 static unsigned virtReg2Index(unsigned Reg) {
276 assert(isVirtualRegister(Reg) && "Not a virtual register");
277 return Reg & ~(1u << 31);
280 /// index2VirtReg - Convert a 0-based index to a virtual register number.
281 /// This is the inverse operation of VirtReg2IndexFunctor below.
282 static unsigned index2VirtReg(unsigned Index) {
283 return Index | (1u << 31);
286 /// getMinimalPhysRegClass - Returns the Register Class of a physical
287 /// register of the given type, picking the most sub register class of
288 /// the right type that contains this physreg.
289 const TargetRegisterClass *
290 getMinimalPhysRegClass(unsigned Reg, EVT VT = MVT::Other) const;
292 /// getAllocatableSet - Returns a bitset indexed by register number
293 /// indicating if a register is allocatable or not. If a register class is
294 /// specified, returns the subset for the class.
295 BitVector getAllocatableSet(const MachineFunction &MF,
296 const TargetRegisterClass *RC = NULL) const;
298 /// getCostPerUse - Return the additional cost of using this register instead
299 /// of other registers in its class.
300 unsigned getCostPerUse(unsigned RegNo) const {
301 return InfoDesc[RegNo].CostPerUse;
304 /// isInAllocatableClass - Return true if the register is in the allocation
305 /// of any register class.
306 bool isInAllocatableClass(unsigned RegNo) const {
307 return InfoDesc[RegNo].inAllocatableClass;
310 /// getSubRegIndexName - Return the human-readable symbolic target-specific
311 /// name for the specified SubRegIndex.
312 const char *getSubRegIndexName(unsigned SubIdx) const {
313 assert(SubIdx && "This is not a subregister index");
314 return SubRegIndexNames[SubIdx-1];
317 /// regsOverlap - Returns true if the two registers are equal or alias each
318 /// other. The registers may be virtual register.
319 bool regsOverlap(unsigned regA, unsigned regB) const {
320 if (regA == regB) return true;
321 if (isVirtualRegister(regA) || isVirtualRegister(regB))
323 for (const unsigned *regList = getOverlaps(regA)+1; *regList; ++regList) {
324 if (*regList == regB) return true;
329 /// isSubRegister - Returns true if regB is a sub-register of regA.
331 bool isSubRegister(unsigned regA, unsigned regB) const {
332 return isSuperRegister(regB, regA);
335 /// isSuperRegister - Returns true if regB is a super-register of regA.
337 bool isSuperRegister(unsigned regA, unsigned regB) const {
338 for (const unsigned *regList = getSuperRegisters(regA); *regList;++regList){
339 if (*regList == regB) return true;
344 /// getCalleeSavedRegs - Return a null-terminated list of all of the
345 /// callee saved registers on this target. The register should be in the
346 /// order of desired callee-save stack frame offset. The first register is
347 /// closed to the incoming stack pointer if stack grows down, and vice versa.
348 virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF = 0)
352 /// getReservedRegs - Returns a bitset indexed by physical register number
353 /// indicating if a register is a special register that has particular uses
354 /// and should be considered unavailable at all times, e.g. SP, RA. This is
355 /// used by register scavenger to determine what registers are free.
356 virtual BitVector getReservedRegs(const MachineFunction &MF) const = 0;
358 /// getSubReg - Returns the physical register number of sub-register "Index"
359 /// for physical register RegNo. Return zero if the sub-register does not
361 virtual unsigned getSubReg(unsigned RegNo, unsigned Index) const = 0;
363 /// getSubRegIndex - For a given register pair, return the sub-register index
364 /// if the second register is a sub-register of the first. Return zero
366 virtual unsigned getSubRegIndex(unsigned RegNo, unsigned SubRegNo) const = 0;
368 /// getMatchingSuperReg - Return a super-register of the specified register
369 /// Reg so its sub-register of index SubIdx is Reg.
370 unsigned getMatchingSuperReg(unsigned Reg, unsigned SubIdx,
371 const TargetRegisterClass *RC) const {
372 for (const unsigned *SRs = getSuperRegisters(Reg); unsigned SR = *SRs;++SRs)
373 if (Reg == getSubReg(SR, SubIdx) && RC->contains(SR))
378 /// canCombineSubRegIndices - Given a register class and a list of
379 /// subregister indices, return true if it's possible to combine the
380 /// subregister indices into one that corresponds to a larger
381 /// subregister. Return the new subregister index by reference. Note the
382 /// new index may be zero if the given subregisters can be combined to
383 /// form the whole register.
384 virtual bool canCombineSubRegIndices(const TargetRegisterClass *RC,
385 SmallVectorImpl<unsigned> &SubIndices,
386 unsigned &NewSubIdx) const {
390 /// getMatchingSuperRegClass - Return a subclass of the specified register
391 /// class A so that each register in it has a sub-register of the
392 /// specified sub-register index which is in the specified register class B.
393 virtual const TargetRegisterClass *
394 getMatchingSuperRegClass(const TargetRegisterClass *A,
395 const TargetRegisterClass *B, unsigned Idx) const {
399 /// composeSubRegIndices - Return the subregister index you get from composing
400 /// two subregister indices.
402 /// If R:a:b is the same register as R:c, then composeSubRegIndices(a, b)
403 /// returns c. Note that composeSubRegIndices does not tell you about illegal
404 /// compositions. If R does not have a subreg a, or R:a does not have a subreg
405 /// b, composeSubRegIndices doesn't tell you.
407 /// The ARM register Q0 has two D subregs dsub_0:D0 and dsub_1:D1. It also has
408 /// ssub_0:S0 - ssub_3:S3 subregs.
409 /// If you compose subreg indices dsub_1, ssub_0 you get ssub_2.
411 virtual unsigned composeSubRegIndices(unsigned a, unsigned b) const {
412 // This default implementation is correct for most targets.
416 //===--------------------------------------------------------------------===//
417 // Register Class Information
420 /// Register class iterators
422 regclass_iterator regclass_begin() const { return RegClassBegin; }
423 regclass_iterator regclass_end() const { return RegClassEnd; }
425 unsigned getNumRegClasses() const {
426 return (unsigned)(regclass_end()-regclass_begin());
429 /// getRegClass - Returns the register class associated with the enumeration
430 /// value. See class MCOperandInfo.
431 const TargetRegisterClass *getRegClass(unsigned i) const {
432 assert(i < getNumRegClasses() && "Register Class ID out of range");
433 return RegClassBegin[i];
436 /// getPointerRegClass - Returns a TargetRegisterClass used for pointer
437 /// values. If a target supports multiple different pointer register classes,
438 /// kind specifies which one is indicated.
439 virtual const TargetRegisterClass *getPointerRegClass(unsigned Kind=0) const {
440 assert(0 && "Target didn't implement getPointerRegClass!");
441 return 0; // Must return a value in order to compile with VS 2005
444 /// getCrossCopyRegClass - Returns a legal register class to copy a register
445 /// in the specified class to or from. If it is possible to copy the register
446 /// directly without using a cross register class copy, return the specified
447 /// RC. Returns NULL if it is not possible to copy between a two registers of
448 /// the specified class.
449 virtual const TargetRegisterClass *
450 getCrossCopyRegClass(const TargetRegisterClass *RC) const {
454 /// getLargestLegalSuperClass - Returns the largest super class of RC that is
455 /// legal to use in the current sub-target and has the same spill size.
456 /// The returned register class can be used to create virtual registers which
457 /// means that all its registers can be copied and spilled.
458 virtual const TargetRegisterClass*
459 getLargestLegalSuperClass(const TargetRegisterClass *RC) const {
460 /// The default implementation is very conservative and doesn't allow the
461 /// register allocator to inflate register classes.
465 /// getRegPressureLimit - Return the register pressure "high water mark" for
466 /// the specific register class. The scheduler is in high register pressure
467 /// mode (for the specific register class) if it goes over the limit.
468 virtual unsigned getRegPressureLimit(const TargetRegisterClass *RC,
469 MachineFunction &MF) const {
473 /// getRawAllocationOrder - Returns the register allocation order for a
474 /// specified register class with a target-dependent hint. The returned list
475 /// may contain reserved registers that cannot be allocated.
477 /// Register allocators need only call this function to resolve
478 /// target-dependent hints, but it should work without hinting as well.
479 virtual ArrayRef<unsigned>
480 getRawAllocationOrder(const TargetRegisterClass *RC,
481 unsigned HintType, unsigned HintReg,
482 const MachineFunction &MF) const {
483 return RC->getRawAllocationOrder(MF);
486 /// ResolveRegAllocHint - Resolves the specified register allocation hint
487 /// to a physical register. Returns the physical register if it is successful.
488 virtual unsigned ResolveRegAllocHint(unsigned Type, unsigned Reg,
489 const MachineFunction &MF) const {
490 if (Type == 0 && Reg && isPhysicalRegister(Reg))
495 /// avoidWriteAfterWrite - Return true if the register allocator should avoid
496 /// writing a register from RC in two consecutive instructions.
497 /// This can avoid pipeline stalls on certain architectures.
498 /// It does cause increased register pressure, though.
499 virtual bool avoidWriteAfterWrite(const TargetRegisterClass *RC) const {
503 /// UpdateRegAllocHint - A callback to allow target a chance to update
504 /// register allocation hints when a register is "changed" (e.g. coalesced)
505 /// to another register. e.g. On ARM, some virtual registers should target
506 /// register pairs, if one of pair is coalesced to another register, the
507 /// allocation hint of the other half of the pair should be changed to point
508 /// to the new register.
509 virtual void UpdateRegAllocHint(unsigned Reg, unsigned NewReg,
510 MachineFunction &MF) const {
514 /// requiresRegisterScavenging - returns true if the target requires (and can
515 /// make use of) the register scavenger.
516 virtual bool requiresRegisterScavenging(const MachineFunction &MF) const {
520 /// useFPForScavengingIndex - returns true if the target wants to use
521 /// frame pointer based accesses to spill to the scavenger emergency spill
523 virtual bool useFPForScavengingIndex(const MachineFunction &MF) const {
527 /// requiresFrameIndexScavenging - returns true if the target requires post
528 /// PEI scavenging of registers for materializing frame index constants.
529 virtual bool requiresFrameIndexScavenging(const MachineFunction &MF) const {
533 /// requiresVirtualBaseRegisters - Returns true if the target wants the
534 /// LocalStackAllocation pass to be run and virtual base registers
535 /// used for more efficient stack access.
536 virtual bool requiresVirtualBaseRegisters(const MachineFunction &MF) const {
540 /// hasReservedSpillSlot - Return true if target has reserved a spill slot in
541 /// the stack frame of the given function for the specified register. e.g. On
542 /// x86, if the frame register is required, the first fixed stack object is
543 /// reserved as its spill slot. This tells PEI not to create a new stack frame
544 /// object for the given register. It should be called only after
545 /// processFunctionBeforeCalleeSavedScan().
546 virtual bool hasReservedSpillSlot(const MachineFunction &MF, unsigned Reg,
547 int &FrameIdx) const {
551 /// needsStackRealignment - true if storage within the function requires the
552 /// stack pointer to be aligned more than the normal calling convention calls
554 virtual bool needsStackRealignment(const MachineFunction &MF) const {
558 /// getFrameIndexInstrOffset - Get the offset from the referenced frame
559 /// index in the instruction, if there is one.
560 virtual int64_t getFrameIndexInstrOffset(const MachineInstr *MI,
565 /// needsFrameBaseReg - Returns true if the instruction's frame index
566 /// reference would be better served by a base register other than FP
567 /// or SP. Used by LocalStackFrameAllocation to determine which frame index
568 /// references it should create new base registers for.
569 virtual bool needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const {
573 /// materializeFrameBaseRegister - Insert defining instruction(s) for
574 /// BaseReg to be a pointer to FrameIdx before insertion point I.
575 virtual void materializeFrameBaseRegister(MachineBasicBlock *MBB,
576 unsigned BaseReg, int FrameIdx,
577 int64_t Offset) const {
578 assert(0 && "materializeFrameBaseRegister does not exist on this target");
581 /// resolveFrameIndex - Resolve a frame index operand of an instruction
582 /// to reference the indicated base register plus offset instead.
583 virtual void resolveFrameIndex(MachineBasicBlock::iterator I,
584 unsigned BaseReg, int64_t Offset) const {
585 assert(0 && "resolveFrameIndex does not exist on this target");
588 /// isFrameOffsetLegal - Determine whether a given offset immediate is
589 /// encodable to resolve a frame index.
590 virtual bool isFrameOffsetLegal(const MachineInstr *MI,
591 int64_t Offset) const {
592 assert(0 && "isFrameOffsetLegal does not exist on this target");
593 return false; // Must return a value in order to compile with VS 2005
596 /// eliminateCallFramePseudoInstr - This method is called during prolog/epilog
597 /// code insertion to eliminate call frame setup and destroy pseudo
598 /// instructions (but only if the Target is using them). It is responsible
599 /// for eliminating these instructions, replacing them with concrete
600 /// instructions. This method need only be implemented if using call frame
601 /// setup/destroy pseudo instructions.
604 eliminateCallFramePseudoInstr(MachineFunction &MF,
605 MachineBasicBlock &MBB,
606 MachineBasicBlock::iterator MI) const {
607 assert(0 && "Call Frame Pseudo Instructions do not exist on this target!");
611 /// saveScavengerRegister - Spill the register so it can be used by the
612 /// register scavenger. Return true if the register was spilled, false
613 /// otherwise. If this function does not spill the register, the scavenger
614 /// will instead spill it to the emergency spill slot.
616 virtual bool saveScavengerRegister(MachineBasicBlock &MBB,
617 MachineBasicBlock::iterator I,
618 MachineBasicBlock::iterator &UseMI,
619 const TargetRegisterClass *RC,
620 unsigned Reg) const {
624 /// eliminateFrameIndex - This method must be overriden to eliminate abstract
625 /// frame indices from instructions which may use them. The instruction
626 /// referenced by the iterator contains an MO_FrameIndex operand which must be
627 /// eliminated by this method. This method may modify or replace the
628 /// specified instruction, as long as it keeps the iterator pointing at the
629 /// finished product. SPAdj is the SP adjustment due to call frame setup
631 virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI,
632 int SPAdj, RegScavenger *RS=NULL) const = 0;
634 //===--------------------------------------------------------------------===//
635 /// Debug information queries.
637 /// getFrameRegister - This method should return the register used as a base
638 /// for values allocated in the current stack frame.
639 virtual unsigned getFrameRegister(const MachineFunction &MF) const = 0;
641 /// getCompactUnwindRegNum - This function maps the register to the number for
642 /// compact unwind encoding. Return -1 if the register isn't valid.
643 virtual int getCompactUnwindRegNum(unsigned, bool) const {
649 // This is useful when building IndexedMaps keyed on virtual registers
650 struct VirtReg2IndexFunctor : public std::unary_function<unsigned, unsigned> {
651 unsigned operator()(unsigned Reg) const {
652 return TargetRegisterInfo::virtReg2Index(Reg);
656 /// getCommonSubClass - find the largest common subclass of A and B. Return NULL
657 /// if there is no common subclass.
658 const TargetRegisterClass *getCommonSubClass(const TargetRegisterClass *A,
659 const TargetRegisterClass *B);
661 /// PrintReg - Helper class for printing registers on a raw_ostream.
662 /// Prints virtual and physical registers with or without a TRI instance.
665 /// %noreg - NoRegister
666 /// %vreg5 - a virtual register.
667 /// %vreg5:sub_8bit - a virtual register with sub-register index (with TRI).
668 /// %EAX - a physical register
669 /// %physreg17 - a physical register when no TRI instance given.
671 /// Usage: OS << PrintReg(Reg, TRI) << '\n';
674 const TargetRegisterInfo *TRI;
678 PrintReg(unsigned reg, const TargetRegisterInfo *tri = 0, unsigned subidx = 0)
679 : TRI(tri), Reg(reg), SubIdx(subidx) {}
680 void print(raw_ostream&) const;
683 static inline raw_ostream &operator<<(raw_ostream &OS, const PrintReg &PR) {
688 } // End llvm namespace