Add -emit-llvm-only option (generate LLVM IR & run passes, but discard
output).
- For timing IRgen phase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65580 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index d17f77b..6fdd18a 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -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;