r213175 - [Driver][Mips] If CPU name is not provided to the driver explicitly use

Simon Atanasyan simon at atanasyan.com
Wed Jul 16 10:34:57 PDT 2014


Author: atanasyan
Date: Wed Jul 16 12:34:54 2014
New Revision: 213175

URL: http://llvm.org/viewvc/llvm-project?rev=213175&view=rev
Log:
[Driver][Mips] If CPU name is not provided to the driver explicitly use
multilibs from the FSFS toolchain corresponding to the mips32r2/mips64r2 CPUs.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp
    cfe/trunk/test/Driver/mips-fsf.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=213175&r1=213174&r2=213175&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jul 16 12:34:54 2014
@@ -1632,21 +1632,6 @@ static bool isMips16(const ArgList &Args
   return A && A->getOption().matches(options::OPT_mips16);
 }
 
-static bool isMips32r2(const ArgList &Args) {
-  Arg *A = Args.getLastArg(options::OPT_march_EQ,
-                           options::OPT_mcpu_EQ);
-
-  return A && A->getValue() == StringRef("mips32r2");
-}
-
-static bool isMips64r2(const ArgList &Args) {
-  Arg *A = Args.getLastArg(options::OPT_march_EQ,
-                           options::OPT_mcpu_EQ);
-
-  return A && (A->getValue() == StringRef("mips64r2") ||
-               A->getValue() == StringRef("octeon"));
-}
-
 static bool isMicroMips(const ArgList &Args) {
   Arg *A = Args.getLastArg(options::OPT_mmicromips,
                            options::OPT_mno_micromips);
@@ -1707,7 +1692,7 @@ static bool findMIPSMultilibs(const llvm
       .gccSuffix("/mips32")
       .osSuffix("/mips32")
       .includeSuffix("/mips32")
-      .flag("+m32").flag("-m64").flag("-mmicromips").flag("-march=mips32r2");
+      .flag("+m32").flag("-m64").flag("-mmicromips").flag("+march=mips32");
 
     Multilib MArchMicroMips = Multilib()
       .gccSuffix("/micromips")
@@ -1728,7 +1713,7 @@ static bool findMIPSMultilibs(const llvm
       .flag("-m32").flag("+m64").flag("-march=mips64r2");
 
     Multilib MArchDefault = Multilib()
-      .flag("+m32").flag("-m64").flag("+march=mips32r2");
+      .flag("+m32").flag("-m64").flag("-mmicromips").flag("+march=mips32r2");
 
     Multilib Mips16 = Multilib()
       .gccSuffix("/mips16")
@@ -1911,8 +1896,11 @@ static bool findMIPSMultilibs(const llvm
   addMultilibFlag(isMips32(TargetArch), "m32", Flags);
   addMultilibFlag(isMips64(TargetArch), "m64", Flags);
   addMultilibFlag(isMips16(Args), "mips16", Flags);
-  addMultilibFlag(isMips32r2(Args), "march=mips32r2", Flags);
-  addMultilibFlag(isMips64r2(Args), "march=mips64r2", Flags);
+  addMultilibFlag(CPUName == "mips32", "march=mips32", Flags);
+  addMultilibFlag(CPUName == "mips32r2", "march=mips32r2", Flags);
+  addMultilibFlag(CPUName == "mips64", "march=mips64", Flags);
+  addMultilibFlag(CPUName == "mips64r2" || CPUName == "octeon",
+                  "march=mips64r2", Flags);
   addMultilibFlag(isMicroMips(Args), "mmicromips", Flags);
   addMultilibFlag(isMipsFP64(Args), "mfp64", Flags);
   addMultilibFlag(!isMipsFP64(Args), "mfp32", Flags);

Modified: cfe/trunk/test/Driver/mips-fsf.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-fsf.cpp?rev=213175&r1=213174&r2=213175&view=diff
==============================================================================
--- cfe/trunk/test/Driver/mips-fsf.cpp (original)
+++ cfe/trunk/test/Driver/mips-fsf.cpp Wed Jul 16 12:34:54 2014
@@ -520,6 +520,32 @@
 // CHECK-BE-NAN64-32R2: "[[TC]]/fp64/nan2008{{/|\\\\}}crtend.o"
 // CHECK-BE-NAN64-32R2: "[[TC]]/../../../../sysroot/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crtn.o"
 //
+// = Big-endian, default (mips32r2), fp64, nan2008
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     --target=mips-linux-gnu -mfp64 -mnan=2008 \
+// RUN:     --gcc-toolchain=%S/Inputs/mips_fsf_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-NAN64-32R2-DEF %s
+// CHECK-BE-NAN64-32R2-DEF: "-internal-isystem"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0"
+// CHECK-BE-NAN64-32R2-DEF: "-internal-isystem"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/fp64/nan2008"
+// CHECK-BE-NAN64-32R2-DEF: "-internal-isystem"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward"
+// CHECK-BE-NAN64-32R2-DEF: "-internal-externc-isystem"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/include"
+// CHECK-BE-NAN64-32R2-DEF: "-internal-externc-isystem"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/usr/include"
+// CHECK-BE-NAN64-32R2-DEF: "{{.*}}ld{{(.exe)?}}"
+// CHECK-BE-NAN64-32R2-DEF: "--sysroot=[[TC]]/../../../../sysroot/fp64/nan2008"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crt1.o"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crti.o"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/fp64/nan2008{{/|\\\\}}crtbegin.o"
+// CHECK-BE-NAN64-32R2-DEF: "-L[[TC]]/fp64/nan2008"
+// CHECK-BE-NAN64-32R2-DEF: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/../lib/fp64/nan2008"
+// CHECK-BE-NAN64-32R2-DEF: "-L[[TC]]/../../../../sysroot/fp64/nan2008/usr/lib/../lib"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/fp64/nan2008{{/|\\\\}}crtend.o"
+// CHECK-BE-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crtn.o"
+//
 // = Big-endian, micromips, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     --target=mips-linux-gnu -mmicromips -mhard-float \
@@ -1170,6 +1196,32 @@
 // CHECK-BE-NAN64-64R2-64: "[[TC]]/mips64r2/64/fp64/nan2008{{/|\\\\}}crtend.o"
 // CHECK-BE-NAN64-64R2-64: "[[TC]]/../../../../sysroot/mips64r2/64/fp64/nan2008/usr/lib{{/|\\\\}}crtn.o"
 //
+// = Big-endian, default (mips64r2), ABI 64, fp64, nan2008
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     --target=mips64-linux-gnu -mabi=64 -mfp64 -mnan=2008 \
+// RUN:     --gcc-toolchain=%S/Inputs/mips_fsf_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-BE-NAN64-64R2-64-DEF %s
+// CHECK-BE-NAN64-64R2-64-DEF: "-internal-isystem"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0"
+// CHECK-BE-NAN64-64R2-64-DEF: "-internal-isystem"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64/fp64/nan2008"
+// CHECK-BE-NAN64-64R2-64-DEF: "-internal-isystem"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward"
+// CHECK-BE-NAN64-64R2-64-DEF: "-internal-externc-isystem"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/include"
+// CHECK-BE-NAN64-64R2-64-DEF: "-internal-externc-isystem"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/usr/include"
+// CHECK-BE-NAN64-64R2-64-DEF: "{{.*}}ld{{(.exe)?}}"
+// CHECK-BE-NAN64-64R2-64-DEF: "--sysroot=[[TC]]/../../../../sysroot/mips64r2/64/fp64/nan2008"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/fp64/nan2008/usr/lib{{/|\\\\}}crt1.o"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/fp64/nan2008/usr/lib{{/|\\\\}}crti.o"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/mips64r2/64/fp64/nan2008{{/|\\\\}}crtbegin.o"
+// CHECK-BE-NAN64-64R2-64-DEF: "-L[[TC]]/mips64r2/64/fp64/nan2008"
+// CHECK-BE-NAN64-64R2-64-DEF: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/mips64r2/64/fp64/nan2008"
+// CHECK-BE-NAN64-64R2-64-DEF: "-L[[TC]]/../../../../sysroot/mips64r2/64/fp64/nan2008/usr/lib"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/mips64r2/64/fp64/nan2008{{/|\\\\}}crtend.o"
+// CHECK-BE-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/fp64/nan2008/usr/lib{{/|\\\\}}crtn.o"
+//
 // = Little-endian, mips32, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     --target=mipsel-linux-gnu -mips32 -mhard-float \
@@ -1690,6 +1742,32 @@
 // CHECK-EL-NAN64-32R2: "[[TC]]/el/fp64/nan2008{{/|\\\\}}crtend.o"
 // CHECK-EL-NAN64-32R2: "[[TC]]/../../../../sysroot/el/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crtn.o"
 //
+// = Little-endian, default (mips32r2), fp64, nan2008
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     --target=mipsel-linux-gnu -mfp64 -mnan=2008 \
+// RUN:     --gcc-toolchain=%S/Inputs/mips_fsf_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-EL-NAN64-32R2-DEF %s
+// CHECK-EL-NAN64-32R2-DEF: "-internal-isystem"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0"
+// CHECK-EL-NAN64-32R2-DEF: "-internal-isystem"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/el/fp64/nan2008"
+// CHECK-EL-NAN64-32R2-DEF: "-internal-isystem"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward"
+// CHECK-EL-NAN64-32R2-DEF: "-internal-externc-isystem"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/include"
+// CHECK-EL-NAN64-32R2-DEF: "-internal-externc-isystem"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/usr/include"
+// CHECK-EL-NAN64-32R2-DEF: "{{.*}}ld{{(.exe)?}}"
+// CHECK-EL-NAN64-32R2-DEF: "--sysroot=[[TC]]/../../../../sysroot/el/fp64/nan2008"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/el/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crt1.o"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/el/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crti.o"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/el/fp64/nan2008{{/|\\\\}}crtbegin.o"
+// CHECK-EL-NAN64-32R2-DEF: "-L[[TC]]/el/fp64/nan2008"
+// CHECK-EL-NAN64-32R2-DEF: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/../lib/el/fp64/nan2008"
+// CHECK-EL-NAN64-32R2-DEF: "-L[[TC]]/../../../../sysroot/el/fp64/nan2008/usr/lib/../lib"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/el/fp64/nan2008{{/|\\\\}}crtend.o"
+// CHECK-EL-NAN64-32R2-DEF: "[[TC]]/../../../../sysroot/el/fp64/nan2008/usr/lib/../lib{{/|\\\\}}crtn.o"
+//
 // = Little-endian, micromips, hard float
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     --target=mipsel-linux-gnu -mmicromips -mhard-float \
@@ -2339,3 +2417,29 @@
 // CHECK-EL-NAN64-64R2-64: "-L[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008/usr/lib"
 // CHECK-EL-NAN64-64R2-64: "[[TC]]/mips64r2/64/el/fp64/nan2008{{/|\\\\}}crtend.o"
 // CHECK-EL-NAN64-64R2-64: "[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008/usr/lib{{/|\\\\}}crtn.o"
+//
+// = Little-endian, default (mips64r2), ABI 64, fp64, nan2008
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN:     --target=mips64el-linux-gnu -mabi=64 -mfp64 -mnan=2008 \
+// RUN:     --gcc-toolchain=%S/Inputs/mips_fsf_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-EL-NAN64-64R2-64-DEF %s
+// CHECK-EL-NAN64-64R2-64-DEF: "-internal-isystem"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0"
+// CHECK-EL-NAN64-64R2-64-DEF: "-internal-isystem"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64/el/fp64/nan2008"
+// CHECK-EL-NAN64-64R2-64-DEF: "-internal-isystem"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward"
+// CHECK-EL-NAN64-64R2-64-DEF: "-internal-externc-isystem"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/include"
+// CHECK-EL-NAN64-64R2-64-DEF: "-internal-externc-isystem"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/usr/include"
+// CHECK-EL-NAN64-64R2-64-DEF: "{{.*}}ld{{(.exe)?}}"
+// CHECK-EL-NAN64-64R2-64-DEF: "--sysroot=[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008/usr/lib{{/|\\\\}}crt1.o"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008/usr/lib{{/|\\\\}}crti.o"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/mips64r2/64/el/fp64/nan2008{{/|\\\\}}crtbegin.o"
+// CHECK-EL-NAN64-64R2-64-DEF: "-L[[TC]]/mips64r2/64/el/fp64/nan2008"
+// CHECK-EL-NAN64-64R2-64-DEF: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/mips64r2/64/el/fp64/nan2008"
+// CHECK-EL-NAN64-64R2-64-DEF: "-L[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008/usr/lib"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/mips64r2/64/el/fp64/nan2008{{/|\\\\}}crtend.o"
+// CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/el/fp64/nan2008/usr/lib{{/|\\\\}}crtn.o"





More information about the cfe-commits mailing list