Adding option to llc for ModuloScheduling. By default it is turned off.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17959 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index 3e0e8b9..f5e1951 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -66,6 +66,9 @@
   cl::opt<bool> DisableStrip("disable-strip",
                       cl::desc("Do not strip the LLVM bytecode in executable"));
 
+  
+  cl::opt<bool> EnableModSched("enable-ModSched", cl::desc("Enable modulo scheduling pass instead of local scheduling"));
+
   // Register the target.
   RegisterTarget<SparcV9TargetMachine> X("sparcv9", "  SPARC V9");
 }
@@ -192,9 +195,17 @@
   
   PM.add(createSparcV9BurgInstSelector(*this));
 
-  if (!DisableSched)
-    PM.add(createInstructionSchedulingWithSSAPass(*this));
+  if(PrintMachineCode)
+    PM.add(createMachineFunctionPrinterPass(&std::cerr, "Before modulo scheduling:\n"));
 
+  //Use ModuloScheduling if enabled, otherwise use local scheduling if not disabled.
+  if(EnableModSched)
+    PM.add(createModuloSchedulingPass(*this));
+  else {
+    if (!DisableSched)
+      PM.add(createInstructionSchedulingWithSSAPass(*this));
+  }
+  
   if (PrintMachineCode)
     PM.add(createMachineFunctionPrinterPass(&std::cerr, "Before reg alloc:\n"));