Push bound architecture name into Compilation::getArgsForToolChain.

llvm-svn: 81365
This commit is contained in:
Daniel Dunbar 2009-09-09 18:36:01 +00:00
parent 1bad7f222a
commit b5d86bbd76
4 changed files with 20 additions and 13 deletions

View File

@ -47,7 +47,8 @@ class Compilation {
JobList Jobs;
/// Cache of translated arguments for a particular tool chain.
llvm::DenseMap<const ToolChain*, DerivedArgList*> TCArgs;
llvm::DenseMap<std::pair<const ToolChain*, const char*>,
DerivedArgList*> TCArgs;
/// Temporary files which should be removed on exit.
ArgStringList TempFiles;
@ -79,7 +80,10 @@ public:
/// getArgsForToolChain - Return the derived argument list for the
/// tool chain \arg TC (or the default tool chain, if TC is not
/// specified).
const DerivedArgList &getArgsForToolChain(const ToolChain *TC = 0);
///
/// \param BoundArch - The bound architecture name, or 0.
const DerivedArgList &getArgsForToolChain(const ToolChain *TC,
const char *BoundArch);
/// addTempFile - Add a file to remove on exit, and returns its
/// argument.

View File

@ -229,6 +229,7 @@ public:
void BuildJobsForAction(Compilation &C,
const Action *A,
const ToolChain *TC,
const char *BoundArch,
bool CanAcceptPipe,
bool AtTopLevel,
const char *LinkingOutput,

View File

@ -31,8 +31,9 @@ Compilation::~Compilation() {
delete Args;
// Free any derived arg lists.
for (llvm::DenseMap<const ToolChain*, DerivedArgList*>::iterator
it = TCArgs.begin(), ie = TCArgs.end(); it != ie; ++it)
for (llvm::DenseMap<std::pair<const ToolChain*, const char*>,
DerivedArgList*>::iterator it = TCArgs.begin(),
ie = TCArgs.end(); it != ie; ++it)
delete it->second;
// Free the actions, if built.
@ -41,11 +42,12 @@ Compilation::~Compilation() {
delete *it;
}
const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC) {
const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC,
const char *BoundArch) {
if (!TC)
TC = &DefaultToolChain;
DerivedArgList *&Entry = TCArgs[TC];
DerivedArgList *&Entry = TCArgs[std::make_pair(TC, BoundArch)];
if (!Entry)
Entry = TC->TranslateArgs(*Args);

View File

@ -948,6 +948,7 @@ void Driver::BuildJobs(Compilation &C) const {
InputInfo II;
BuildJobsForAction(C, A, &C.getDefaultToolChain(),
/*BoundArch*/0,
/*CanAcceptPipe*/ true,
/*AtTopLevel*/ true,
/*LinkingOutput*/ LinkingOutput,
@ -1001,6 +1002,7 @@ void Driver::BuildJobs(Compilation &C) const {
void Driver::BuildJobsForAction(Compilation &C,
const Action *A,
const ToolChain *TC,
const char *BoundArch,
bool CanAcceptPipe,
bool AtTopLevel,
const char *LinkingOutput,
@ -1032,8 +1034,8 @@ void Driver::BuildJobsForAction(Compilation &C,
if (BAA->getArchName())
TC = Host->CreateToolChain(C.getArgs(), BAA->getArchName());
BuildJobsForAction(C, *BAA->begin(), TC, CanAcceptPipe, AtTopLevel,
LinkingOutput, Result);
BuildJobsForAction(C, *BAA->begin(), TC, BAA->getArchName(),
CanAcceptPipe, AtTopLevel, LinkingOutput, Result);
return;
}
@ -1061,10 +1063,8 @@ void Driver::BuildJobsForAction(Compilation &C,
for (ActionList::const_iterator it = Inputs->begin(), ie = Inputs->end();
it != ie; ++it) {
InputInfo II;
BuildJobsForAction(C, *it, TC, TryToUsePipeInput,
/*AtTopLevel*/false,
LinkingOutput,
II);
BuildJobsForAction(C, *it, TC, BoundArch, TryToUsePipeInput,
/*AtTopLevel*/false, LinkingOutput, II);
InputInfos.push_back(II);
}
@ -1125,7 +1125,7 @@ void Driver::BuildJobsForAction(Compilation &C,
llvm::errs() << "], output: " << Result.getAsString() << "\n";
} else {
T.ConstructJob(C, *JA, *Dest, Result, InputInfos,
C.getArgsForToolChain(TC), LinkingOutput);
C.getArgsForToolChain(TC, BoundArch), LinkingOutput);
}
}