This is to remove macros {FLOAT,{,LONG_}DOUBLE}_TYPE_SIZE
defines in rl78 port, and add new port specific hook
implementation rl78_c_mode_for_floating_type.

gcc/ChangeLog:

        * config/rl78/rl78.cc (TARGET_C_MODE_FOR_FLOATING_TYPE): New macro.
        (rl78_c_mode_for_floating_type): New function.
        * config/rl78/rl78.h (FLOAT_TYPE_SIZE): Remove.
        (DOUBLE_TYPE_SIZE): Likewise.
        (LONG_DOUBLE_TYPE_SIZE): Likewise.
---
 gcc/config/rl78/rl78.cc | 15 +++++++++++++++
 gcc/config/rl78/rl78.h  |  4 ----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc
index e5345bfa9dd..ccb1c4f3867 100644
--- a/gcc/config/rl78/rl78.cc
+++ b/gcc/config/rl78/rl78.cc
@@ -4971,6 +4971,21 @@ rl78_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, 
reg_class_t rclass)
   return rclass;
 }
 
+#undef TARGET_C_MODE_FOR_FLOATING_TYPE
+#define TARGET_C_MODE_FOR_FLOATING_TYPE rl78_c_mode_for_floating_type
+
+/* Implement TARGET_C_MODE_FOR_FLOATING_TYPE.  Return SFmode for
+   TI_DOUBLE_TYPE which is for double type, go with the default
+   one for the others.  */
+
+static machine_mode
+rl78_c_mode_for_floating_type (enum tree_index ti)
+{
+  if (ti == TI_DOUBLE_TYPE)
+    return SFmode;
+  return default_mode_for_floating_type (ti);
+}
+
 
 /* The strub runtime uses asms, and physical register allocation won't
    deal with them, so disable it.  */
diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
index cfff98df6bc..a960aee3931 100644
--- a/gcc/config/rl78/rl78.h
+++ b/gcc/config/rl78/rl78.h
@@ -113,10 +113,6 @@
 #define LONG_TYPE_SIZE                 32
 #define LONG_LONG_TYPE_SIZE            64
 
-#define FLOAT_TYPE_SIZE                32
-#define DOUBLE_TYPE_SIZE               32 /*64*/
-#define LONG_DOUBLE_TYPE_SIZE          64 /*DOUBLE_TYPE_SIZE*/
-
 #define DEFAULT_SIGNED_CHAR            0
 
 #define STRICT_ALIGNMENT               1
-- 
2.43.0

Reply via email to