aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-02-05 07:29:57 +0000
committerEric Christopher <echristo@gmail.com>2013-02-05 07:29:57 +0000
commitc706c8e440abf61910c042380e19c67932998395 (patch)
treee1ad31e6b3fe68189ecfdaa8ad03bd251642cc3c /lib/Driver/Driver.cpp
parent4f4e2af2643c1914c2e49ac6372f7c2c38616432 (diff)
Driver and option support for -gsplit-dwarf. This is a part of
the DWARF5 split dwarf proposal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r--lib/Driver/Driver.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index 8a2804a9ad..1e23f565b6 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -25,6 +25,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
@@ -1036,6 +1037,7 @@ void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args,
// Construct the actions to perform.
ActionList LinkerInputs;
+ ActionList SplitInputs;
unsigned NumSteps = 0;
for (unsigned i = 0, e = Inputs.size(); i != e; ++i) {
types::ID InputType = Inputs[i].first;
@@ -1105,6 +1107,12 @@ void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args,
Current.reset(ConstructPhaseAction(Args, Phase, Current.take()));
if (Current->getType() == types::TY_Nothing)
break;
+ else if (Current->getType() == types::TY_Object &&
+ Args.hasArg(options::OPT_gsplit_dwarf)) {
+ ActionList Input;
+ Input.push_back(Current.take());
+ Current.reset(new SplitDebugJobAction(Input, types::TY_Object));
+ }
}
// If we ended with something, add to the output list.
@@ -1112,6 +1120,16 @@ void Driver::BuildActions(const ToolChain &TC, const DerivedArgList &Args,
Actions.push_back(Current.take());
}
+ if (!SplitInputs.empty()) {
+ for (ActionList::iterator i = SplitInputs.begin(), e = SplitInputs.end();
+ i != e; ++i) {
+ Action *Act = *i;
+ ActionList Inputs;
+ Inputs.push_back(Act);
+ Actions.push_back(new SplitDebugJobAction(Inputs, types::TY_Object));
+ }
+ }
+
// Add a link action if necessary.
if (!LinkerInputs.empty())
Actions.push_back(new LinkJobAction(LinkerInputs, types::TY_Image));
@@ -1396,12 +1414,13 @@ void Driver::BuildJobsForAction(Compilation &C,
BaseInput = InputInfos[0].getFilename();
// Determine the place to write output to, if any.
- if (JA->getType() == types::TY_Nothing) {
+ if (JA->getType() == types::TY_Nothing)
Result = InputInfo(A->getType(), BaseInput);
- } else {
+ else if (isa<SplitDebugJobAction>(A))
+ Result = InputInfos[0];
+ else
Result = InputInfo(GetNamedOutputPath(C, *JA, BaseInput, AtTopLevel),
A->getType(), BaseInput);
- }
if (CCCPrintBindings && !CCGenDiagnostics) {
llvm::errs() << "# \"" << T.getToolChain().getTripleString() << '"'