[cfe-commits] r62053 - in /cfe/trunk/tools/ccc/ccclib: Driver.py HostInfo.py
Daniel Dunbar
daniel at zuster.org
Sun Jan 11 14:06:22 PST 2009
Author: ddunbar
Date: Sun Jan 11 16:06:22 2009
New Revision: 62053
URL: http://llvm.org/viewvc/llvm-project?rev=62053&view=rev
Log:
ccc: Give the Host an opportunity to switch ToolChains when binding
archs (as a driver driver).
Modified:
cfe/trunk/tools/ccc/ccclib/Driver.py
cfe/trunk/tools/ccc/ccclib/HostInfo.py
Modified: cfe/trunk/tools/ccc/ccclib/Driver.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Driver.py?rev=62053&r1=62052&r2=62053&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Sun Jan 11 16:06:22 2009
@@ -565,12 +565,13 @@
return '%s(%r, %r, %r)' % (self.__class__.__name__,
self.source, self.type, self.baseInput)
- def createJobs(phase, forwardArgs,
+ def createJobs(tc, phase, forwardArgs,
canAcceptPipe=False, atTopLevel=False, arch=None):
if isinstance(phase, Phases.InputAction):
return InputInfo(phase.filename, phase.type, phase.filename)
elif isinstance(phase, Phases.BindArchAction):
archName = args.getValue(phase.arch)
+ tc = self.hostInfo.getToolChainForArch(archName)
filteredArgs = []
for arg in forwardArgs:
if arg.opt is self.parser.archOption:
@@ -588,11 +589,11 @@
else:
filteredArgs.append(arg)
- return createJobs(phase.inputs[0], filteredArgs,
+ return createJobs(tc, phase.inputs[0], filteredArgs,
canAcceptPipe, atTopLevel, phase.arch)
assert isinstance(phase, Phases.JobAction)
- tool = self.toolChain.selectTool(phase)
+ tool = tc.selectTool(phase)
# See if we should use an integrated CPP. We only use an
# integrated cpp when we have exactly one input, since this is
@@ -609,7 +610,8 @@
# Only try to use pipes when exactly one input.
canAcceptPipe = len(inputList) == 1 and tool.acceptsPipedInput()
- inputs = [createJobs(p, forwardArgs, canAcceptPipe, False, arch) for p in inputList]
+ inputs = [createJobs(tc, p, forwardArgs, canAcceptPipe, False, arch)
+ for p in inputList]
# Determine if we should output to a pipe.
canOutputToPipe = canAcceptPipe and tool.canPipeOutput()
@@ -679,6 +681,7 @@
raise ValueError,"Cannot specify -o when generating multiple files."
for phase in phases:
- createJobs(phase, forward, canAcceptPipe=True, atTopLevel=True)
+ createJobs(self.toolChain, phase, forward,
+ canAcceptPipe=True, atTopLevel=True)
return jobs
Modified: cfe/trunk/tools/ccc/ccclib/HostInfo.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/HostInfo.py?rev=62053&r1=62052&r2=62053&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/HostInfo.py (original)
+++ cfe/trunk/tools/ccc/ccclib/HostInfo.py Sun Jan 11 16:06:22 2009
@@ -14,6 +14,12 @@
def useDriverDriver(self):
abstract
+ def getToolChain(self):
+ abstract
+
+ def getToolChainForArch(self, arch):
+ raise RuntimeError,"getToolChainForArch() unsupported on this host."
+
# Darwin
class DarwinHostInfo(HostInfo):
@@ -21,7 +27,13 @@
return True
def getToolChain(self):
- return ToolChain.Darwin_ToolChain(self.driver)
+ return self.getToolChainForArch(self.getArchName())
+
+ def getToolChainForArch(self, arch):
+ if arch in ('i386', 'x86_64'):
+ return ToolChain.Darwin_ToolChain(self.driver)
+
+ return ToolChain.Generic_GCC_ToolChain(self.driver)
class DarwinPPCHostInfo(DarwinHostInfo):
def getArchName(self):
More information about the cfe-commits
mailing list