From: Jakob Stoklund Olesen Date: Thu, 6 Oct 2011 00:08:27 +0000 (+0000) Subject: Remove the TRI::getSubRegisterRegClass() hook. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d9c1fa5205cc31474f9f9a6d715af32098a1a719;p=oota-llvm.git Remove the TRI::getSubRegisterRegClass() hook. This restores my karma after I added TRI::getSubClassWithSubReg(). Register constraints are applied 'backwards'. Starting from the register class required by an instruction operand, the correct question is: 'How can I constrain the super-register register class so all its sub-registers satisfy the instruction constraint?' The getMatchingSuperRegClass() hook answers that. We never need to go 'forwards': Starting from a super-register register class, what register class are the sub-registers in? The getSubRegisterRegClass() hook did that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141258 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h index f77aa546c12..682aa50736d 100644 --- a/include/llvm/Target/TargetRegisterInfo.h +++ b/include/llvm/Target/TargetRegisterInfo.h @@ -42,16 +42,14 @@ private: const vt_iterator VTs; const unsigned *SubClassMask; const sc_iterator SuperClasses; - const sc_iterator SubRegClasses; const sc_iterator SuperRegClasses; public: TargetRegisterClass(const MCRegisterClass *MC, const EVT *vts, const unsigned *subcm, const TargetRegisterClass * const *supcs, - const TargetRegisterClass * const *subregcs, const TargetRegisterClass * const *superregcs) : MC(MC), VTs(vts), SubClassMask(subcm), SuperClasses(supcs), - SubRegClasses(subregcs), SuperRegClasses(superregcs) {} + SuperRegClasses(superregcs) {} virtual ~TargetRegisterClass() {} // Allow subclasses @@ -127,25 +125,6 @@ public: return I; } - /// subregclasses_begin / subregclasses_end - Loop over all of - /// the subreg register classes of this register class. - sc_iterator subregclasses_begin() const { - return SubRegClasses; - } - - sc_iterator subregclasses_end() const { - sc_iterator I = SubRegClasses; - while (*I != NULL) ++I; - return I; - } - - /// getSubRegisterRegClass - Return the register class of subregisters with - /// index SubIdx, or NULL if no such class exists. - const TargetRegisterClass* getSubRegisterRegClass(unsigned SubIdx) const { - assert(SubIdx>0 && "Invalid subregister index"); - return SubRegClasses[SubIdx-1]; - } - /// superregclasses_begin / superregclasses_end - Loop over all of /// the superreg register classes of this register class. sc_iterator superregclasses_begin() const { diff --git a/utils/TableGen/RegisterInfoEmitter.cpp b/utils/TableGen/RegisterInfoEmitter.cpp index a66a78cf918..b0f4ffc84e0 100644 --- a/utils/TableGen/RegisterInfoEmitter.cpp +++ b/utils/TableGen/RegisterInfoEmitter.cpp @@ -543,40 +543,17 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, unsigned NumSubRegIndices = RegBank.getSubRegIndices().size(); if (NumSubRegIndices) { - // Emit the sub-register classes for each RegisterClass + // Compute the super-register classes for each RegisterClass for (unsigned rc = 0, e = RegisterClasses.size(); rc != e; ++rc) { const CodeGenRegisterClass &RC = *RegisterClasses[rc]; - std::vector SRC(NumSubRegIndices); for (DenseMap::const_iterator i = RC.SubRegClasses.begin(), e = RC.SubRegClasses.end(); i != e; ++i) { - // Build SRC array. - unsigned idx = RegBank.getSubRegIndexNo(i->first); - SRC.at(idx-1) = i->second; - // Find the register class number of i->second for SuperRegClassMap. const CodeGenRegisterClass *RC2 = RegBank.getRegClass(i->second); assert(RC2 && "Invalid register class in SubRegClasses"); SuperRegClassMap[RC2->EnumValue].insert(rc); } - - // Give the register class a legal C name if it's anonymous. - std::string Name = RC.getName(); - - OS << " // " << Name - << " Sub-register Classes...\n" - << " static const TargetRegisterClass* const " - << Name << "SubRegClasses[] = {\n "; - - for (unsigned idx = 0; idx != NumSubRegIndices; ++idx) { - if (idx) - OS << ", "; - if (SRC[idx]) - OS << "&" << getQualifiedName(SRC[idx]) << "RegClass"; - else - OS << "0"; - } - OS << "\n };\n\n"; } // Emit the super-register classes for each RegisterClass @@ -651,9 +628,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target, OS << "NullRegClasses, "; else OS << RC.getName() + "Superclasses, "; - OS << (NumSubRegIndices ? RC.getName() + "Sub" : std::string("Null")) - << "RegClasses, " - << (NumSubRegIndices ? RC.getName() + "Super" : std::string("Null")) + OS << (NumSubRegIndices ? RC.getName() + "Super" : std::string("Null")) << "RegClasses" << ") {}\n"; if (!RC.AltOrderSelect.empty()) {