Eliminate CodeGenOptions::TimePasses.

llvm-svn: 90118
This commit is contained in:
Daniel Dunbar 2009-11-30 08:39:52 +00:00
parent de18224d9c
commit 8e70505692
7 changed files with 20 additions and 22 deletions

View File

@ -83,6 +83,7 @@ ASTConsumer *CreateBackendConsumer(BackendAction Action,
const LangOptions &Features,
const CodeGenOptions &CodeGenOpts,
const TargetOptions &TargetOpts,
bool TimePasses,
const std::string &ModuleID,
llvm::raw_ostream *OS,
llvm::LLVMContext& C);

View File

@ -194,7 +194,6 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
// FIXME: Eliminate this dependency?
// if (Lang.CPlusPlus)
// Opts.NoCommon = 1;
// Opts.TimePasses = TimePasses;
// FIXME: Put elsewhere?
#ifdef NDEBUG

View File

@ -76,8 +76,9 @@ namespace {
public:
BackendConsumer(BackendAction action, Diagnostic &Diags,
const LangOptions &langopts, const CodeGenOptions &compopts,
const TargetOptions &targetopts, const std::string &infile,
llvm::raw_ostream* OS, LLVMContext& C) :
const TargetOptions &targetopts, bool TimePasses,
const std::string &infile, llvm::raw_ostream *OS,
LLVMContext& C) :
Action(action),
CodeGenOpts(compopts),
LangOpts(langopts),
@ -93,8 +94,7 @@ namespace {
FormattedOutStream.setStream(*AsmOutStream,
formatted_raw_ostream::PRESERVE_STREAM);
// Enable -time-passes if -ftime-report is enabled.
llvm::TimePassesIsEnabled = CodeGenOpts.TimePasses;
llvm::TimePassesIsEnabled = TimePasses;
}
~BackendConsumer() {
@ -108,7 +108,7 @@ namespace {
virtual void Initialize(ASTContext &Ctx) {
Context = &Ctx;
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->Initialize(Ctx);
@ -117,7 +117,7 @@ namespace {
ModuleProvider = new ExistingModuleProvider(TheModule);
TheTargetData = new llvm::TargetData(Ctx.Target.getTargetDescription());
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.stopTimer();
}
@ -126,24 +126,24 @@ namespace {
Context->getSourceManager(),
"LLVM IR generation of declaration");
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->HandleTopLevelDecl(D);
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.stopTimer();
}
virtual void HandleTranslationUnit(ASTContext &C) {
{
PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->HandleTranslationUnit(C);
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.stopTimer();
}
@ -239,7 +239,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
BackendArgs.push_back("-nozero-initialized-in-bss");
BackendArgs.push_back("-relocation-model");
BackendArgs.push_back(CodeGenOpts.RelocationModel.c_str());
if (CodeGenOpts.TimePasses)
if (llvm::TimePassesIsEnabled)
BackendArgs.push_back("-time-passes");
if (CodeGenOpts.UnwindTables)
BackendArgs.push_back("-unwind-tables");
@ -350,7 +350,7 @@ void BackendConsumer::EmitAssembly() {
if (!TheModule || !TheTargetData)
return;
TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : 0);
TimeRegion Region(llvm::TimePassesIsEnabled ? &CodeGenerationTime : 0);
// Make sure IR generation is happy with the module. This is
// released by the module provider.
@ -407,9 +407,10 @@ ASTConsumer *clang::CreateBackendConsumer(BackendAction Action,
const LangOptions &LangOpts,
const CodeGenOptions &CodeGenOpts,
const TargetOptions &TargetOpts,
bool TimePasses,
const std::string& InFile,
llvm::raw_ostream* OS,
LLVMContext& C) {
return new BackendConsumer(Action, Diags, LangOpts, CodeGenOpts,
TargetOpts, InFile, OS, C);
TargetOpts, TimePasses, InFile, OS, C);
}

View File

@ -170,7 +170,8 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI,
OS.reset(CI.createDefaultOutputFile(true, InFile, "bc"));
return CreateBackendConsumer(BA, CI.getDiagnostics(), CI.getLangOpts(),
CI.getCodeGenOpts(), CI.getTargetOpts(), InFile,
CI.getCodeGenOpts(), CI.getTargetOpts(),
CI.getFrontendOpts().ShowTimers, InFile,
OS.take(), CI.getLLVMContext());
}

View File

@ -795,8 +795,7 @@ void clang::InitializeAnalyzerOptions(AnalyzerOptions &Opts) {
}
void clang::InitializeCodeGenOptions(CodeGenOptions &Opts,
const LangOptions &Lang,
bool TimePasses) {
const LangOptions &Lang) {
using namespace codegenoptions;
// -Os implies -O2
@ -830,7 +829,6 @@ void clang::InitializeCodeGenOptions(CodeGenOptions &Opts,
// FIXME: Eliminate this dependency?
if (Lang.CPlusPlus)
Opts.NoCommon = 1;
Opts.TimePasses = TimePasses;
#ifdef NDEBUG
Opts.VerifyModule = 0;

View File

@ -30,8 +30,7 @@ class TargetOptions;
void InitializeAnalyzerOptions(AnalyzerOptions &Opts);
void InitializeCodeGenOptions(CodeGenOptions &Opts,
const LangOptions &Lang,
bool TimePasses);
const LangOptions &Lang);
void InitializeDependencyOutputOptions(DependencyOutputOptions &Opts);

View File

@ -183,8 +183,7 @@ static bool ConstructCompilerInvocation(CompilerInvocation &Opts,
InitializePreprocessorOutputOptions(Opts.getPreprocessorOutputOpts());
// Initialize backend options.
InitializeCodeGenOptions(Opts.getCodeGenOpts(), Opts.getLangOpts(),
Opts.getFrontendOpts().ShowTimers);
InitializeCodeGenOptions(Opts.getCodeGenOpts(), Opts.getLangOpts());
return true;
}