diff options
author | Chris Lattner <sabre@nondot.org> | 2002-02-04 15:54:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-02-04 15:54:09 +0000 |
commit | 2f9b28e59a1e10152cd32f2c717e89d47a2fd7e3 (patch) | |
tree | a1c4a7e402c3a8f8db336bc5a65a6db2a43b1752 /lib/CodeGen | |
parent | 59ba109d9dfe37f27fd1d0c993a323c43fe0e49c (diff) |
Convert RegisterAllocator interface to opaque pass type, so that users do not
need to know _anything_ about RegAlloc to use it. Well in the end maybe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1681 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/RegAlloc/PhyRegAlloc.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp index 7efb469b45..46f045c5e2 100644 --- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp +++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp @@ -32,21 +32,35 @@ cl::Enum<RegAllocDebugLevel_t> DEBUG_RA("dregalloc", cl::NoFlags, clEnumValN(RA_DEBUG_Verbose, "v", "enable extra debug output"), 0); -bool RegisterAllocation::runOnMethod(Method *M) { - if (DEBUG_RA) - cerr << "\n******************** Method "<< M->getName() - << " ********************\n"; - - MethodLiveVarInfo LVI(M); // Analyze live varaibles - LVI.analyze(); +//---------------------------------------------------------------------------- +// RegisterAllocation pass front end... +//---------------------------------------------------------------------------- +namespace { + class RegisterAllocator : public MethodPass { + TargetMachine &Target; + public: + inline RegisterAllocator(TargetMachine &T) : Target(T) {} - PhyRegAlloc PRA(M, Target, &LVI); // allocate registers - PRA.allocateRegisters(); - - if (DEBUG_RA) cerr << "\nRegister allocation complete!\n"; - return false; + bool runOnMethod(Method *M) { + if (DEBUG_RA) + cerr << "\n******************** Method "<< M->getName() + << " ********************\n"; + + MethodLiveVarInfo LVI(M); // Analyze live varaibles + LVI.analyze(); + + PhyRegAlloc PRA(M, Target, &LVI); // allocate registers + PRA.allocateRegisters(); + + if (DEBUG_RA) cerr << "\nRegister allocation complete!\n"; + return false; + } + }; } +MethodPass *getRegisterAllocator(TargetMachine &T) { + return new RegisterAllocator(T); +} //---------------------------------------------------------------------------- // Constructor: Init local composite objects and create register classes. |