Add a new option to indicate we want the code generator to emit code quickly,
authorChris Lattner <sabre@nondot.org>
Tue, 8 Nov 2005 02:12:47 +0000 (02:12 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 8 Nov 2005 02:12:47 +0000 (02:12 +0000)
not spending tons of time microoptimizing it.  This is useful for an -O0
style of build.

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

include/llvm/Target/TargetMachine.h
lib/Target/PowerPC/PPCTargetMachine.cpp
lib/Target/PowerPC/PPCTargetMachine.h

index aae7d901fbebf93f4becb4ccc17da8d7548072ed..d13a4ed78df89688662f2e3e279b49a30f288509 100644 (file)
@@ -143,11 +143,12 @@ public:
 
   /// addPassesToEmitFile - Add passes to the specified pass manager to get
   /// the specified file emitted.  Typically this will involve several steps of
-  /// code generation.  This method should return true if emission of this file
-  /// type is not supported.
+  /// code generation.  If Fast is set to true, the code generator should emit
+  /// code as fast as possible, without regard for compile time.  This method
+  /// should return true if emission of this file type is not supported.
   ///
   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
-                                   CodeGenFileType FileType) {
+                                   CodeGenFileType FileType, bool Fast) {
     return true;
   }
 
index 9a88750b398eba927e7a2b58c57426cc8e502046..c92122ec7d8d5ae1ce67351f231509ed7d68fa15 100644 (file)
@@ -77,11 +77,12 @@ PPCTargetMachine::PPCTargetMachine(const Module &M, IntrinsicLowering *IL,
 ///
 bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
                                            std::ostream &Out,
-                                           CodeGenFileType FileType) {
+                                           CodeGenFileType FileType,
+                                           bool Fast) {
   if (FileType != TargetMachine::AssemblyFile) return true;
 
   // Run loop strength reduction before anything else.
-  PM.add(createLoopStrengthReducePass());
+  if (!Fast) PM.add(createLoopStrengthReducePass());
 
   // FIXME: Implement efficient support for garbage collection intrinsics.
   PM.add(createLowerGCPass());
@@ -90,7 +91,7 @@ bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
   PM.add(createLowerInvokePass());
   
   // Clean up after other passes, e.g. merging critical edges.
-  PM.add(createCFGSimplificationPass());
+  if (!Fast) PM.add(createCFGSimplificationPass());
 
   // FIXME: Implement the switch instruction in the instruction selector!
   PM.add(createLowerSwitchPass());
index 1295a599107e4b656c4e8396a9e24626d58966f5..dff48348de58165042c290b5fbf7566519211837 100644 (file)
@@ -53,7 +53,7 @@ public:
   static unsigned getModuleMatchQuality(const Module &M);
   
   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
-                                   CodeGenFileType FileType);
+                                   CodeGenFileType FileType, bool Fast);
   
   bool addPassesToEmitMachineCode(FunctionPassManager &PM,
                                   MachineCodeEmitter &MCE);