forked from OSchip/llvm-project
Frontend: Add CodeGenOptions::SimplifyLibCalls, and eliminate LangOptions argument to BackendConsumer.
llvm-svn: 105574
This commit is contained in:
parent
8b3b3a1035
commit
6d5824f5bf
|
@ -55,6 +55,7 @@ public:
|
|||
unsigned OptimizationLevel : 3; /// The -O[0-4] option specified.
|
||||
unsigned OptimizeSize : 1; /// If -Os is specified.
|
||||
unsigned RelaxAll : 1; /// Relax all machine code instructions.
|
||||
unsigned SimplifyLibCalls : 1; /// Set when -fbuiltin is enabled.
|
||||
unsigned SoftFloat : 1; /// -soft-float.
|
||||
unsigned TimePasses : 1; /// Set when -ftime-report is enabled.
|
||||
unsigned UnitAtATime : 1; /// Unused. For mirroring GCC optimization
|
||||
|
@ -110,6 +111,7 @@ public:
|
|||
OptimizationLevel = 0;
|
||||
OptimizeSize = 0;
|
||||
RelaxAll = 0;
|
||||
SimplifyLibCalls = 1;
|
||||
SoftFloat = 0;
|
||||
TimePasses = 0;
|
||||
UnitAtATime = 1;
|
||||
|
|
|
@ -56,7 +56,6 @@ namespace {
|
|||
Diagnostic &Diags;
|
||||
BackendAction Action;
|
||||
const CodeGenOptions &CodeGenOpts;
|
||||
const LangOptions &LangOpts;
|
||||
const TargetOptions &TargetOpts;
|
||||
llvm::raw_ostream *AsmOutStream;
|
||||
llvm::formatted_raw_ostream FormattedOutStream;
|
||||
|
@ -89,14 +88,13 @@ namespace {
|
|||
|
||||
public:
|
||||
BackendConsumer(BackendAction action, Diagnostic &_Diags,
|
||||
const LangOptions &langopts, const CodeGenOptions &compopts,
|
||||
const CodeGenOptions &compopts,
|
||||
const TargetOptions &targetopts, bool TimePasses,
|
||||
const std::string &infile, llvm::raw_ostream *OS,
|
||||
LLVMContext &C) :
|
||||
Diags(_Diags),
|
||||
Action(action),
|
||||
CodeGenOpts(compopts),
|
||||
LangOpts(langopts),
|
||||
TargetOpts(targetopts),
|
||||
AsmOutStream(OS),
|
||||
LLVMIRGeneration("LLVM IR Generation Time"),
|
||||
|
@ -394,7 +392,7 @@ void BackendConsumer::CreatePasses() {
|
|||
llvm::createStandardModulePasses(PM, OptLevel, CodeGenOpts.OptimizeSize,
|
||||
CodeGenOpts.UnitAtATime,
|
||||
CodeGenOpts.UnrollLoops,
|
||||
/*SimplifyLibCalls=*/!LangOpts.NoBuiltin,
|
||||
CodeGenOpts.SimplifyLibCalls,
|
||||
/*HaveExceptions=*/true,
|
||||
InliningPass);
|
||||
}
|
||||
|
@ -566,7 +564,7 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI,
|
|||
if (BA != Backend_EmitNothing && !OS)
|
||||
return 0;
|
||||
|
||||
return new BackendConsumer(BA, CI.getDiagnostics(), CI.getLangOpts(),
|
||||
return new BackendConsumer(BA, CI.getDiagnostics(),
|
||||
CI.getCodeGenOpts(), CI.getTargetOpts(),
|
||||
CI.getFrontendOpts().ShowTimers, InFile, OS.take(),
|
||||
CI.getLLVMContext());
|
||||
|
|
|
@ -806,6 +806,8 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
|
|||
Opts.NoCommon = Args.hasArg(OPT_fno_common);
|
||||
Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
|
||||
Opts.OptimizeSize = Args.hasArg(OPT_Os);
|
||||
Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
|
||||
Args.hasArg(OPT_ffreestanding));
|
||||
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize);
|
||||
|
||||
Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
|
||||
|
|
Loading…
Reference in New Issue