MIPS: Use -G option to specify MIPS section threshold. Translate it

to the -mllvm -mips-ssection-threshold=<value> pair and pass to the frontend.
The patch suggested by Carl Norum.

llvm-svn: 162697
This commit is contained in:
Simon Atanasyan 2012-08-27 20:55:56 +00:00
parent 3b0c2607ef
commit ec4b1c194b
2 changed files with 13 additions and 0 deletions

View 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.

View 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"