[cfe-commits] r62570 - in /cfe/trunk/tools/ccc: ccclib/ToolChain.py ccclib/Tools.py test/ccc/darwin-x86-cc1.m

Daniel Dunbar daniel at zuster.org
Mon Jan 19 21:51:52 PST 2009


Author: ddunbar
Date: Mon Jan 19 23:51:52 2009
New Revision: 62570

URL: http://llvm.org/viewvc/llvm-project?rev=62570&view=rev
Log:
ccc: Darwin/x86: Teach compile tool how to build .pch files. xcc is
now fully independent of the gcc driver when targetting Darwin/x86.

Modified:
    cfe/trunk/tools/ccc/ccclib/ToolChain.py
    cfe/trunk/tools/ccc/ccclib/Tools.py
    cfe/trunk/tools/ccc/test/ccc/darwin-x86-cc1.m

Modified: cfe/trunk/tools/ccc/ccclib/ToolChain.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/ToolChain.py?rev=62570&r1=62569&r2=62570&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/ToolChain.py (original)
+++ cfe/trunk/tools/ccc/ccclib/ToolChain.py Mon Jan 19 23:51:52 2009
@@ -54,7 +54,7 @@
         self.toolMap = {
             Phases.PreprocessPhase : Tools.Darwin_X86_PreprocessTool(self),
             Phases.CompilePhase : Tools.Darwin_X86_CompileTool(self),
-            Phases.PrecompilePhase : Tools.GCC_PrecompileTool(),
+            Phases.PrecompilePhase : Tools.Darwin_X86_CompileTool(self),
             Phases.AssemblePhase : Tools.Darwin_AssembleTool(self),
             Phases.LinkPhase : Tools.Darwin_X86_LinkTool(self),
             Phases.LipoPhase : Tools.LipoTool(),

Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=62570&r1=62569&r2=62570&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Mon Jan 19 23:51:52 2009
@@ -280,21 +280,21 @@
         """getCC1Name(type) -> name, use-cpp, is-cxx"""
         
         # FIXME: Get bool results from elsewhere.
-        if type is Types.CType:
+        if type is Types.CType or type is Types.CHeaderType:
             return 'cc1',True,False
-        elif type is Types.CTypeNoPP:
+        elif type is Types.CTypeNoPP or type is Types.CHeaderNoPPType:
             return 'cc1',False,False
-        elif type is Types.ObjCType:
+        elif type is Types.ObjCType or type is Types.ObjCHeaderType:
             return 'cc1obj',True,False
-        elif type is Types.ObjCTypeNoPP:
+        elif type is Types.ObjCTypeNoPP or type is Types.ObjCHeaderNoPPTypeP:
             return 'cc1obj',True,False
-        elif type is Types.CXXType:
+        elif type is Types.CXXType or type is Types.CXXHeaderType:
             return 'cc1plus',True,True
-        elif type is Types.CXXTypeNoPP:
+        elif type is Types.CXXTypeNoPP or type is Types.CXXHeaderNoPPType:
             return 'cc1plus',False,True
-        elif type is Types.ObjCXXType:
+        elif type is Types.ObjCXXType or type is Types.ObjCXXHeaderType:
             return 'cc1objplus',True,True
-        elif type is Types.ObjCXXTypeNoPP:
+        elif type is Types.ObjCXXTypeNoPP or type is Types.ObjCXXHeaderNoPPType:
             return 'cc1objplus',False,True
         else:
             raise ValueError,"Unexpected type for Darwin compile tool."
@@ -622,7 +622,10 @@
             arglist.getLastArg(arglist.parser.f_traditionalOption)):
             raise Arguments.InvalidArgumentsError("-traditional is not supported without -E")
 
-        output_args = self.getOutputArgs(arglist, output)
+        if outputType is Types.PCHType:
+            output_args = []
+        else:
+            output_args = self.getOutputArgs(arglist, output)
     
         # There is no need for this level of compatibility, but it
         # makes diffing easier.
@@ -653,6 +656,17 @@
                                    early_output_args, isCXX)
             cmd_args.extend(end_output_args)
 
+        if outputType is Types.PCHType:
+            assert output is not None and not isinstance(output, Jobs.PipedJob)
+
+            cmd_args.append('-o')
+            # NOTE: gcc uses a temp .s file for this, but there
+            # doesn't seem to be a good reason.
+            cmd_args.append('/dev/null')
+            
+            cmd_args.append('--output-pch=')
+            cmd_args.append(arglist.getValue(output))            
+            
         jobs.addJob(Jobs.Command(self.toolChain.getProgramPath(cc1Name), 
                                  cmd_args))
 

Modified: cfe/trunk/tools/ccc/test/ccc/darwin-x86-cc1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/test/ccc/darwin-x86-cc1.m?rev=62570&r1=62569&r2=62570&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/test/ccc/darwin-x86-cc1.m (original)
+++ cfe/trunk/tools/ccc/test/ccc/darwin-x86-cc1.m Mon Jan 19 23:51:52 2009
@@ -8,5 +8,8 @@
 // RUN: xcc -ccc-host-bits 32 -ccc-host-machine i386 -ccc-host-system darwin -ccc-host-release 10.5.0 -### -m32 -S -x cpp-output %s &> %t.opts &&
 // RUN: grep ' "/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1" "-fpreprocessed" ".*darwin-x86-cc1.m" "-fPIC" "-quiet" "-dumpbase" "darwin-x86-cc1.m" "-mmacosx-version-min=10.6.5" "-m32" "-mtune=core2" "-auxbase" "darwin-x86-cc1" "-o" ".*"' %t.opts &&
 
+// RUN: xcc -ccc-host-bits 32 -ccc-host-machine i386 -ccc-host-system darwin -ccc-host-release 10.5.0 -### -x objective-c-header %s -o /tmp/x.gch &> %t.opts &&
+// RUN: grep ' "/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1obj" "-quiet" "-D__DYNAMIC__" ".*darwin-x86-cc1.m" "-fPIC" "-quiet" "-dumpbase" "darwin-x86-cc1.m" "-mmacosx-version-min=10.6.5" "-mtune=core2" "-auxbase" ".*" "-o" "/dev/null" "--output-pch=" "/tmp/x.gch"' %t.opts &&
+
 // RUN: true
 





More information about the cfe-commits mailing list