[cfe-commits] r65580 - in /cfe/trunk/Driver: ASTConsumers.h Backend.cpp clang.cpp

Daniel Dunbar daniel at zuster.org
Thu Feb 26 14:39:37 PST 2009


Author: ddunbar
Date: Thu Feb 26 16:39:37 2009
New Revision: 65580

URL: http://llvm.org/viewvc/llvm-project?rev=65580&view=rev
Log:
Add -emit-llvm-only option (generate LLVM IR & run passes, but discard
output).
 - For timing IRgen phase.

Modified:
    cfe/trunk/Driver/ASTConsumers.h
    cfe/trunk/Driver/Backend.cpp
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/ASTConsumers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/ASTConsumers.h?rev=65580&r1=65579&r2=65580&view=diff

==============================================================================
--- cfe/trunk/Driver/ASTConsumers.h (original)
+++ cfe/trunk/Driver/ASTConsumers.h Thu Feb 26 16:39:37 2009
@@ -48,7 +48,8 @@
 enum BackendAction {
   Backend_EmitAssembly,
   Backend_EmitBC,
-  Backend_EmitLL
+  Backend_EmitLL,
+  Backend_EmitNothing
 };
 ASTConsumer *CreateBackendConsumer(BackendAction Action,
                                    Diagnostic &Diags,

Modified: cfe/trunk/Driver/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/Backend.cpp?rev=65580&r1=65579&r2=65580&view=diff

==============================================================================
--- cfe/trunk/Driver/Backend.cpp (original)
+++ cfe/trunk/Driver/Backend.cpp Thu Feb 26 16:39:37 2009
@@ -181,6 +181,9 @@
 }
 
 bool BackendConsumer::AddEmitPasses(std::string &Error) {
+  if (Action == Backend_EmitNothing)
+    return true;
+
   if (OutputFile == "-" || (InputFile == "-" && OutputFile.empty())) {
     AsmOutStream = new raw_stdout_ostream();
     sys::Program::ChangeStdoutToBinary();

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=65580&r1=65579&r2=65580&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Thu Feb 26 16:39:37 2009
@@ -86,6 +86,7 @@
   EmitAssembly,                 // Emit a .s file.
   EmitLLVM,                     // Emit a .ll file.
   EmitBC,                       // Emit a .bc file.
+  EmitLLVMOnly,                 // Generate LLVM IR, but do not 
   SerializeAST,                 // Emit a .ast file.
   EmitHTML,                     // Translate input source into HTML.
   ASTPrint,                     // Parse ASTs and print them.
@@ -143,6 +144,8 @@
                         "Build ASTs then convert to LLVM, emit .ll file"),
              clEnumValN(EmitBC, "emit-llvm-bc",
                         "Build ASTs then convert to LLVM, emit .bc file"),
+             clEnumValN(EmitLLVMOnly, "emit-llvm-only",
+                        "Build ASTs and convert to LLVM, discarding output"),
              clEnumValN(SerializeAST, "serialize",
                         "Build ASTs and emit .ast file"),
              clEnumValN(RewriteTest, "rewrite-test",
@@ -1297,12 +1300,15 @@
     
   case EmitAssembly:
   case EmitLLVM:
-  case EmitBC: {
+  case EmitBC: 
+  case EmitLLVMOnly: {
     BackendAction Act;
     if (ProgAction == EmitAssembly)
       Act = Backend_EmitAssembly;
     else if (ProgAction == EmitLLVM)
       Act = Backend_EmitLL;
+    else if (ProgAction == EmitLLVMOnly)
+      Act = Backend_EmitNothing;
     else
       Act = Backend_EmitBC;
     





More information about the cfe-commits mailing list