[cfe-commits] r62204 - in /cfe/trunk/tools/ccc/ccclib: Driver.py HostInfo.py ToolChain.py Tools.py
Daniel Dunbar
daniel at zuster.org
Tue Jan 13 17:03:37 PST 2009
Author: ddunbar
Date: Tue Jan 13 19:03:36 2009
New Revision: 62204
URL: http://llvm.org/viewvc/llvm-project?rev=62204&view=rev
Log:
ccc: Add dummy Clang/Compile tool and use on Darwin/X86 for C files.
Modified:
cfe/trunk/tools/ccc/ccclib/Driver.py
cfe/trunk/tools/ccc/ccclib/HostInfo.py
cfe/trunk/tools/ccc/ccclib/ToolChain.py
cfe/trunk/tools/ccc/ccclib/Tools.py
Modified: cfe/trunk/tools/ccc/ccclib/Driver.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Driver.py?rev=62204&r1=62203&r2=62204&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Tue Jan 13 19:03:36 2009
@@ -29,6 +29,11 @@
def __init__(self):
self.hostInfo = None
self.parser = Arguments.OptionParser()
+ self.cccHostBits = self.cccHostMachine = None
+ self.cccHostSystem = self.cccHostRelease = None
+ self.cccCXX = False
+ self.cccClang = False
+ self.cccFallback = False
# Host queries which can be forcibly over-riden by the user for
# testing purposes.
@@ -80,8 +85,6 @@
# FIXME: How to handle override of host? ccc specific options?
# Abuse -b?
- self.cccHostBits = self.cccHostMachine = None
- self.cccHostSystem = self.cccHostRelease = None
while argv and argv[0].startswith('-ccc-'):
opt,argv = argv[0][5:],argv[1:]
@@ -89,6 +92,12 @@
cccPrintOptions = True
elif opt == 'print-phases':
cccPrintPhases = True
+ elif opt == 'cxx':
+ self.cccCXX = True
+ elif opt == 'clang':
+ self.cccClang = True
+ elif opt == 'fallback':
+ self.cccFallback = True
elif opt == 'host-bits':
self.cccHostBits,argv = argv[0],argv[1:]
elif opt == 'host-machine':
Modified: cfe/trunk/tools/ccc/ccclib/HostInfo.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/HostInfo.py?rev=62204&r1=62203&r2=62204&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/HostInfo.py (original)
+++ cfe/trunk/tools/ccc/ccclib/HostInfo.py Tue Jan 13 19:03:36 2009
@@ -44,7 +44,8 @@
if arch in ('i386', 'x86_64'):
return ToolChain.Darwin_X86_ToolChain(self.driver,
self.darwinVersion,
- self.gccVersion)
+ self.gccVersion,
+ arch)
return ToolChain.Generic_GCC_ToolChain(self.driver)
Modified: cfe/trunk/tools/ccc/ccclib/ToolChain.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/ToolChain.py?rev=62204&r1=62203&r2=62204&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/ToolChain.py (original)
+++ cfe/trunk/tools/ccc/ccclib/ToolChain.py Tue Jan 13 19:03:36 2009
@@ -1,6 +1,7 @@
import Arguments
import Phases
import Tools
+import Types
###
@@ -42,12 +43,13 @@
return args
class Darwin_X86_ToolChain(ToolChain):
- def __init__(self, driver, darwinVersion, gccVersion):
+ def __init__(self, driver, darwinVersion, gccVersion, archName):
super(Darwin_X86_ToolChain, self).__init__(driver)
assert isinstance(darwinVersion, tuple) and len(darwinVersion) == 3
assert isinstance(gccVersion, tuple) and len(gccVersion) == 3
self.darwinVersion = darwinVersion
self.gccVersion = gccVersion
+ self.archName = archName
self.toolMap = {
Phases.PreprocessPhase : Tools.GCC_PreprocessTool(),
@@ -57,6 +59,7 @@
Phases.LinkPhase : Tools.Darwin_X86_LinkTool(self),
Phases.LipoPhase : Tools.LipoTool(),
}
+ self.clangTool = Tools.Clang_CompileTool()
def getToolChainDir(self):
return 'i686-apple-darwin%d/%s' % (self.darwinVersion[0],
@@ -72,6 +75,13 @@
def selectTool(self, action):
assert isinstance(action, Phases.JobAction)
+
+ if (self.driver.cccClang and
+ self.archName == 'i386' and
+ action.inputs[0].type in (Types.CType, Types.CTypeNoPP) and
+ isinstance(action.phase, Phases.CompilePhase)):
+ return self.clangTool
+
return self.toolMap[action.phase.__class__]
def translateArgs(self, args, arch):
Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62204&r1=62203&r2=62204&view=diff
==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Tue Jan 13 19:03:36 2009
@@ -172,6 +172,19 @@
output, outputType, arglist,
[])
+class Clang_CompileTool(GCC_Common_Tool):
+ def __init__(self):
+ super(Clang_CompileTool, self).__init__('clang',
+ (Tool.eFlagsPipedInput |
+ Tool.eFlagsPipedOutput |
+ Tool.eFlagsIntegratedCPP))
+
+ def constructJob(self, phase, arch, jobs, inputs,
+ output, outputType, arglist):
+ return super(Clang_CompileTool, self).constructJob(phase, arch, jobs, inputs,
+ output, outputType, arglist,
+ ['-S'])
+
class Darwin_X86_CompileTool(Tool):
def __init__(self, toolChain):
super(Darwin_X86_CompileTool, self).__init__('cc1',
More information about the cfe-commits
mailing list