* Simplify TargetRegisterClass implementations

* Change regclass iterators to use an extra level of pointers


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-12-15 18:40:36 +00:00
parent aa8dad5561
commit 439b76730d
2 changed files with 9 additions and 26 deletions

View File

@ -20,11 +20,7 @@ namespace {
#include "X86RegisterInfo.def"
};
class X86ByteRegisterClass : public TargetRegisterClass {
protected:
public:
X86ByteRegisterClass() {}
struct X86ByteRegisterClass : public TargetRegisterClass {
unsigned getNumRegs() const {
return sizeof(X86ByteRegisterClassRegs)/
sizeof(X86ByteRegisterClassRegs[0]);
@ -35,7 +31,6 @@ namespace {
}
unsigned getDataSize() const { return 1; }
} X86ByteRegisterClassInstance;
@ -48,11 +43,7 @@ namespace {
#include "X86RegisterInfo.def"
};
class X86ShortRegisterClass : public TargetRegisterClass {
protected:
public:
X86ShortRegisterClass() {}
struct X86ShortRegisterClass : public TargetRegisterClass {
unsigned getNumRegs() const {
return sizeof(X86ShortRegisterClassRegs)/
sizeof(X86ShortRegisterClassRegs[0]); }
@ -61,7 +52,6 @@ namespace {
return X86ShortRegisterClassRegs[idx];
}
unsigned getDataSize() const { return 2; }
} X86ShortRegisterClassInstance;
//
@ -74,11 +64,7 @@ namespace {
#include "X86RegisterInfo.def"
};
class X86IntRegisterClass : public TargetRegisterClass {
protected:
public:
X86IntRegisterClass() {}
struct X86IntRegisterClass : public TargetRegisterClass {
unsigned getNumRegs() const {
return sizeof(X86IntRegisterClassRegs)/
sizeof(X86IntRegisterClassRegs[0]); }
@ -87,7 +73,6 @@ namespace {
return X86IntRegisterClassRegs[idx];
}
unsigned getDataSize() const { return 4; }
} X86IntRegisterClassInstance;
@ -120,21 +105,19 @@ namespace {
assert(0 && "Invalid type to getClass!");
return 0; // not reached
}
}
}
MRegisterInfo::const_iterator X86RegisterInfo::const_regclass_begin() const {
return X86RegClasses[0];
MRegisterInfo::const_iterator X86RegisterInfo::regclass_begin() const {
return X86RegClasses;
}
unsigned X86RegisterInfo::getNumRegClasses() const {
return sizeof(X86RegClasses)/sizeof(X86RegClasses[0]);
}
MRegisterInfo::const_iterator X86RegisterInfo::const_regclass_end() const {
return (X86RegClasses[0]+getNumRegClasses());
MRegisterInfo::const_iterator X86RegisterInfo::regclass_end() const {
return X86RegClasses+getNumRegClasses();
}

View File

@ -14,8 +14,8 @@ class Type;
struct X86RegisterInfo : public MRegisterInfo {
X86RegisterInfo();
MRegisterInfo::const_iterator const_regclass_begin() const;
MRegisterInfo::const_iterator const_regclass_end() const;
MRegisterInfo::const_iterator regclass_begin() const;
MRegisterInfo::const_iterator regclass_end() const;
MachineBasicBlock::iterator
storeReg2RegOffset(MachineBasicBlock *MBB,