1 //===- CodeGenRegisters.h - Register and RegisterClass Info -----*- 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 defines structures to encapsulate information gleaned from the
11 // target register and register class definitions.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_UTILS_TABLEGEN_CODEGENREGISTERS_H
16 #define LLVM_UTILS_TABLEGEN_CODEGENREGISTERS_H
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/BitVector.h"
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/SetVector.h"
22 #include "llvm/ADT/SparseBitVector.h"
23 #include "llvm/CodeGen/MachineValueType.h"
24 #include "llvm/Support/ErrorHandling.h"
25 #include "llvm/TableGen/Record.h"
26 #include "llvm/TableGen/SetTheory.h"
38 /// Used to encode a step in a register lane mask transformation.
39 /// Mask the bits specified in Mask, then rotate them Rol bits to the left
40 /// assuming a wraparound at 32bits.
44 bool operator==(const MaskRolPair Other) {
45 return Mask == Other.Mask && RotateLeft == Other.RotateLeft;
47 bool operator!=(const MaskRolPair Other) {
48 return Mask != Other.Mask || RotateLeft != Other.RotateLeft;
52 /// CodeGenSubRegIndex - Represents a sub-register index.
53 class CodeGenSubRegIndex {
56 std::string Namespace;
61 const unsigned EnumValue;
62 mutable unsigned LaneMask;
63 mutable SmallVector<MaskRolPair,1> CompositionLaneMaskTransform;
65 // Are all super-registers containing this SubRegIndex covered by their
67 bool AllSuperRegsCovered;
69 CodeGenSubRegIndex(Record *R, unsigned Enum);
70 CodeGenSubRegIndex(StringRef N, StringRef Nspace, unsigned Enum);
72 const std::string &getName() const { return Name; }
73 const std::string &getNamespace() const { return Namespace; }
74 std::string getQualifiedName() const;
76 // Order CodeGenSubRegIndex pointers by EnumValue.
78 bool operator()(const CodeGenSubRegIndex *A,
79 const CodeGenSubRegIndex *B) const {
81 return A->EnumValue < B->EnumValue;
85 // Map of composite subreg indices.
86 typedef std::map<CodeGenSubRegIndex*, CodeGenSubRegIndex*, Less> CompMap;
88 // Returns the subreg index that results from composing this with Idx.
89 // Returns NULL if this and Idx don't compose.
90 CodeGenSubRegIndex *compose(CodeGenSubRegIndex *Idx) const {
91 CompMap::const_iterator I = Composed.find(Idx);
92 return I == Composed.end() ? nullptr : I->second;
95 // Add a composite subreg index: this+A = B.
96 // Return a conflicting composite, or NULL
97 CodeGenSubRegIndex *addComposite(CodeGenSubRegIndex *A,
98 CodeGenSubRegIndex *B) {
100 std::pair<CompMap::iterator, bool> Ins =
101 Composed.insert(std::make_pair(A, B));
102 // Synthetic subreg indices that aren't contiguous (for instance ARM
103 // register tuples) don't have a bit range, so it's OK to let
104 // B->Offset == -1. For the other cases, accumulate the offset and set
105 // the size here. Only do so if there is no offset yet though.
106 if ((Offset != (uint16_t)-1 && A->Offset != (uint16_t)-1) &&
107 (B->Offset == (uint16_t)-1)) {
108 B->Offset = Offset + A->Offset;
111 return (Ins.second || Ins.first->second == B) ? nullptr
115 // Update the composite maps of components specified in 'ComposedOf'.
116 void updateComponents(CodeGenRegBank&);
118 // Return the map of composites.
119 const CompMap &getComposites() const { return Composed; }
121 // Compute LaneMask from Composed. Return LaneMask.
122 unsigned computeLaneMask() const;
128 /// CodeGenRegister - Represents a register definition.
129 struct CodeGenRegister {
133 bool CoveredBySubRegs;
135 // Map SubRegIndex -> Register.
136 typedef std::map<CodeGenSubRegIndex*, CodeGenRegister*,
137 CodeGenSubRegIndex::Less> SubRegMap;
139 CodeGenRegister(Record *R, unsigned Enum);
141 const std::string &getName() const;
143 // Extract more information from TheDef. This is used to build an object
144 // graph after all CodeGenRegister objects have been created.
145 void buildObjectGraph(CodeGenRegBank&);
147 // Lazily compute a map of all sub-registers.
148 // This includes unique entries for all sub-sub-registers.
149 const SubRegMap &computeSubRegs(CodeGenRegBank&);
151 // Compute extra sub-registers by combining the existing sub-registers.
152 void computeSecondarySubRegs(CodeGenRegBank&);
154 // Add this as a super-register to all sub-registers after the sub-register
155 // graph has been built.
156 void computeSuperRegs(CodeGenRegBank&);
158 const SubRegMap &getSubRegs() const {
159 assert(SubRegsComplete && "Must precompute sub-registers");
163 // Add sub-registers to OSet following a pre-order defined by the .td file.
164 void addSubRegsPreOrder(SetVector<const CodeGenRegister*> &OSet,
165 CodeGenRegBank&) const;
167 // Return the sub-register index naming Reg as a sub-register of this
168 // register. Returns NULL if Reg is not a sub-register.
169 CodeGenSubRegIndex *getSubRegIndex(const CodeGenRegister *Reg) const {
170 return SubReg2Idx.lookup(Reg);
173 typedef std::vector<const CodeGenRegister*> SuperRegList;
175 // Get the list of super-registers in topological order, small to large.
176 // This is valid after computeSubRegs visits all registers during RegBank
178 const SuperRegList &getSuperRegs() const {
179 assert(SubRegsComplete && "Must precompute sub-registers");
183 // Get the list of ad hoc aliases. The graph is symmetric, so the list
184 // contains all registers in 'Aliases', and all registers that mention this
185 // register in 'Aliases'.
186 ArrayRef<CodeGenRegister*> getExplicitAliases() const {
187 return ExplicitAliases;
190 // Get the topological signature of this register. This is a small integer
191 // less than RegBank.getNumTopoSigs(). Registers with the same TopoSig have
192 // identical sub-register structure. That is, they support the same set of
193 // sub-register indices mapping to the same kind of sub-registers
195 unsigned getTopoSig() const {
196 assert(SuperRegsComplete && "TopoSigs haven't been computed yet.");
200 // List of register units in ascending order.
201 typedef SparseBitVector<> RegUnitList;
202 typedef SmallVector<unsigned, 16> RegUnitLaneMaskList;
204 // How many entries in RegUnitList are native?
205 RegUnitList NativeRegUnits;
207 // Get the list of register units.
208 // This is only valid after computeSubRegs() completes.
209 const RegUnitList &getRegUnits() const { return RegUnits; }
211 ArrayRef<unsigned> getRegUnitLaneMasks() const {
212 return makeArrayRef(RegUnitLaneMasks).slice(0, NativeRegUnits.count());
215 // Get the native register units. This is a prefix of getRegUnits().
216 RegUnitList getNativeRegUnits() const {
217 return NativeRegUnits;
220 void setRegUnitLaneMasks(const RegUnitLaneMaskList &LaneMasks) {
221 RegUnitLaneMasks = LaneMasks;
224 // Inherit register units from subregisters.
225 // Return true if the RegUnits changed.
226 bool inheritRegUnits(CodeGenRegBank &RegBank);
228 // Adopt a register unit for pressure tracking.
229 // A unit is adopted iff its unit number is >= NativeRegUnits.count().
230 void adoptRegUnit(unsigned RUID) { RegUnits.set(RUID); }
232 // Get the sum of this register's register unit weights.
233 unsigned getWeight(const CodeGenRegBank &RegBank) const;
235 // Order CodeGenRegister pointers by EnumValue.
237 bool operator()(const CodeGenRegister *A,
238 const CodeGenRegister *B) const {
240 return A->EnumValue < B->EnumValue;
245 bool operator()(const CodeGenRegister *A,
246 const CodeGenRegister *B) const {
248 return A->EnumValue == B->EnumValue;
252 // Canonically ordered set.
253 typedef std::vector<const CodeGenRegister*> Vec;
256 bool SubRegsComplete;
257 bool SuperRegsComplete;
260 // The sub-registers explicit in the .td file form a tree.
261 SmallVector<CodeGenSubRegIndex*, 8> ExplicitSubRegIndices;
262 SmallVector<CodeGenRegister*, 8> ExplicitSubRegs;
264 // Explicit ad hoc aliases, symmetrized to form an undirected graph.
265 SmallVector<CodeGenRegister*, 8> ExplicitAliases;
267 // Super-registers where this is the first explicit sub-register.
268 SuperRegList LeadingSuperRegs;
271 SuperRegList SuperRegs;
272 DenseMap<const CodeGenRegister*, CodeGenSubRegIndex*> SubReg2Idx;
273 RegUnitList RegUnits;
274 RegUnitLaneMaskList RegUnitLaneMasks;
278 class CodeGenRegisterClass {
279 CodeGenRegister::Vec Members;
280 // Allocation orders. Order[0] always contains all registers in Members.
281 std::vector<SmallVector<Record*, 16> > Orders;
282 // Bit mask of sub-classes including this, indexed by their EnumValue.
283 BitVector SubClasses;
284 // List of super-classes, topologocally ordered to have the larger classes
285 // first. This is the same as sorting by EnumValue.
286 SmallVector<CodeGenRegisterClass*, 4> SuperClasses;
290 // For a synthesized class, inherit missing properties from the nearest
292 void inheritProperties(CodeGenRegBank&);
294 // Map SubRegIndex -> sub-class. This is the largest sub-class where all
295 // registers have a SubRegIndex sub-register.
296 DenseMap<const CodeGenSubRegIndex *, CodeGenRegisterClass *>
299 // Map SubRegIndex -> set of super-reg classes. This is all register
300 // classes SuperRC such that:
302 // R:SubRegIndex in this RC for all R in SuperRC.
304 DenseMap<const CodeGenSubRegIndex *, SmallPtrSet<CodeGenRegisterClass *, 8>>
307 // Bit vector of TopoSigs for the registers in this class. This will be
308 // very sparse on regular architectures.
313 std::string Namespace;
314 SmallVector<MVT::SimpleValueType, 4> VTs;
316 unsigned SpillAlignment;
319 std::string AltOrderSelect;
320 /// Contains the combination of the lane masks of all subregisters.
323 // Return the Record that defined this class, or NULL if the class was
324 // created by TableGen.
325 Record *getDef() const { return TheDef; }
327 const std::string &getName() const { return Name; }
328 std::string getQualifiedName() const;
329 ArrayRef<MVT::SimpleValueType> getValueTypes() const {return VTs;}
330 unsigned getNumValueTypes() const { return VTs.size(); }
332 MVT::SimpleValueType getValueTypeNum(unsigned VTNum) const {
333 if (VTNum < VTs.size())
335 llvm_unreachable("VTNum greater than number of ValueTypes in RegClass!");
338 // Return true if this this class contains the register.
339 bool contains(const CodeGenRegister*) const;
341 // Returns true if RC is a subclass.
342 // RC is a sub-class of this class if it is a valid replacement for any
343 // instruction operand where a register of this classis required. It must
344 // satisfy these conditions:
346 // 1. All RC registers are also in this.
347 // 2. The RC spill size must not be smaller than our spill size.
348 // 3. RC spill alignment must be compatible with ours.
350 bool hasSubClass(const CodeGenRegisterClass *RC) const {
351 return SubClasses.test(RC->EnumValue);
354 // getSubClassWithSubReg - Returns the largest sub-class where all
355 // registers have a SubIdx sub-register.
356 CodeGenRegisterClass *
357 getSubClassWithSubReg(const CodeGenSubRegIndex *SubIdx) const {
358 return SubClassWithSubReg.lookup(SubIdx);
361 void setSubClassWithSubReg(const CodeGenSubRegIndex *SubIdx,
362 CodeGenRegisterClass *SubRC) {
363 SubClassWithSubReg[SubIdx] = SubRC;
366 // getSuperRegClasses - Returns a bit vector of all register classes
367 // containing only SubIdx super-registers of this class.
368 void getSuperRegClasses(const CodeGenSubRegIndex *SubIdx,
369 BitVector &Out) const;
371 // addSuperRegClass - Add a class containing only SudIdx super-registers.
372 void addSuperRegClass(CodeGenSubRegIndex *SubIdx,
373 CodeGenRegisterClass *SuperRC) {
374 SuperRegClasses[SubIdx].insert(SuperRC);
377 // getSubClasses - Returns a constant BitVector of subclasses indexed by
379 // The SubClasses vector includes an entry for this class.
380 const BitVector &getSubClasses() const { return SubClasses; }
382 // getSuperClasses - Returns a list of super classes ordered by EnumValue.
383 // The array does not include an entry for this class.
384 ArrayRef<CodeGenRegisterClass*> getSuperClasses() const {
388 // Returns an ordered list of class members.
389 // The order of registers is the same as in the .td file.
390 // No = 0 is the default allocation order, No = 1 is the first alternative.
391 ArrayRef<Record*> getOrder(unsigned No = 0) const {
395 // Return the total number of allocation orders available.
396 unsigned getNumOrders() const { return Orders.size(); }
398 // Get the set of registers. This set contains the same registers as
400 const CodeGenRegister::Vec &getMembers() const { return Members; }
402 // Get a bit vector of TopoSigs present in this register class.
403 const BitVector &getTopoSigs() const { return TopoSigs; }
405 // Populate a unique sorted list of units from a register set.
406 void buildRegUnitSet(std::vector<unsigned> &RegUnits) const;
408 CodeGenRegisterClass(CodeGenRegBank&, Record *R);
410 // A key representing the parts of a register class used for forming
411 // sub-classes. Note the ordering provided by this key is not the same as
412 // the topological order used for the EnumValues.
414 const CodeGenRegister::Vec *Members;
416 unsigned SpillAlignment;
418 Key(const CodeGenRegister::Vec *M, unsigned S = 0, unsigned A = 0)
419 : Members(M), SpillSize(S), SpillAlignment(A) {}
421 Key(const CodeGenRegisterClass &RC)
422 : Members(&RC.getMembers()),
423 SpillSize(RC.SpillSize),
424 SpillAlignment(RC.SpillAlignment) {}
426 // Lexicographical order of (Members, SpillSize, SpillAlignment).
427 bool operator<(const Key&) const;
430 // Create a non-user defined register class.
431 CodeGenRegisterClass(CodeGenRegBank&, StringRef Name, Key Props);
433 // Called by CodeGenRegBank::CodeGenRegBank().
434 static void computeSubClasses(CodeGenRegBank&);
437 // Register units are used to model interference and register pressure.
438 // Every register is assigned one or more register units such that two
439 // registers overlap if and only if they have a register unit in common.
441 // Normally, one register unit is created per leaf register. Non-leaf
442 // registers inherit the units of their sub-registers.
444 // Weight assigned to this RegUnit for estimating register pressure.
445 // This is useful when equalizing weights in register classes with mixed
446 // register topologies.
449 // Each native RegUnit corresponds to one or two root registers. The full
450 // set of registers containing this unit can be computed as the union of
451 // these two registers and their super-registers.
452 const CodeGenRegister *Roots[2];
454 // Index into RegClassUnitSets where we can find the list of UnitSets that
455 // contain this unit.
456 unsigned RegClassUnitSetsIdx;
458 RegUnit() : Weight(0), RegClassUnitSetsIdx(0) {
459 Roots[0] = Roots[1] = nullptr;
462 ArrayRef<const CodeGenRegister*> getRoots() const {
463 assert(!(Roots[1] && !Roots[0]) && "Invalid roots array");
464 return makeArrayRef(Roots, !!Roots[0] + !!Roots[1]);
468 // Each RegUnitSet is a sorted vector with a name.
470 typedef std::vector<unsigned>::const_iterator iterator;
473 std::vector<unsigned> Units;
474 unsigned Weight; // Cache the sum of all unit weights.
475 unsigned Order; // Cache the sort key.
477 RegUnitSet() : Weight(0), Order(0) {}
480 // Base vector for identifying TopoSigs. The contents uniquely identify a
481 // TopoSig, only computeSuperRegs needs to know how.
482 typedef SmallVector<unsigned, 16> TopoSigId;
484 // CodeGenRegBank - Represent a target's registers and the relations between
486 class CodeGenRegBank {
489 std::deque<CodeGenSubRegIndex> SubRegIndices;
490 DenseMap<Record*, CodeGenSubRegIndex*> Def2SubRegIdx;
492 CodeGenSubRegIndex *createSubRegIndex(StringRef Name, StringRef NameSpace);
494 typedef std::map<SmallVector<CodeGenSubRegIndex*, 8>,
495 CodeGenSubRegIndex*> ConcatIdxMap;
496 ConcatIdxMap ConcatIdx;
499 std::deque<CodeGenRegister> Registers;
500 StringMap<CodeGenRegister*> RegistersByName;
501 DenseMap<Record*, CodeGenRegister*> Def2Reg;
502 unsigned NumNativeRegUnits;
504 std::map<TopoSigId, unsigned> TopoSigs;
506 // Includes native (0..NumNativeRegUnits-1) and adopted register units.
507 SmallVector<RegUnit, 8> RegUnits;
510 std::list<CodeGenRegisterClass> RegClasses;
511 DenseMap<Record*, CodeGenRegisterClass*> Def2RC;
512 typedef std::map<CodeGenRegisterClass::Key, CodeGenRegisterClass*> RCKeyMap;
515 // Remember each unique set of register units. Initially, this contains a
516 // unique set for each register class. Simliar sets are coalesced with
517 // pruneUnitSets and new supersets are inferred during computeRegUnitSets.
518 std::vector<RegUnitSet> RegUnitSets;
520 // Map RegisterClass index to the index of the RegUnitSet that contains the
521 // class's units and any inferred RegUnit supersets.
523 // NOTE: This could grow beyond the number of register classes when we map
524 // register units to lists of unit sets. If the list of unit sets does not
525 // already exist for a register class, we create a new entry in this vector.
526 std::vector<std::vector<unsigned> > RegClassUnitSets;
528 // Give each register unit set an order based on sorting criteria.
529 std::vector<unsigned> RegUnitSetOrder;
531 // Add RC to *2RC maps.
532 void addToMaps(CodeGenRegisterClass*);
534 // Create a synthetic sub-class if it is missing.
535 CodeGenRegisterClass *getOrCreateSubClass(const CodeGenRegisterClass *RC,
536 const CodeGenRegister::Vec *Membs,
539 // Infer missing register classes.
540 void computeInferredRegisterClasses();
541 void inferCommonSubClass(CodeGenRegisterClass *RC);
542 void inferSubClassWithSubReg(CodeGenRegisterClass *RC);
543 void inferMatchingSuperRegClass(CodeGenRegisterClass *RC) {
544 inferMatchingSuperRegClass(RC, RegClasses.begin());
547 void inferMatchingSuperRegClass(
548 CodeGenRegisterClass *RC,
549 std::list<CodeGenRegisterClass>::iterator FirstSubRegRC);
551 // Iteratively prune unit sets.
552 void pruneUnitSets();
554 // Compute a weight for each register unit created during getSubRegs.
555 void computeRegUnitWeights();
557 // Create a RegUnitSet for each RegClass and infer superclasses.
558 void computeRegUnitSets();
560 // Populate the Composite map from sub-register relationships.
561 void computeComposites();
563 // Compute a lane mask for each sub-register index.
564 void computeSubRegLaneMasks();
566 /// Computes a lane mask for each register unit enumerated by a physical
568 void computeRegUnitLaneMasks();
571 CodeGenRegBank(RecordKeeper&);
573 SetTheory &getSets() { return Sets; }
575 // Sub-register indices. The first NumNamedIndices are defined by the user
576 // in the .td files. The rest are synthesized such that all sub-registers
577 // have a unique name.
578 const std::deque<CodeGenSubRegIndex> &getSubRegIndices() const {
579 return SubRegIndices;
582 // Find a SubRegIndex form its Record def.
583 CodeGenSubRegIndex *getSubRegIdx(Record*);
585 // Find or create a sub-register index representing the A+B composition.
586 CodeGenSubRegIndex *getCompositeSubRegIndex(CodeGenSubRegIndex *A,
587 CodeGenSubRegIndex *B);
589 // Find or create a sub-register index representing the concatenation of
590 // non-overlapping sibling indices.
592 getConcatSubRegIndex(const SmallVector<CodeGenSubRegIndex *, 8>&);
595 addConcatSubRegIndex(const SmallVector<CodeGenSubRegIndex *, 8> &Parts,
596 CodeGenSubRegIndex *Idx) {
597 ConcatIdx.insert(std::make_pair(Parts, Idx));
600 const std::deque<CodeGenRegister> &getRegisters() { return Registers; }
601 const StringMap<CodeGenRegister*> &getRegistersByName() {
602 return RegistersByName;
605 // Find a register from its Record def.
606 CodeGenRegister *getReg(Record*);
608 // Get a Register's index into the Registers array.
609 unsigned getRegIndex(const CodeGenRegister *Reg) const {
610 return Reg->EnumValue - 1;
613 // Return the number of allocated TopoSigs. The first TopoSig representing
614 // leaf registers is allocated number 0.
615 unsigned getNumTopoSigs() const {
616 return TopoSigs.size();
619 // Find or create a TopoSig for the given TopoSigId.
620 // This function is only for use by CodeGenRegister::computeSuperRegs().
621 // Others should simply use Reg->getTopoSig().
622 unsigned getTopoSig(const TopoSigId &Id) {
623 return TopoSigs.insert(std::make_pair(Id, TopoSigs.size())).first->second;
626 // Create a native register unit that is associated with one or two root
628 unsigned newRegUnit(CodeGenRegister *R0, CodeGenRegister *R1 = nullptr) {
629 RegUnits.resize(RegUnits.size() + 1);
630 RegUnits.back().Roots[0] = R0;
631 RegUnits.back().Roots[1] = R1;
632 return RegUnits.size() - 1;
635 // Create a new non-native register unit that can be adopted by a register
636 // to increase its pressure. Note that NumNativeRegUnits is not increased.
637 unsigned newRegUnit(unsigned Weight) {
638 RegUnits.resize(RegUnits.size() + 1);
639 RegUnits.back().Weight = Weight;
640 return RegUnits.size() - 1;
643 // Native units are the singular unit of a leaf register. Register aliasing
644 // is completely characterized by native units. Adopted units exist to give
645 // register additional weight but don't affect aliasing.
646 bool isNativeUnit(unsigned RUID) {
647 return RUID < NumNativeRegUnits;
650 unsigned getNumNativeRegUnits() const {
651 return NumNativeRegUnits;
654 RegUnit &getRegUnit(unsigned RUID) { return RegUnits[RUID]; }
655 const RegUnit &getRegUnit(unsigned RUID) const { return RegUnits[RUID]; }
657 std::list<CodeGenRegisterClass> &getRegClasses() { return RegClasses; }
659 const std::list<CodeGenRegisterClass> &getRegClasses() const {
663 // Find a register class from its def.
664 CodeGenRegisterClass *getRegClass(Record*);
666 /// getRegisterClassForRegister - Find the register class that contains the
667 /// specified physical register. If the register is not in a register
668 /// class, return null. If the register is in multiple classes, and the
669 /// classes have a superset-subset relationship and the same set of types,
670 /// return the superclass. Otherwise return null.
671 const CodeGenRegisterClass* getRegClassForRegister(Record *R);
673 // Get the sum of unit weights.
674 unsigned getRegUnitSetWeight(const std::vector<unsigned> &Units) const {
676 for (std::vector<unsigned>::const_iterator
677 I = Units.begin(), E = Units.end(); I != E; ++I)
678 Weight += getRegUnit(*I).Weight;
682 unsigned getRegSetIDAt(unsigned Order) const {
683 return RegUnitSetOrder[Order];
685 const RegUnitSet &getRegSetAt(unsigned Order) const {
686 return RegUnitSets[RegUnitSetOrder[Order]];
689 // Increase a RegUnitWeight.
690 void increaseRegUnitWeight(unsigned RUID, unsigned Inc) {
691 getRegUnit(RUID).Weight += Inc;
694 // Get the number of register pressure dimensions.
695 unsigned getNumRegPressureSets() const { return RegUnitSets.size(); }
697 // Get a set of register unit IDs for a given dimension of pressure.
698 const RegUnitSet &getRegPressureSet(unsigned Idx) const {
699 return RegUnitSets[Idx];
702 // The number of pressure set lists may be larget than the number of
703 // register classes if some register units appeared in a list of sets that
704 // did not correspond to an existing register class.
705 unsigned getNumRegClassPressureSetLists() const {
706 return RegClassUnitSets.size();
709 // Get a list of pressure set IDs for a register class. Liveness of a
710 // register in this class impacts each pressure set in this list by the
711 // weight of the register. An exact solution requires all registers in a
712 // class to have the same class, but it is not strictly guaranteed.
713 ArrayRef<unsigned> getRCPressureSetIDs(unsigned RCIdx) const {
714 return RegClassUnitSets[RCIdx];
717 // Computed derived records such as missing sub-register indices.
718 void computeDerivedInfo();
720 // Compute the set of registers completely covered by the registers in Regs.
721 // The returned BitVector will have a bit set for each register in Regs,
722 // all sub-registers, and all super-registers that are covered by the
723 // registers in Regs.
725 // This is used to compute the mask of call-preserved registers from a list
727 BitVector computeCoveredRegisters(ArrayRef<Record*> Regs);
729 // Bit mask of lanes that cover their registers. A sub-register index whose
730 // LaneMask is contained in CoveringLanes will be completely covered by
731 // another sub-register with the same or larger lane mask.
732 unsigned CoveringLanes;