https://gcc.gnu.org/g:30ce9dfcc665b6088e5898cfa766b57556ebb90e
commit r15-1078-g30ce9dfcc665b6088e5898cfa766b57556ebb90e Author: Gaius Mulley <gaiusm...@gmail.com> Date: Thu Jun 6 19:27:56 2024 +0100 modula2: Simplify REAL/LONGREAL/SHORTREAL node creation. This patch simplifies the real type build functions by using the default float_type_node, double_type_node rather than create new nodes. It also uses the default GCC long_double_type_node or float128_type_nodes for longreal. gcc/m2/ChangeLog: * gm2-gcc/m2type.cc (build_m2_short_real_node): Rewrite to use the default float_type_node. (build_m2_real_node): Rewrite to use the default double_type_node. (build_m2_long_real_node): Rewrite to use the default long_double_type_node or float128_type_node. Co-Authored-By: Kewen.Lin <li...@linux.ibm.com> Signed-off-by: Gaius Mulley <gaiusm...@gmail.com> Diff: --- gcc/m2/gm2-gcc/m2type.cc | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc index 571923c08ef..5773a5cbd19 100644 --- a/gcc/m2/gm2-gcc/m2type.cc +++ b/gcc/m2/gm2-gcc/m2type.cc @@ -1415,45 +1415,29 @@ build_m2_char_node (void) static tree build_m2_short_real_node (void) { - tree c; - - /* Define `REAL'. */ - - c = make_node (REAL_TYPE); - TYPE_PRECISION (c) = FLOAT_TYPE_SIZE; - layout_type (c); - return c; + /* Define `SHORTREAL'. */ + ASSERT_CONDITION (TYPE_PRECISION (float_type_node) == FLOAT_TYPE_SIZE); + return float_type_node; } static tree build_m2_real_node (void) { - tree c; - /* Define `REAL'. */ - - c = make_node (REAL_TYPE); - TYPE_PRECISION (c) = DOUBLE_TYPE_SIZE; - layout_type (c); - return c; + ASSERT_CONDITION (TYPE_PRECISION (double_type_node) == DOUBLE_TYPE_SIZE); + return double_type_node; } static tree build_m2_long_real_node (void) { tree longreal; - + /* Define `LONGREAL'. */ - if (M2Options_GetIBMLongDouble ()) - { - longreal = make_node (REAL_TYPE); - TYPE_PRECISION (longreal) = LONG_DOUBLE_TYPE_SIZE; - } - else if (M2Options_GetIEEELongDouble ()) + if (M2Options_GetIEEELongDouble ()) longreal = float128_type_node; else longreal = long_double_type_node; - layout_type (longreal); return longreal; }