Added option -align-loops=<true/false> to disable loop aligner pass.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 28 Feb 2008 23:29:57 +0000 (23:29 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 28 Feb 2008 23:29:57 +0000 (23:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47736 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LLVMTargetMachine.cpp
lib/CodeGen/LoopAligner.cpp
lib/Target/X86/X86TargetMachine.cpp
lib/Target/X86/X86TargetMachine.h

index 5611b03ba764f2bc3aea397f91da7700753e39d2..32fbc15e1315aee039b6b4e02a78e8ee9f8f7632 100644 (file)
@@ -37,6 +37,9 @@ static cl::opt<bool>
 EnableSinking("enable-sinking", cl::init(false), cl::Hidden,
               cl::desc("Perform sinking on machine code"));
 static cl::opt<bool>
+AlignLoops("align-loops", cl::init(true), cl::Hidden,
+              cl::desc("Align loop headers"));
+static cl::opt<bool>
 PerformLICM("machine-licm",
             cl::init(false), cl::Hidden,
             cl::desc("Perform loop-invariant code motion on machine code"));
@@ -132,6 +135,9 @@ LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
   if (addPreEmitPass(PM, Fast) && PrintMachineCode)
     PM.add(createMachineFunctionPrinterPass(cerr));
 
+  if (AlignLoops)
+    PM.add(createLoopAlignerPass());
+
   switch (FileType) {
   default:
     break;
index a40bb50565d3863bc520d726ea4bab6e06beaf9a..c5a3f549a76535826eb2e1a2ae77b7baf36d3c81 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetMachine.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 using namespace llvm;
index ad2775a64844e5bdef37e100c33e713aacc40fb0..850eb386fb5b81805c9368e1fb7aed629d822c41 100644 (file)
@@ -164,13 +164,6 @@ bool X86TargetMachine::addPostRegAlloc(FunctionPassManager &PM, bool Fast) {
   return true;  // -print-machineinstr should print after this.
 }
 
-bool X86TargetMachine::addPreEmitPass(FunctionPassManager &PM, bool Fast) {
-  if (Fast) return false;
-
-  PM.add(createLoopAlignerPass());
-  return true;
-}
-
 bool X86TargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast, 
                                           std::ostream &Out) {
   PM.add(createX86CodePrinterPass(Out, *this));
index 61e4451d7ab237374b645f7f3fd728b58b3512f5..e9148b5a52edb55879a6f44d0e854e62af9f6aba 100644 (file)
@@ -63,7 +63,6 @@ public:
   // Set up the pass pipeline.
   virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);  
   virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast);
-  virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast);
   virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, 
                                   std::ostream &Out);
   virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,