]> granicus.if.org Git - clang/commitdiff
Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 12 Nov 2009 17:24:48 +0000 (17:24 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 12 Nov 2009 17:24:48 +0000 (17:24 +0000)
This resolves the layering violation where CodeGen depended on Frontend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86998 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/clang/CodeGen/CodeGenOptions.h [moved from include/clang/Frontend/CompileOptions.h with 89% similarity]
include/clang/CodeGen/ModuleBuilder.h
include/clang/Frontend/ASTConsumers.h
include/clang/Frontend/CompilerInvocation.h
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
lib/CodeGen/ModuleBuilder.cpp
lib/Frontend/Backend.cpp
tools/clang-cc/Options.cpp
tools/clang-cc/Options.h
tools/clang-cc/clang-cc.cpp

similarity index 89%
rename from include/clang/Frontend/CompileOptions.h
rename to include/clang/CodeGen/CodeGenOptions.h
index 2e8cfddf180e144d73b33741b5e215e6d3c1f9cf..c076ec095f548224e1f08c6ce7454957c07cc390 100644 (file)
@@ -1,4 +1,4 @@
-//===--- CompileOptions.h ---------------------------------------*- C++ -*-===//
+//===--- CodeGenOptions.h ---------------------------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,21 +7,21 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines the CompileOptions interface.
+//  This file defines the CodeGenOptions interface.
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_FRONTEND_COMPILEOPTIONS_H
-#define LLVM_CLANG_FRONTEND_COMPILEOPTIONS_H
+#ifndef LLVM_CLANG_CODEGEN_CODEGENOPTIONS_H
+#define LLVM_CLANG_CODEGEN_CODEGENOPTIONS_H
 
 #include <string>
 #include <vector>
 
 namespace clang {
 
-/// CompileOptions - Track various options which control how the code
+/// CodeGenOptions - Track various options which control how the code
 /// is optimized and passed to the backend.
-class CompileOptions {
+class CodeGenOptions {
 public:
   enum InliningMethod {
     NoInlining,         // Perform no inlining whatsoever.
@@ -60,7 +60,7 @@ public:
   std::vector<std::string> Features;
 
 public:
-  CompileOptions() {
+  CodeGenOptions() {
     OptimizationLevel = 0;
     OptimizeSize = 0;
     DebugInfo = 0;
index 1871c8f206f3d408e8b9b5457962e6f94fa52f8f..2a3aa6a90404f531e1cd6638d8f51f0b8c5bfb91 100644 (file)
@@ -25,7 +25,7 @@ namespace llvm {
 namespace clang {
   class Diagnostic;
   class LangOptions;
-  class CompileOptions;
+  class CodeGenOptions;
 
   class CodeGenerator : public ASTConsumer {
   public:
@@ -35,7 +35,7 @@ namespace clang {
 
   CodeGenerator *CreateLLVMCodeGen(Diagnostic &Diags,
                                    const std::string &ModuleName,
-                                   const CompileOptions &CO,
+                                   const CodeGenOptions &CGO,
                                    llvm::LLVMContext& C);
 }
 
index 742813c66907ac72079e8b70a3c20b4056112557..cd35638f2c431ea365e74a422dc3bf71196f4903 100644 (file)
@@ -28,7 +28,7 @@ class ASTConsumer;
 class Diagnostic;
 class FileManager;
 class Preprocessor;
-class CompileOptions;
+class CodeGenOptions;
 class LangOptions;
 
 // AST pretty-printer: prints out the AST in a format that is close to the
@@ -69,7 +69,7 @@ ASTConsumer *CreateObjCRewriter(const std::string &InFile,
                                 bool SilenceRewriteMacroWarning);
 
 // LLVM code generator: uses the code generation backend to generate LLVM
-// assembly. This runs optimizations depending on the CompileOptions
+// assembly. This runs optimizations depending on the CodeGenOptions
 // parameter. The output depends on the Action parameter.
 enum BackendAction {
   Backend_EmitAssembly,  // Emit native assembly
@@ -80,7 +80,7 @@ enum BackendAction {
 ASTConsumer *CreateBackendConsumer(BackendAction Action,
                                    Diagnostic &Diags,
                                    const LangOptions &Features,
-                                   const CompileOptions &CompileOpts,
+                                   const CodeGenOptions &CodeGenOpts,
                                    const std::string &ModuleID,
                                    llvm::raw_ostream *OS,
                                    llvm::LLVMContext& C);
index 6e231d359fb6a8dab73686724627cb80f765860f..8a8b0fb0006454fea649124506510a4e5e679386 100644 (file)
@@ -11,8 +11,8 @@
 #define LLVM_CLANG_FRONTEND_COMPILERINVOCATION_H_
 
 #include "clang/Basic/LangOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "clang/Frontend/AnalysisConsumer.h"
-#include "clang/Frontend/CompileOptions.h"
 #include "clang/Frontend/DependencyOutputOptions.h"
 #include "clang/Frontend/DiagnosticOptions.h"
 #include "clang/Frontend/HeaderSearchOptions.h"
@@ -34,7 +34,7 @@ class CompilerInvocation {
   AnalyzerOptions AnalyzerOpts;
 
   /// Options controlling IRgen and the backend.
-  CompileOptions CompileOpts;
+  CodeGenOptions CodeGenOpts;
 
   /// Options controlling dependency output.
   DependencyOutputOptions DependencyOutputOpts;
@@ -76,9 +76,9 @@ public:
     return AnalyzerOpts;
   }
 
-  CompileOptions &getCompileOpts() { return CompileOpts; }
-  const CompileOptions &getCompileOpts() const {
-    return CompileOpts;
+  CodeGenOptions &getCodeGenOpts() { return CodeGenOpts; }
+  const CodeGenOptions &getCodeGenOpts() const {
+    return CodeGenOpts;
   }
 
   DependencyOutputOptions &getDependencyOutputOpts() {
index 06cd05cc75a8b0d37917772c7db3cd8f6e831af4..5d8e5c2c4f650f1c45bcc9eb1f44d0792c55153e 100644 (file)
@@ -19,7 +19,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "llvm/Attributes.h"
 #include "llvm/Support/CallSite.h"
 #include "llvm/Target/TargetData.h"
@@ -441,11 +441,11 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
       RetAttrs |= llvm::Attribute::NoAlias;
   }
 
-  if (CompileOpts.OptimizeSize)
+  if (CodeGenOpts.OptimizeSize)
     FuncAttrs |= llvm::Attribute::OptimizeForSize;
-  if (CompileOpts.DisableRedZone)
+  if (CodeGenOpts.DisableRedZone)
     FuncAttrs |= llvm::Attribute::NoRedZone;
-  if (CompileOpts.NoImplicitFloat)
+  if (CodeGenOpts.NoImplicitFloat)
     FuncAttrs |= llvm::Attribute::NoImplicitFloat;
 
   if (Features.getStackProtectorMode() == LangOptions::SSPOn)
index 592656583ced639813f655467475331dd977e423..dd33ca3c6bd8de61a4e8d4048a6285784408c332 100644 (file)
@@ -21,7 +21,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/Version.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "llvm/Constants.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
@@ -1010,8 +1010,8 @@ void CGDebugInfo::EmitDeclare(const VarDecl *Decl, unsigned Tag,
   // Do not emit variable debug information while generating optimized code.
   // The llvm optimizer and code generator are not yet ready to support
   // optimized code debugging.
-  const CompileOptions &CO = M->getCompileOpts();
-  if (CO.OptimizationLevel)
+  const CodeGenOptions &CGO = M->getCodeGenOpts();
+  if (CGO.OptimizationLevel)
     return;
 
   llvm::DICompileUnit Unit = getOrCreateCompileUnit(Decl->getLocation());
@@ -1185,8 +1185,8 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
   // Do not emit variable debug information while generating optimized code.
   // The llvm optimizer and code generator are not yet ready to support
   // optimized code debugging.
-  const CompileOptions &CO = M->getCompileOpts();
-  if (CO.OptimizationLevel || Builder.GetInsertBlock() == 0)
+  const CodeGenOptions &CGO = M->getCodeGenOpts();
+  if (CGO.OptimizationLevel || Builder.GetInsertBlock() == 0)
     return;
 
   uint64_t XOffset = 0;
index 2a28ef08a08ceaa16b92060971bf784f5b37a515..1d2040bae203de6e8bf18d41270ba87319b5aeb5 100644 (file)
@@ -19,7 +19,7 @@
 #include "clang/AST/DeclObjC.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/Target/TargetData.h"
@@ -320,7 +320,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
       
       // All constant structs and arrays should be global if
       // their initializer is constant and if the element type is POD.
-      if (CGM.getCompileOpts().MergeAllConstants) {
+      if (CGM.getCodeGenOpts().MergeAllConstants) {
         if (Ty.isConstant(getContext())
             && (Ty->isArrayType() || Ty->isRecordType())
             && (D.getInit() 
index ff193fb489719a1dcef42adb471baf5dbd1bcd10..45637af3ca4a892643843af53918e62551973908 100644 (file)
@@ -17,7 +17,7 @@
 #include "CGCall.h"
 #include "CGObjCRuntime.h"
 #include "Mangle.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/DeclCXX.h"
@@ -35,11 +35,11 @@ using namespace clang;
 using namespace CodeGen;
 
 
-CodeGenModule::CodeGenModule(ASTContext &C, const CompileOptions &compileOpts,
+CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
                              llvm::Module &M, const llvm::TargetData &TD,
                              Diagnostic &diags)
   : BlockModule(C, M, TD, Types, *this), Context(C),
-    Features(C.getLangOptions()), CompileOpts(compileOpts), TheModule(M),
+    Features(C.getLangOptions()), CodeGenOpts(CGO), TheModule(M),
     TheTargetData(TD), Diags(diags), Types(C, M, TD), MangleCtx(C), 
     VtableInfo(*this), Runtime(0),
     MemCpyFn(0), MemMoveFn(0), MemSetFn(0), CFConstantStringClassRef(0),
@@ -55,7 +55,7 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CompileOptions &compileOpts,
     Runtime = CreateMacObjCRuntime(*this);
 
   // If debug info generation is enabled, create the CGDebugInfo object.
-  DebugInfo = CompileOpts.DebugInfo ? new CGDebugInfo(this) : 0;
+  DebugInfo = CodeGenOpts.DebugInfo ? new CGDebugInfo(this) : 0;
 }
 
 CodeGenModule::~CodeGenModule() {
@@ -1082,7 +1082,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
       GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage);
   } else if (Linkage == GVA_TemplateInstantiation)
     GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage);   
-  else if (!CompileOpts.NoCommon &&
+  else if (!CodeGenOpts.NoCommon &&
            !D->hasExternalStorage() && !D->getInit() &&
            !D->getAttr<SectionAttr>()) {
     GV->setLinkage(llvm::GlobalVariable::CommonLinkage);
index 990706d11fc448e3bedc813ae977297e1f5cdec1..cf7a9d68f31ec9b71c7e666250ff5382207f45fb 100644 (file)
@@ -61,7 +61,7 @@ namespace clang {
   class ValueDecl;
   class VarDecl;
   class LangOptions;
-  class CompileOptions;
+  class CodeGenOptions;
   class Diagnostic;
   class AnnotateAttr;
   class CXXDestructorDecl;
@@ -122,7 +122,7 @@ class CodeGenModule : public BlockModule {
 
   ASTContext &Context;
   const LangOptions &Features;
-  const CompileOptions &CompileOpts;
+  const CodeGenOptions &CodeGenOpts;
   llvm::Module &TheModule;
   const llvm::TargetData &TheTargetData;
   Diagnostic &Diags;
@@ -201,7 +201,7 @@ class CodeGenModule : public BlockModule {
 
   llvm::LLVMContext &VMContext;
 public:
-  CodeGenModule(ASTContext &C, const CompileOptions &CompileOpts,
+  CodeGenModule(ASTContext &C, const CodeGenOptions &CodeGenOpts,
                 llvm::Module &M, const llvm::TargetData &TD, Diagnostic &Diags);
 
   ~CodeGenModule();
@@ -222,7 +222,7 @@ public:
 
   CGDebugInfo *getDebugInfo() { return DebugInfo; }
   ASTContext &getContext() const { return Context; }
-  const CompileOptions &getCompileOpts() const { return CompileOpts; }
+  const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
   const LangOptions &getLangOptions() const { return Features; }
   llvm::Module &getModule() const { return TheModule; }
   CodeGenTypes &getTypes() { return Types; }
index c8f686a06f50b84f965cb5589ca7948b594896d2..1d8f31dd9b24b0c7635dcdd9413b5755fcb71ed0 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "clang/CodeGen/ModuleBuilder.h"
 #include "CodeGenModule.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/DeclObjC.h"
 #include "clang/AST/Expr.h"
@@ -32,14 +32,14 @@ namespace {
     Diagnostic &Diags;
     llvm::OwningPtr<const llvm::TargetData> TD;
     ASTContext *Ctx;
-    const CompileOptions CompileOpts;  // Intentionally copied in.
+    const CodeGenOptions CodeGenOpts;  // Intentionally copied in.
   protected:
     llvm::OwningPtr<llvm::Module> M;
     llvm::OwningPtr<CodeGen::CodeGenModule> Builder;
   public:
     CodeGeneratorImpl(Diagnostic &diags, const std::string& ModuleName,
-                      const CompileOptions &CO, llvm::LLVMContext& C)
-      : Diags(diags), CompileOpts(CO), M(new llvm::Module(ModuleName, C)) {}
+                      const CodeGenOptions &CGO, llvm::LLVMContext& C)
+      : Diags(diags), CodeGenOpts(CGO), M(new llvm::Module(ModuleName, C)) {}
 
     virtual ~CodeGeneratorImpl() {}
 
@@ -57,7 +57,7 @@ namespace {
       M->setTargetTriple(Ctx->Target.getTriple().getTriple());
       M->setDataLayout(Ctx->Target.getTargetDescription());
       TD.reset(new llvm::TargetData(Ctx->Target.getTargetDescription()));
-      Builder.reset(new CodeGen::CodeGenModule(Context, CompileOpts,
+      Builder.reset(new CodeGen::CodeGenModule(Context, CodeGenOpts,
                                                *M, *TD, Diags));
     }
 
@@ -96,7 +96,7 @@ namespace {
 
 CodeGenerator *clang::CreateLLVMCodeGen(Diagnostic &Diags,
                                         const std::string& ModuleName,
-                                        const CompileOptions &CO,
+                                        const CodeGenOptions &CGO,
                                         llvm::LLVMContext& C) {
-  return new CodeGeneratorImpl(Diags, ModuleName, CO, C);
+  return new CodeGeneratorImpl(Diags, ModuleName, CGO, C);
 }
index af6dbafd1d368460aa3c84f820bb117f1837e7d4..23d59cf919ad1f8748d88fb20b3e525e7544fd75 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/CodeGen/ModuleBuilder.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/DeclGroup.h"
@@ -40,7 +40,7 @@ using namespace llvm;
 namespace {
   class VISIBILITY_HIDDEN BackendConsumer : public ASTConsumer {
     BackendAction Action;
-    CompileOptions CompileOpts;
+    CodeGenOptions CodeGenOpts;
     llvm::raw_ostream *AsmOutStream;
     llvm::formatted_raw_ostream FormattedOutStream;
     ASTContext *Context;
@@ -75,11 +75,11 @@ namespace {
 
   public:
     BackendConsumer(BackendAction action, Diagnostic &Diags,
-                    const LangOptions &langopts, const CompileOptions &compopts,
+                    const LangOptions &langopts, const CodeGenOptions &compopts,
                     const std::string &infile, llvm::raw_ostream* OS,
                     LLVMContext& C) :
       Action(action),
-      CompileOpts(compopts),
+      CodeGenOpts(compopts),
       AsmOutStream(OS),
       LLVMIRGeneration("LLVM IR Generation Time"),
       CodeGenerationTime("Code Generation Time"),
@@ -92,7 +92,7 @@ namespace {
                                      formatted_raw_ostream::PRESERVE_STREAM);
 
       // Enable -time-passes if -ftime-report is enabled.
-      llvm::TimePassesIsEnabled = CompileOpts.TimePasses;
+      llvm::TimePassesIsEnabled = CodeGenOpts.TimePasses;
     }
 
     ~BackendConsumer() {
@@ -106,7 +106,7 @@ namespace {
     virtual void Initialize(ASTContext &Ctx) {
       Context = &Ctx;
 
-      if (CompileOpts.TimePasses)
+      if (CodeGenOpts.TimePasses)
         LLVMIRGeneration.startTimer();
 
       Gen->Initialize(Ctx);
@@ -115,7 +115,7 @@ namespace {
       ModuleProvider = new ExistingModuleProvider(TheModule);
       TheTargetData = new llvm::TargetData(Ctx.Target.getTargetDescription());
 
-      if (CompileOpts.TimePasses)
+      if (CodeGenOpts.TimePasses)
         LLVMIRGeneration.stopTimer();
     }
 
@@ -124,24 +124,24 @@ namespace {
                                      Context->getSourceManager(),
                                      "LLVM IR generation of declaration");
 
-      if (CompileOpts.TimePasses)
+      if (CodeGenOpts.TimePasses)
         LLVMIRGeneration.startTimer();
 
       Gen->HandleTopLevelDecl(D);
 
-      if (CompileOpts.TimePasses)
+      if (CodeGenOpts.TimePasses)
         LLVMIRGeneration.stopTimer();
     }
 
     virtual void HandleTranslationUnit(ASTContext &C) {
       {
         PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
-        if (CompileOpts.TimePasses)
+        if (CodeGenOpts.TimePasses)
           LLVMIRGeneration.startTimer();
 
         Gen->HandleTranslationUnit(C);
 
-        if (CompileOpts.TimePasses)
+        if (CodeGenOpts.TimePasses)
           LLVMIRGeneration.stopTimer();
       }
 
@@ -202,7 +202,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
   } else if (Action == Backend_EmitLL) {
     getPerModulePasses()->add(createPrintModulePass(&FormattedOutStream));
   } else {
-    bool Fast = CompileOpts.OptimizationLevel == 0;
+    bool Fast = CodeGenOpts.OptimizationLevel == 0;
 
     // Create the TargetMachine for generating code.
     std::string Triple = TheModule->getTargetTriple();
@@ -213,12 +213,12 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
     }
 
     std::string FeaturesStr;
-    if (CompileOpts.CPU.size() || CompileOpts.Features.size()) {
+    if (CodeGenOpts.CPU.size() || CodeGenOpts.Features.size()) {
       SubtargetFeatures Features;
-      Features.setCPU(CompileOpts.CPU);
+      Features.setCPU(CodeGenOpts.CPU);
       for (std::vector<std::string>::iterator
-             it = CompileOpts.Features.begin(),
-             ie = CompileOpts.Features.end(); it != ie; ++it)
+             it = CodeGenOpts.Features.begin(),
+             ie = CodeGenOpts.Features.end(); it != ie; ++it)
         Features.AddFeature(*it);
       FeaturesStr = Features.getString();
     }
@@ -237,7 +237,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
     FunctionPassManager *PM = getCodeGenPasses();
     CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
 
-    switch (CompileOpts.OptimizationLevel) {
+    switch (CodeGenOpts.OptimizationLevel) {
     default: break;
     case 0: OptLevel = CodeGenOpt::None; break;
     case 3: OptLevel = CodeGenOpt::Aggressive; break;
@@ -266,18 +266,18 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
 }
 
 void BackendConsumer::CreatePasses() {
-  unsigned OptLevel = CompileOpts.OptimizationLevel;
-  CompileOptions::InliningMethod Inlining = CompileOpts.Inlining;
+  unsigned OptLevel = CodeGenOpts.OptimizationLevel;
+  CodeGenOptions::InliningMethod Inlining = CodeGenOpts.Inlining;
 
   // Handle disabling of LLVM optimization, where we want to preserve the
   // internal module before any optimization.
-  if (CompileOpts.DisableLLVMOpts) {
+  if (CodeGenOpts.DisableLLVMOpts) {
     OptLevel = 0;
-    Inlining = CompileOpts.NoInlining;
+    Inlining = CodeGenOpts.NoInlining;
   }
 
   // In -O0 if checking is disabled, we don't even have per-function passes.
-  if (CompileOpts.VerifyModule)
+  if (CodeGenOpts.VerifyModule)
     getPerFunctionPasses()->add(createVerifierPass());
 
   // Assume that standard function passes aren't run for -O0.
@@ -286,24 +286,24 @@ void BackendConsumer::CreatePasses() {
 
   llvm::Pass *InliningPass = 0;
   switch (Inlining) {
-  case CompileOptions::NoInlining: break;
-  case CompileOptions::NormalInlining: {
+  case CodeGenOptions::NoInlining: break;
+  case CodeGenOptions::NormalInlining: {
     // Inline small functions
-    unsigned Threshold = (CompileOpts.OptimizeSize || OptLevel < 3) ? 50 : 200;
+    unsigned Threshold = (CodeGenOpts.OptimizeSize || OptLevel < 3) ? 50 : 200;
     InliningPass = createFunctionInliningPass(Threshold);
     break;
   }
-  case CompileOptions::OnlyAlwaysInlining:
+  case CodeGenOptions::OnlyAlwaysInlining:
     InliningPass = createAlwaysInlinerPass();         // Respect always_inline
     break;
   }
 
   // For now we always create per module passes.
   PassManager *PM = getPerModulePasses();
-  llvm::createStandardModulePasses(PM, OptLevel, CompileOpts.OptimizeSize,
-                                   CompileOpts.UnitAtATime,
-                                   CompileOpts.UnrollLoops,
-                                   CompileOpts.SimplifyLibCalls,
+  llvm::createStandardModulePasses(PM, OptLevel, CodeGenOpts.OptimizeSize,
+                                   CodeGenOpts.UnitAtATime,
+                                   CodeGenOpts.UnrollLoops,
+                                   CodeGenOpts.SimplifyLibCalls,
                                    /*HaveExceptions=*/true,
                                    InliningPass);
 }
@@ -315,7 +315,7 @@ void BackendConsumer::EmitAssembly() {
   if (!TheModule || !TheTargetData)
     return;
 
-  TimeRegion Region(CompileOpts.TimePasses ? &CodeGenerationTime : 0);
+  TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : 0);
 
   // Make sure IR generation is happy with the module. This is
   // released by the module provider.
@@ -370,10 +370,10 @@ void BackendConsumer::EmitAssembly() {
 ASTConsumer *clang::CreateBackendConsumer(BackendAction Action,
                                           Diagnostic &Diags,
                                           const LangOptions &LangOpts,
-                                          const CompileOptions &CompileOpts,
+                                          const CodeGenOptions &CodeGenOpts,
                                           const std::string& InFile,
                                           llvm::raw_ostream* OS,
                                           LLVMContext& C) {
-  return new BackendConsumer(Action, Diags, LangOpts, CompileOpts,
+  return new BackendConsumer(Action, Diags, LangOpts, CodeGenOpts,
                              InFile, OS, C);
 }
index de2122a892a5445ce2c2b78294f040f6faa50a39..f6d7aa7857de889baa94f8a00e16c72db7ff85ec 100644 (file)
@@ -15,7 +15,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/AnalysisConsumer.h"
-#include "clang/Frontend/CompileOptions.h"
+#include "clang/CodeGen/CodeGenOptions.h"
 #include "clang/Frontend/DependencyOutputOptions.h"
 #include "clang/Frontend/DiagnosticOptions.h"
 #include "clang/Frontend/HeaderSearchOptions.h"
@@ -607,7 +607,7 @@ DumpDefines("dD", llvm::cl::desc("Print macro definitions in -E mode in "
 // Option Object Construction
 //===----------------------------------------------------------------------===//
 
-void clang::InitializeCompileOptions(CompileOptions &Opts,
+void clang::InitializeCodeGenOptions(CodeGenOptions &Opts,
                                      const TargetInfo &Target) {
   using namespace codegenoptions;
 
@@ -648,8 +648,8 @@ void clang::InitializeCompileOptions(CompileOptions &Opts,
   Opts.OptimizationLevel = OptSize ? 2 : OptLevel;
 
   // We must always run at least the always inlining pass.
-  Opts.Inlining = (Opts.OptimizationLevel > 1) ? CompileOptions::NormalInlining
-    : CompileOptions::OnlyAlwaysInlining;
+  Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
+    : CodeGenOptions::OnlyAlwaysInlining;
 
   Opts.CPU = TargetCPU;
   Opts.DebugInfo = GenerateDebugInfo;
@@ -866,7 +866,7 @@ void clang::InitializePreprocessorOptions(PreprocessorOptions &Opts) {
 
 void clang::InitializeLangOptions(LangOptions &Options, LangKind LK,
                                   TargetInfo &Target,
-                                  const CompileOptions &CompileOpts) {
+                                  const CodeGenOptions &CodeGenOpts) {
   using namespace langoptions;
 
   bool NoPreprocess = false;
@@ -932,7 +932,7 @@ void clang::InitializeLangOptions(LangOptions &Options, LangKind LK,
 
   // Pass the map of target features to the target for validation and
   // processing.
-  Target.HandleTargetFeatures(CompileOpts.Features);
+  Target.HandleTargetFeatures(CodeGenOpts.Features);
 
   if (LangStd == lang_unspecified) {
     // Based on the base language, pick one.
@@ -1088,7 +1088,7 @@ void clang::InitializeLangOptions(LangOptions &Options, LangKind LK,
 
   // The __OPTIMIZE_SIZE__ define is tied to -Oz, which we don't support.
   Options.OptimizeSize = 0;
-  Options.Optimize = !!CompileOpts.OptimizationLevel;
+  Options.Optimize = !!CodeGenOpts.OptimizationLevel;
 
   assert(PICLevel <= 2 && "Invalid value for -pic-level");
   Options.PICLevel = PICLevel;
@@ -1099,7 +1099,7 @@ void clang::InitializeLangOptions(LangOptions &Options, LangKind LK,
   // This is the __NO_INLINE__ define, which just depends on things like the
   // optimization level and -fno-inline, not actually whether the backend has
   // inlining enabled.
-  Options.NoInline = !CompileOpts.OptimizationLevel;
+  Options.NoInline = !CodeGenOpts.OptimizationLevel;
 
   Options.Static = StaticDefine;
 
index 6275e77e9752a06743619a0ab72c211cc7ad8e02..ae446a7b6344a92c87e1bbf7f86c7a72a8147b1c 100644 (file)
@@ -15,7 +15,7 @@
 namespace clang {
 
 class AnalyzerOptions;
-class CompileOptions;
+class CodeGenOptions;
 class DependencyOutputOptions;
 class DiagnosticOptions;
 class HeaderSearchOptions;
@@ -45,7 +45,7 @@ void InitializeDependencyOutputOptions(DependencyOutputOptions &Opts);
 
 void InitializeDiagnosticOptions(DiagnosticOptions &Opts);
 
-void InitializeCompileOptions(CompileOptions &Opts,
+void InitializeCodeGenOptions(CodeGenOptions &Opts,
                               const TargetInfo &Target);
 
 void InitializeHeaderSearchOptions(HeaderSearchOptions &Opts,
@@ -55,7 +55,7 @@ void InitializeHeaderSearchOptions(HeaderSearchOptions &Opts,
 
 void InitializeLangOptions(LangOptions &Options, LangKind LK,
                            TargetInfo &Target,
-                           const CompileOptions &CompileOpts);
+                           const CodeGenOptions &CodeGenOpts);
 
 void InitializePreprocessorOptions(PreprocessorOptions &Opts);
 
index e78cc9387a357d2cf6fc51a68d41f39d4508ac01..c7ead4d3fb0e93ac3ab50b6c2538818a7c96fb9f 100644 (file)
@@ -565,7 +565,7 @@ static ASTConsumer *CreateConsumerAction(const CompilerInvocation &CompOpts,
     }
 
     return CreateBackendConsumer(Act, PP.getDiagnostics(), PP.getLangOptions(),
-                                 CompOpts.getCompileOpts(), InFile, OS.get(),
+                                 CompOpts.getCodeGenOpts(), InFile, OS.get(),
                                  Context);
   }
 
@@ -985,7 +985,7 @@ static LangKind GetLanguage() {
   return LK;
 }
 
-static void FinalizeCompileOptions(CompileOptions &Opts,
+static void FinalizeCodeGenOptions(CodeGenOptions &Opts,
                                    const LangOptions &Lang) {
   if (Lang.NoBuiltin)
     Opts.SimplifyLibCalls = 0;
@@ -1007,7 +1007,7 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts,
 
   // Initialize backend options, which may also be used to key some language
   // options.
-  InitializeCompileOptions(Opts.getCompileOpts(), Target);
+  InitializeCodeGenOptions(Opts.getCodeGenOpts(), Target);
 
   // Initialize language options.
   //
@@ -1015,7 +1015,7 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts,
   // code path to make this obvious.
   if (LK != langkind_ast)
     InitializeLangOptions(Opts.getLangOpts(), LK, Target,
-                          Opts.getCompileOpts());
+                          Opts.getCodeGenOpts());
 
   // Initialize the static analyzer options.
   InitializeAnalyzerOptions(Opts.getAnalyzerOpts());
@@ -1036,7 +1036,7 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts,
   InitializePreprocessorOutputOptions(Opts.getPreprocessorOutputOpts());
 
   // Finalize some code generation options.
-  FinalizeCompileOptions(Opts.getCompileOpts(), Opts.getLangOpts());
+  FinalizeCodeGenOptions(Opts.getCodeGenOpts(), Opts.getLangOpts());
 }
 
 static Diagnostic *CreateDiagnosticEngine(const DiagnosticOptions &Opts,