Checkin changes to:
1. Clean up the TargetMachine structure.  No more wierd pointers that have to
   be cast around and taken care of by the target.
2. Instruction Scheduling now takes the schedinfo as an argument.  The same
   should be done with the instinfo, it just isn't now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@565 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index 80de2e7..cf09734 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -8,6 +8,7 @@
 //	7/15/01	 -  Vikram Adve  -  Created
 //**************************************************************************/
 
+#include "llvm/CodeGen/Sparc.h"
 #include "SparcInternals.h"
 #include "llvm/Method.h"
 #include "llvm/CodeGen/InstrScheduling.h"
@@ -91,22 +92,14 @@
 // 
 //---------------------------------------------------------------------------
 
-UltraSparc::UltraSparc() : TargetMachine("UltraSparc-Native") {
-  machineInstrInfo = new UltraSparcInstrInfo();
-  machineSchedInfo = new UltraSparcSchedInfo(machineInstrInfo); 
-  
+UltraSparc::UltraSparc() : TargetMachine("UltraSparc-Native"),
+			   InstSchedulingInfo(&InstInfo) {
   optSizeForSubWordData = 4;
   minMemOpWordSize = 8; 
   maxAtomicMemOpWordSize = 8;
   zeroRegNum = 0;			// %g0 always gives 0 on Sparc
 }
 
-UltraSparc::~UltraSparc() {
-  delete (UltraSparcInstrInfo*) machineInstrInfo;
-  delete (UltraSparcSchedInfo*) machineSchedInfo;
-}
-
-
 bool UltraSparc::compileMethod(Method *M) {
   if (SelectInstructionsForMethod(M, *this)) {
     cerr << "Instruction selection failed for method " << M->getName()
@@ -114,10 +107,15 @@
     return true;
   }
   
-  if (ScheduleInstructionsWithSSA(M, *this)) {
+  if (ScheduleInstructionsWithSSA(M, *this, InstSchedulingInfo)) {
     cerr << "Instruction scheduling before allocation failed for method "
        << M->getName() << "\n\n";
     return true;
   }
   return false;
 }
+
+// allocateSparcTargetMachine - Allocate and return a subclass of TargetMachine
+// that implements the Sparc backend.
+//
+TargetMachine *allocateSparcTargetMachine() { return new UltraSparc(); }