]> granicus.if.org Git - clang/commitdiff
move llvm backend specific #includes into Backend.cpp instead of Clang.cpp
authorChris Lattner <sabre@nondot.org>
Wed, 18 Feb 2009 01:23:44 +0000 (01:23 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 18 Feb 2009 01:23:44 +0000 (01:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64872 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/Backend.cpp
Driver/clang.cpp
clang.xcodeproj/project.pbxproj
include/clang/Driver/CompileOptions.h

index 6eaffe9d9aecd0161f50e16a1d4187c05cc1d853..92b0c8fbc60d0fab603b997cb3fd6d7570ab5546 100644 (file)
@@ -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;
index 70bc5b19ab5c573dc521c789fb636ff38560309a..d188f37c5a4d76dbbb54304c2af241b3622cf213 100644 (file)
@@ -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;
   
index cee61e01795a0a0908d0a7ac065c868cb16ff8d0..f5cc4cc2524a9ac8565df98cbbb8e9f4e79965e4 100644 (file)
                359603420E49495900C6282B /* Driver */ = {
                        isa = PBXGroup;
                        children = (
-                               35585DC20EAFBC5F00D0A97A /* Backend.cpp */,
                                359763250E633C7500B68AB7 /* HTMLDiagnostics.cpp */,
                                350F4B460E5F32E100A21EA9 /* InitHeaderSearch.cpp */,
                                355BD0500EBFB040001A9DFF /* PlistDiagnostics.cpp */,
                                352028460E2C16820096ADE0 /* Analyses.def */,
                                DE3985780CB8ADC800223765 /* ASTConsumers.h */,
                                DE39857A0CB8ADCB00223765 /* ASTConsumers.cpp */,
+                               35585DC20EAFBC5F00D0A97A /* Backend.cpp */,
                                35A057E60EAE2DDD0069249F /* CacheTokens.cpp */,
                                DE3B92800EB54E6000D01046 /* DependencyFile.cpp */,
                                DE38CF150D8C9DE000A273B6 /* DiagChecker.cpp */,
index 354df43aeaca35823a8bb41b72cbc4e3a7f34bd7..2ccd356ff43a5358eae341a7db371e17380741cd 100644 (file)
@@ -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;
   }  
 };