1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Add some methods

llvm-svn: 24596
This commit is contained in:
Chris Lattner 2005-12-05 02:35:08 +00:00
parent 487742bf85
commit e64b6d64d0
2 changed files with 22 additions and 1 deletions

View File

@ -42,6 +42,8 @@ namespace llvm {
const std::string &getName() const;
unsigned getNumValueTypes() const { return VTs.size(); }
const MVT::ValueType getValueTypeNum(unsigned VTNum) const {
if (VTNum < VTs.size())
return VTs[VTNum];

View File

@ -90,7 +90,26 @@ public:
assert(0 && "Didn't find the register class");
abort();
}
/// getRegisterClassForRegister - Find the register class that contains the
/// specified physical register. If there register exists in multiple
/// register classes or is not in a register class, return null.
const CodeGenRegisterClass *getRegisterClassForRegister(Record *R) const {
const std::vector<CodeGenRegisterClass> &RCs = getRegisterClasses();
const CodeGenRegisterClass *FoundRC = 0;
for (unsigned i = 0, e = RCs.size(); i != e; ++i) {
const CodeGenRegisterClass &RC = RegisterClasses[i];
for (unsigned ei = 0, ee = RC.Elements.size(); ei != ee; ++ei) {
if (R == RC.Elements[ei]) {
if (FoundRC) return 0; // In multiple RC's
FoundRC = &RC;
break;
}
}
}
return FoundRC;
}
const std::vector<MVT::ValueType> &getLegalValueTypes() const {
if (LegalValueTypes.empty()) ReadLegalValueTypes();
return LegalValueTypes;