Split RegisterAllocation stuff OUT of Sparc.cpp into a well defined pass
that has a very minimal interface (like it should have).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1667 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index 2476a5f..8ca947a 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -16,7 +16,7 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
-#include "llvm/CodeGen/PhyRegAlloc.h"
+#include "llvm/CodeGen/RegisterAllocation.h"
#include "llvm/Method.h"
#include "llvm/PassManager.h"
#include <iostream>
@@ -40,32 +40,6 @@
TargetMachine *allocateSparcTargetMachine() { return new UltraSparc(); }
-//----------------------------------------------------------------------------
-// Entry point for register allocation for a module
-//----------------------------------------------------------------------------
-
-class RegisterAllocation : public MethodPass {
- TargetMachine &Target;
-public:
- inline RegisterAllocation(TargetMachine &T) : Target(T) {}
- 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;
- }
-};
-
-static MachineInstr* minstrVec[MAX_INSTR_PER_VMINSTR];
-
//---------------------------------------------------------------------------
// class InsertPrologEpilogCode
//
@@ -77,6 +51,7 @@
// with the leaf method optimization.
//
//---------------------------------------------------------------------------
+static MachineInstr* minstrVec[MAX_INSTR_PER_VMINSTR];
class InsertPrologEpilogCode : public MethodPass {
TargetMachine &Target;