diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h index 554a32b9d9f..72bb272015a 100644 --- a/include/llvm/Target/TargetOptions.h +++ b/include/llvm/Target/TargetOptions.h @@ -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 diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 15164ca28df..b9a68789ab5 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -34,6 +34,7 @@ namespace llvm { Reloc::Model RelocationModel; CodeModel::Model CMModel; bool PerformTailCallOpt; + bool OptimizeForSize; } namespace { cl::opt PrintCode("print-machineinstrs", @@ -123,6 +124,11 @@ namespace { cl::desc("Turn on tail call optimization."), cl::location(PerformTailCallOpt), cl::init(false)); + cl::opt + EnableOptimizeForSize("optimizeforsize", + cl::desc("Optimize for size."), + cl::location(OptimizeForSize), + cl::init(false)); } //---------------------------------------------------------------------------