[cfe-commits] r68241 - in /cfe/trunk/lib/Driver: Driver.cpp HostInfo.cpp Tools.cpp

Daniel Dunbar daniel at zuster.org
Wed Apr 1 13:33:27 PDT 2009


Author: ddunbar
Date: Wed Apr  1 15:33:11 2009
New Revision: 68241

URL: http://llvm.org/viewvc/llvm-project?rev=68241&view=rev
Log:
Quick and dirty (!) fix to make sure we use powerpc in triples.
 - PR3922

 - I have a clean solution for this in flight, but it may take a while
   to come to fruition so we'll take a quick fix for now.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/HostInfo.cpp
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=68241&r1=68240&r2=68241&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Apr  1 15:33:11 2009
@@ -1065,8 +1065,10 @@
     Arch = "i386";
   else if (Arch == "amd64")
     Arch = "x86_64";
-  else if (Arch == "powerpc" || Arch == "Power Macintosh")
-    Arch = "ppc";
+  else if (Arch == "ppc" || Arch == "Power Macintosh")
+    Arch = "powerpc";
+  else if (Arch == "ppc64")
+    Arch = "powerpc64";
   
   if (memcmp(&OS[0], "darwin", 6) == 0)
     return createDarwinHostInfo(*this, Arch.c_str(), Platform.c_str(), 
@@ -1080,7 +1082,14 @@
 }
 
 bool Driver::ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
-                                    const std::string &ArchName) const {
+                                    const std::string &ArchNameStr) const {
+  // FIXME: Remove this hack.
+  const char *ArchName = ArchNameStr.c_str();
+  if (ArchNameStr == "powerpc")
+    ArchName = "ppc";
+  else if (ArchNameStr == "powerpc64")
+    ArchName = "ppc64";
+
   // Check if user requested no clang, or clang doesn't understand
   // this type (we only handle single inputs for now).
   if (!CCCUseClang || JA.size() != 1 || 

Modified: cfe/trunk/lib/Driver/HostInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/HostInfo.cpp?rev=68241&r1=68240&r2=68241&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/HostInfo.cpp (original)
+++ cfe/trunk/lib/Driver/HostInfo.cpp Wed Apr  1 15:33:11 2009
@@ -77,7 +77,7 @@
   : HostInfo(D, _Arch, _Platform, _OS) {
   
   assert((getArchName() == "i386" || getArchName() == "x86_64" || 
-          getArchName() == "ppc" || getArchName() == "ppc64") &&
+          getArchName() == "powerpc" || getArchName() == "powerpc64") &&
          "Unknown Darwin arch.");
 
   assert(memcmp(&getOSName()[0], "darwin", 6) == 0 &&
@@ -117,11 +117,17 @@
       if (getArchName() == "i386" || getArchName() == "x86_64") {
         ArchName = 
           (A->getOption().getId() == options::OPT_m32) ? "i386" : "x86_64";
-      } else if (getArchName() == "ppc" || getArchName() == "ppc64") {
-        ArchName = 
-          (A->getOption().getId() == options::OPT_m32) ? "ppc" : "ppc64";
+      } else if (getArchName() == "powerpc" || getArchName() == "powerpc64") {
+        ArchName = (A->getOption().getId() == options::OPT_m32) ? "powerpc" : 
+          "powerpc64";
       }
     } 
+  } else {
+    // Normalize arch name; we shouldn't be doing this here.
+    if (strcmp(ArchName, "ppc") == 0)
+      ArchName = "powerpc";
+    else if (strcmp(ArchName, "ppc64") == 0)
+      ArchName = "powerpc64";
   }
 
   ToolChain *&TC = ToolChains[ArchName];
@@ -190,9 +196,9 @@
     if (getArchName() == "i386" || getArchName() == "x86_64") {
       ArchName = 
         (A->getOption().getId() == options::OPT_m32) ? "i386" : "x86_64";
-    } else if (getArchName() == "ppc" || getArchName() == "ppc64") {
+    } else if (getArchName() == "powerpc" || getArchName() == "powerpc64") {
       ArchName = 
-        (A->getOption().getId() == options::OPT_m32) ? "ppc" : "ppc64";
+        (A->getOption().getId() == options::OPT_m32) ? "powerpc" : "powerpc64";
     }
   } 
   

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=68241&r1=68240&r2=68241&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Apr  1 15:33:11 2009
@@ -453,7 +453,14 @@
   // If using a driver driver, force the arch.
   if (getToolChain().getHost().useDriverDriver()) {
     CmdArgs.push_back("-arch");
-    CmdArgs.push_back(getToolChain().getArchName().c_str());
+
+    // FIXME: Remove these special cases.
+    const char *Str = getToolChain().getArchName().c_str();
+    if (strcmp(Str, "powerpc") == 0)
+      Str = "ppc";
+    else if (strcmp(Str, "powerpc64") == 0)
+      Str = "ppc64";
+    CmdArgs.push_back(Str);
   }
 
   if (Output.isPipe()) {





More information about the cfe-commits mailing list