[cfe-commits] r105574 - in /cfe/trunk: include/clang/CodeGen/CodeGenOptions.h lib/Frontend/CodeGenAction.cpp lib/Frontend/CompilerInvocation.cpp

Daniel Dunbar daniel at zuster.org
Mon Jun 7 16:19:17 PDT 2010


Author: ddunbar
Date: Mon Jun  7 18:19:17 2010
New Revision: 105574

URL: http://llvm.org/viewvc/llvm-project?rev=105574&view=rev
Log:
Frontend: Add CodeGenOptions::SimplifyLibCalls, and eliminate LangOptions argument to BackendConsumer.

Modified:
    cfe/trunk/include/clang/CodeGen/CodeGenOptions.h
    cfe/trunk/lib/Frontend/CodeGenAction.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/CodeGen/CodeGenOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CodeGenOptions.h?rev=105574&r1=105573&r2=105574&view=diff
==============================================================================
--- cfe/trunk/include/clang/CodeGen/CodeGenOptions.h (original)
+++ cfe/trunk/include/clang/CodeGen/CodeGenOptions.h Mon Jun  7 18:19:17 2010
@@ -55,6 +55,7 @@
   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 @@
     OptimizationLevel = 0;
     OptimizeSize = 0;
     RelaxAll = 0;
+    SimplifyLibCalls = 1;
     SoftFloat = 0;
     TimePasses = 0;
     UnitAtATime = 1;

Modified: cfe/trunk/lib/Frontend/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CodeGenAction.cpp?rev=105574&r1=105573&r2=105574&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/Frontend/CodeGenAction.cpp Mon Jun  7 18:19:17 2010
@@ -56,7 +56,6 @@
     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 @@
 
   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 @@
   llvm::createStandardModulePasses(PM, OptLevel, CodeGenOpts.OptimizeSize,
                                    CodeGenOpts.UnitAtATime,
                                    CodeGenOpts.UnrollLoops,
-                                   /*SimplifyLibCalls=*/!LangOpts.NoBuiltin,
+                                   CodeGenOpts.SimplifyLibCalls,
                                    /*HaveExceptions=*/true,
                                    InliningPass);
 }
@@ -566,7 +564,7 @@
   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());

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=105574&r1=105573&r2=105574&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Jun  7 18:19:17 2010
@@ -806,6 +806,8 @@
   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);





More information about the cfe-commits mailing list