aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-07 23:28:45 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-07 23:28:45 +0000
commit6c6424bc0d3b5f080a97b5f6ef4a8d70c38e38f5 (patch)
tree2ff4a2b19b5a48f6aef33881d979b51ce2817924 /lib/Driver/Driver.cpp
parent4cbbd94d0abeec2d7e7438d098527aa340d82389 (diff)
Driver: Support invoking Clang on .ll or .bc inputs.
- We actually pretend that we have two separate types for LLVM assembly/bitcode because we need to use the standard suffixes with LTO ('clang -O4 -c t.c' should generate 't.o'). It is now possible to do something like: $ clang -emit-llvm -S t.c -o t.ll ... assorted other compile flags ... $ clang -c t.ll -o t.o ... assorted other compile flags ... and expect that the output will be almost* identical to: $ clang -c t.c -o t.o ... assorted other compile flags ... because all the target settings (default CPU, target features, etc.) will all be initialized properly by the driver/frontend. *: This isn't perfect yet, because in practice we will end up running the optimization passes twice. It's possible to get something equivalent out with a well placed -mllvm -disable-llvm-optzns, but I'm still thinking about the cleanest way to solve this problem more generally. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index cae2243b2e..90333bd21d 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -797,7 +797,7 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
} else if (Args.hasArg(options::OPT_emit_llvm) ||
Args.hasArg(options::OPT_flto) || HasO4) {
types::ID Output =
- Args.hasArg(options::OPT_S) ? types::TY_LLVMAsm : types::TY_LLVMBC;
+ Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
return new CompileJobAction(Input, Output);
} else {
return new CompileJobAction(Input, types::TY_PP_Asm);
@@ -1263,8 +1263,8 @@ bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
// Always use clang for precompiling, AST generation, and rewriting,
// regardless of archs.
- if (isa<PrecompileJobAction>(JA) || JA.getType() == types::TY_AST ||
- JA.getType() == types::TY_RewrittenObjC)
+ if (isa<PrecompileJobAction>(JA) ||
+ types::isOnlyAcceptedByClang(JA.getType()))
return true;
// Finally, don't use clang if this isn't one of the user specified archs to