aboutsummaryrefslogtreecommitdiff
path: root/Driver/clang.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-10-21 23:49:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-10-21 23:49:24 +0000
commitd69bacc3993f045bc78a64505fe0602770615b1f (patch)
tree2681e5fdc402bb1186af99e0f9a3c38a0ee48f7d /Driver/clang.cpp
parent98cd599ee8a9b259ed7388ee2921a20d97658864 (diff)
[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
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r--Driver/clang.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index c2afe5b622..34f6cb698e 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -72,6 +72,7 @@ enum ProgActions {
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 @@ ProgAction(llvm::cl::desc("Choose output type:"), llvm::cl::ZeroOrMore,
"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 @@ static ASTConsumer* CreateASTConsumer(const std::string& InFile,
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.