aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2013-02-27 14:55:49 +0000
committerSimon Atanasyan <simon@atanasyan.com>2013-02-27 14:55:49 +0000
commite9616a4972a4c2fdc28128c057f21d7a79516c86 (patch)
treea4ced46a51747caad026316b9ba2aecd525f8795 /lib/Driver
parent1d4fff5551c2347010b955b4337a2aa7d65a050e (diff)
[Mips] Add two new aliases for MIPS ABI names 32 (means o32 abi) and 64
(means n64 abi) to improve compatibility with GNU tools. Patch by Jia Liu <proljc@gmail.com>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver')
-rw-r--r--lib/Driver/Tools.cpp28
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index c24878d70f..eac4bc600f 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -870,8 +870,8 @@ static void getMipsCPUAndABI(const ArgList &Args,
if (!ABIName.empty()) {
// Deduce CPU name from ABI name.
CPUName = llvm::StringSwitch<const char *>(ABIName)
- .Cases("o32", "eabi", DefMips32CPU)
- .Cases("n32", "n64", DefMips64CPU)
+ .Cases("32", "o32", "eabi", DefMips32CPU)
+ .Cases("n32", "n64", "64", DefMips64CPU)
.Default("");
}
else if (!CPUName.empty()) {
@@ -885,6 +885,14 @@ static void getMipsCPUAndABI(const ArgList &Args,
// FIXME: Warn on inconsistent cpu and abi usage.
}
+// Convert ABI name to the GNU tools acceptable variant.
+static StringRef getGnuCompatibleMipsABIName(StringRef ABI) {
+ return llvm::StringSwitch<llvm::StringRef>(ABI)
+ .Case("o32", "32")
+ .Case("n64", "64")
+ .Default(ABI);
+}
+
// Select the MIPS float ABI as determined by -msoft-float, -mhard-float,
// and -mfloat-abi=.
static StringRef getMipsFloatABI(const Driver &D, const ArgList &Args) {
@@ -5160,14 +5168,8 @@ void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-march");
CmdArgs.push_back(CPUName.data());
- // Convert ABI name to the GNU tools acceptable variant.
- if (ABIName == "o32")
- ABIName = "32";
- else if (ABIName == "n64")
- ABIName = "64";
-
CmdArgs.push_back("-mabi");
- CmdArgs.push_back(ABIName.data());
+ CmdArgs.push_back(getGnuCompatibleMipsABIName(ABIName).data());
if (getToolChain().getArch() == llvm::Triple::mips ||
getToolChain().getArch() == llvm::Triple::mips64)
@@ -5585,14 +5587,8 @@ void linuxtools::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-march");
CmdArgs.push_back(CPUName.data());
- // Convert ABI name to the GNU tools acceptable variant.
- if (ABIName == "o32")
- ABIName = "32";
- else if (ABIName == "n64")
- ABIName = "64";
-
CmdArgs.push_back("-mabi");
- CmdArgs.push_back(ABIName.data());
+ CmdArgs.push_back(getGnuCompatibleMipsABIName(ABIName).data());
if (getToolChain().getArch() == llvm::Triple::mips ||
getToolChain().getArch() == llvm::Triple::mips64)