]> granicus.if.org Git - clang/commitdiff
MIPS: Use -G option to specify MIPS section threshold. Translate it
authorSimon Atanasyan <satanasyan@mips.com>
Mon, 27 Aug 2012 20:55:56 +0000 (20:55 +0000)
committerSimon Atanasyan <satanasyan@mips.com>
Mon, 27 Aug 2012 20:55:56 +0000 (20:55 +0000)
to the -mllvm -mips-ssection-threshold=<value> pair and pass to the frontend.
The patch suggested by Carl Norum.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162697 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/mips-features.c

index 11429131d768f1c15a998b868c019c445336492a..ccfa69a739b43ea26e8a5e127a9909089c3a74c0 100644 (file)
@@ -941,6 +941,13 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
   AddTargetFeature(Args, CmdArgs,
                    options::OPT_mdspr2, options::OPT_mno_dspr2,
                    "dspr2");
+
+  if (Arg *A = Args.getLastArg(options::OPT_G)) {
+    StringRef v = A->getValue(Args);
+    CmdArgs.push_back("-mllvm");
+    CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v));
+    A->claim();
+  }
 }
 
 /// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
index 5be268318886bef2fb5ee3f82a67940b2d2df0e2..28048e7740f2c4a44180129212cc92a188ec909b 100644 (file)
@@ -37,3 +37,9 @@
 // RUN:     -mdspr2 -mno-dspr2 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NOMDSPR2 %s
 // CHECK-NOMDSPR2: "-target-feature" "-dspr2"
+//
+// -G
+// RUN: %clang -target mips-linux-gnu -### -c %s \
+// RUN:     -G 16 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MIPS-G %s
+// CHECK-MIPS-G: "-mllvm" "-mips-ssection-threshold=16"