Add optimize-for-size knob.
authorDevang Patel <dpatel@apple.com>
Tue, 25 Mar 2008 21:02:35 +0000 (21:02 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 25 Mar 2008 21:02:35 +0000 (21:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48793 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetOptions.h
lib/Target/TargetMachine.cpp

index 554a32b9d9f1c17ea4aa2fba3a91abcd7b7b40fd..72bb272015a78b87ae7ba0cf4830ea66ae026968 100644 (file)
@@ -78,6 +78,10 @@ namespace llvm {
   /// on the commandline. When the flag is on, the target will perform tail call
   /// optimization (pop the caller's stack) providing it supports it.
   extern bool PerformTailCallOpt;
+
+  /// OptimizeForSize - When this flags is set, code generator avoids optimization
+  /// that increases size.
+  extern bool OptimizeForSize;
 } // End llvm namespace
 
 #endif
index 15164ca28dfc0a59f82bf593b9b74cc4670ff0f9..b9a68789ab59755e0b06fc8569570bbf86685851 100644 (file)
@@ -34,6 +34,7 @@ namespace llvm {
   Reloc::Model RelocationModel;
   CodeModel::Model CMModel;
   bool PerformTailCallOpt;
+  bool OptimizeForSize;
 }
 namespace {
   cl::opt<bool, true> PrintCode("print-machineinstrs",
@@ -123,6 +124,11 @@ namespace {
                            cl::desc("Turn on tail call optimization."),
                            cl::location(PerformTailCallOpt),
                            cl::init(false));
+  cl::opt<bool, true>
+  EnableOptimizeForSize("optimizeforsize",
+                        cl::desc("Optimize for size."),
+                           cl::location(OptimizeForSize),
+                           cl::init(false));
 }
 
 //---------------------------------------------------------------------------