[cfe-commits] [patch] command line options for MIPS float ABI configuration

Hatanaka, Akira ahatanaka at mips.com
Tue Mar 20 18:52:57 PDT 2012


The patch looks fine. Two minor issues:

1. Curly braces aren't necessary if there is just one statement:

    if (SoftFloat) {
+      Builder.defineMacro("__mips_soft_float", Twine(1));
+    }

2.   "+soft-float" can be found in the manually written loop. Is it necessary to call std::find?

+    for (unsigned i = 0, e = Features.size(); i != e; ++i) {
+      if (Features[i] == "+soft-float")
+        SoftFloat = true;
+      else if (Features[i] == "+single-float")
+        SingleFloat = true;
+    }
+
+    // This option is front-end specific.
+    // Do not need to pass it to the backend.
+    std::vector<std::string>::iterator it;
+    it = std::find(Features.begin(), Features.end(), "+soft-float");
+    if (it != Features.end())
+      Features.erase(it);

________________________________________
From: Atanasyan, Simon
Sent: Wednesday, March 14, 2012 12:26 PM
To: cfe-commits at cs.uiuc.edu
Cc: Hatanaka, Akira; simon at atanasyan.com
Subject: [cfe-commits][patch] command line options for MIPS float ABI configuration

Hi,

MIPS backend supports three float point ABI: "hard", "soft" and "single". Clang driver does not support these float ABI correctly and has the following bugs:
1. The "single" float ABI is not supported at all.
2. It's impossible to turn on "hard" float ABI using command line. The driver accepts "-mhard-float" argument and pass it further but "-mhard-float" is not valid CC1 option.
3. If no one float ABI option is specified, the driver shows a warning and suggests to use "-mfloat-abi=soft" option. But this option is not supported for MIPS targets.
4. Clang does not define macros to mark selected float ABI (__mips_hard_float / __mips_soft_float / __mips_single_float).

The attached patch solves these problems by this way:
1. Clang driver accepts the following options for MIPS targets and configures the backend accordingly:
  "hard": "-mhard-float" or "-mfloat-abi=hard"
  "soft": "-msoft-float" or "-mfloat-abi=soft"
  "single": "-mfloat-abi=single"
2. Float ABI marker macros are defined.
3. If float ABI is not selected explicitly, the driver does not show any warning and uses "hard" ABI by default. I switched default float ABI to be compatible with gcc driver.

--
Simon




More information about the cfe-commits mailing list