}
static void InitializeCompileOptions(CompileOptions &Opts,
- const LangOptions &LangOpts,
const llvm::StringMap<bool> &Features) {
using namespace codegenoptions;
Opts.OptimizeSize = OptSize;
: CompileOptions::OnlyAlwaysInlining;
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
- Opts.SimplifyLibCalls = !LangOpts.NoBuiltin;
+ Opts.SimplifyLibCalls = 1;
#ifdef NDEBUG
Opts.VerifyModule = 0;
Opts.Features.push_back(Name);
}
- Opts.NoCommon = NoCommon | LangOpts.CPlusPlus;
+ Opts.NoCommon = NoCommon;
// Handle -ftime-report.
Opts.TimePasses = TimeReport;
Opts.MergeAllConstants = !NoMergeConstants;
}
+static void FinalizeCompileOptions(CompileOptions &Opts,
+ const LangOptions &Lang) {
+ if (Lang.NoBuiltin)
+ Opts.SimplifyLibCalls = 0;
+ if (Lang.CPlusPlus)
+ Opts.NoCommon = 1;
+}
+
//===----------------------------------------------------------------------===//
// Fix-It Options
//===----------------------------------------------------------------------===//
// Compute the feature set, which may effect the language.
ComputeFeatureMap(Target, Opts.getTargetFeatures());
+ // Initialize backend options, which may also be used to key some language
+ // options.
+ InitializeCompileOptions(Opts.getCompileOpts(), Opts.getTargetFeatures());
+
// Initialize language options.
LangOptions LangInfo;
// Initialize the other preprocessor options.
InitializePreprocessorOptions(Opts.getPreprocessorOpts());
- // Initialize backend options.
- InitializeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts(),
- Opts.getTargetFeatures());
+ // Finalize, some code generation options.
+ FinalizeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts());
}
int main(int argc, char **argv) {