PreSelection is not optional, it performs a necessary and vital transformation
authorMisha Brukman <brukman+llvm@gmail.com>
Fri, 7 Nov 2003 20:33:25 +0000 (20:33 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Fri, 7 Nov 2003 20:33:25 +0000 (20:33 +0000)
for the Sparc backend: breaking up constant expressions. Thus, we cannot have it
guarded by a conditional, it should never be disabled.

Also, it's now available for the JIT since it is a FunctionPass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9791 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9TargetMachine.cpp

index 738413fc599502fed7f0b57c21e8921fb4721d86..1fcd4b852a8f80d08f17743975251274f30e6abc 100644 (file)
@@ -42,9 +42,6 @@ const TargetInstrDescriptor SparcMachineInstrDesc[] = {
 // Command line options to control choice of code generation passes.
 //---------------------------------------------------------------------------
 
-static cl::opt<bool> DisablePreOpt("disable-preopt",
-              cl::desc("Disable optimizations prior to instruction selection"));
-
 static cl::opt<bool> DisableSched("disable-sched",
                                   cl::desc("Disable local scheduling pass"));
 
@@ -178,15 +175,13 @@ bool UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
   //so %fp+offset-8 and %fp+offset-16 are empty slots now!
   PM.add(createStackSlotsPass(*this));
 
-  if (!DisablePreOpt) {
-    // Specialize LLVM code for this target machine
-    PM.add(createPreSelectionPass(*this));
-    // Run basic dataflow optimizations on LLVM code
-    PM.add(createReassociatePass());
-    PM.add(createLICMPass());
-    PM.add(createGCSEPass());
-  }
-  
+  // Specialize LLVM code for this target machine
+  PM.add(createPreSelectionPass(*this));
+  // Run basic dataflow optimizations on LLVM code
+  PM.add(createReassociatePass());
+  PM.add(createLICMPass());
+  PM.add(createGCSEPass());
+
   // If LLVM dumping after transformations is requested, add it to the pipeline
   if (DumpInput)
     PM.add(new PrintFunctionPass("Input code to instr. selection:\n",
@@ -252,6 +247,14 @@ bool UltraSparc::addPassesToJITCompile(FunctionPassManager &PM) {
   // Construct and initialize the MachineFunction object for this fn.
   PM.add(createMachineCodeConstructionPass(*this));
 
+  // Specialize LLVM code for this target machine and then
+  // run basic dataflow optimizations on LLVM code.
+  PM.add(createPreSelectionPass(*this));
+  // Run basic dataflow optimizations on LLVM code
+  PM.add(createReassociatePass());
+  PM.add(createLICMPass());
+  PM.add(createGCSEPass());
+
   PM.add(createInstructionSelectionPass(*this));
 
   PM.add(getRegisterAllocator(*this));