[LLVM up] Add basic -S option to clang.
- Split backend related consumer out into Backend.cpp, replaces
LLVMCodeGenWriter.
- Structure follows llvm-gcc to some extent.
- Still need to implement all the options which impact code
generation and the optimization passes which llvm-gcc uses at
various levels.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57936 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index c2afe5b..34f6cb6 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -72,6 +72,7 @@
RewriteMacros, // Expand macros but not #includes.
RewriteTest, // Rewriter playground
HTMLTest, // HTML displayer testing stuff.
+ EmitAssembly, // Emit a .s file.
EmitLLVM, // Emit a .ll file.
EmitBC, // Emit a .bc file.
SerializeAST, // Emit a .ast file.
@@ -119,6 +120,8 @@
"Build ASTs and view them with GraphViz"),
clEnumValN(TestSerialization, "test-pickling",
"Run prototype serialization code"),
+ clEnumValN(EmitAssembly, "S",
+ "Emit native assembly code"),
clEnumValN(EmitLLVM, "emit-llvm",
"Build ASTs then convert to LLVM, emit .ll file"),
clEnumValN(EmitBC, "emit-llvm-bc",
@@ -1103,10 +1106,15 @@
case TestSerialization:
return CreateSerializationTest(Diag, FileMgr);
+ case EmitAssembly:
+ return CreateBackendConsumer(Backend_EmitAssembly, Diag, LangOpts,
+ InFile, OutputFile, GenerateDebugInfo);
case EmitLLVM:
+ return CreateBackendConsumer(Backend_EmitLL, Diag, LangOpts,
+ InFile, OutputFile, GenerateDebugInfo);
case EmitBC:
- return CreateLLVMCodeGenWriter(ProgAction == EmitBC, Diag, LangOpts,
- InFile, OutputFile, GenerateDebugInfo);
+ return CreateBackendConsumer(Backend_EmitBC, Diag, LangOpts,
+ InFile, OutputFile, GenerateDebugInfo);
case SerializeAST:
// FIXME: Allow user to tailor where the file is written.