From: Chris Lattner Date: Wed, 18 Feb 2009 01:23:44 +0000 (+0000) Subject: move llvm backend specific #includes into Backend.cpp instead of Clang.cpp X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=445026698ca8f97ee7320464dedbe0d077b32d16;p=clang move llvm backend specific #includes into Backend.cpp instead of Clang.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64872 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/Backend.cpp b/Driver/Backend.cpp index 6eaffe9d9a..92b0c8fbc6 100644 --- a/Driver/Backend.cpp +++ b/Driver/Backend.cpp @@ -8,7 +8,6 @@ //===----------------------------------------------------------------------===// #include "ASTConsumers.h" - #include "clang/AST/ASTContext.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/TranslationUnit.h" @@ -35,7 +34,6 @@ #include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/IPO.h" - using namespace clang; using namespace llvm; @@ -85,7 +83,10 @@ namespace { GenerateDebugInfo(debug), Gen(CreateLLVMCodeGen(Diags, langopts, InputFile, GenerateDebugInfo)), TheModule(0), TheTargetData(0), AsmOutStream(0), ModuleProvider(0), - CodeGenPasses(0), PerModulePasses(0), PerFunctionPasses(0) {} + CodeGenPasses(0), PerModulePasses(0), PerFunctionPasses(0) { + + llvm::TimePassesIsEnabled = CompileOpts.TimePasses; + } ~BackendConsumer() { delete AsmOutStream; diff --git a/Driver/clang.cpp b/Driver/clang.cpp index 70bc5b19ab..d188f37c5a 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -42,7 +42,6 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" -#include "llvm/Pass.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringExtras.h" @@ -1238,6 +1237,9 @@ static void InitializeCompileOptions(CompileOptions &Opts) { Opts.CPU = TargetCPU; Opts.Features.insert(Opts.Features.end(), TargetFeatures.begin(), TargetFeatures.end()); + + // Handle -ftime-report. + Opts.TimePasses = TimeReport; } //===----------------------------------------------------------------------===// @@ -1508,10 +1510,6 @@ int main(int argc, char **argv) { if (InputFilenames.empty()) InputFilenames.push_back("-"); - // Handle -ftime-report. - if (TimeReport) - llvm::TimePassesIsEnabled = true; - // Create a file manager object to provide access to and cache the filesystem. FileManager FileMgr; diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index cee61e0179..f5cc4cc252 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -769,7 +769,6 @@ 359603420E49495900C6282B /* Driver */ = { isa = PBXGroup; children = ( - 35585DC20EAFBC5F00D0A97A /* Backend.cpp */, 359763250E633C7500B68AB7 /* HTMLDiagnostics.cpp */, 350F4B460E5F32E100A21EA9 /* InitHeaderSearch.cpp */, 355BD0500EBFB040001A9DFF /* PlistDiagnostics.cpp */, @@ -979,6 +978,7 @@ 352028460E2C16820096ADE0 /* Analyses.def */, DE3985780CB8ADC800223765 /* ASTConsumers.h */, DE39857A0CB8ADCB00223765 /* ASTConsumers.cpp */, + 35585DC20EAFBC5F00D0A97A /* Backend.cpp */, 35A057E60EAE2DDD0069249F /* CacheTokens.cpp */, DE3B92800EB54E6000D01046 /* DependencyFile.cpp */, DE38CF150D8C9DE000A273B6 /* DiagChecker.cpp */, diff --git a/include/clang/Driver/CompileOptions.h b/include/clang/Driver/CompileOptions.h index 354df43aea..2ccd356ff4 100644 --- a/include/clang/Driver/CompileOptions.h +++ b/include/clang/Driver/CompileOptions.h @@ -29,6 +29,7 @@ struct CompileOptions { unsigned UnrollLoops : 1; /// Control whether loops are unrolled. unsigned VerifyModule : 1; /// Control whether the module /// should be run through the LLVM Verifier. + unsigned TimePasses : 1; /// Set when -ftime-report is enabled. /// CPU - An optional CPU to target. std::string CPU; @@ -44,6 +45,7 @@ public: UnitAtATime = 1; InlineFunctions = SimplifyLibCalls = UnrollLoops = 0; VerifyModule = 1; + TimePasses = 0; } };