From 439b76730d40e8a8a95f2231bce95ff211a95ead Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 15 Dec 2002 18:40:36 +0000 Subject: [PATCH] * 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 --- lib/Target/X86/X86RegisterClasses.cpp | 31 ++++++--------------------- lib/Target/X86/X86RegisterInfo.h | 4 ++-- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/lib/Target/X86/X86RegisterClasses.cpp b/lib/Target/X86/X86RegisterClasses.cpp index f73942afbfd..ebdfa470fa0 100644 --- a/lib/Target/X86/X86RegisterClasses.cpp +++ b/lib/Target/X86/X86RegisterClasses.cpp @@ -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(); } diff --git a/lib/Target/X86/X86RegisterInfo.h b/lib/Target/X86/X86RegisterInfo.h index 78d3bdda813..5b0c30cdde5 100644 --- a/lib/Target/X86/X86RegisterInfo.h +++ b/lib/Target/X86/X86RegisterInfo.h @@ -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,