https://gcc.gnu.org/g:655391b46ea9aa88e73e02ba1393de3a5c28b888
commit r17-4653-g655391b46ea9aa88e73e02ba1393de3a5c28b888 Author: Jose E. Marchesi <[email protected]> Date: Wed Sep 23 11:09:19 2026 +0200 a68: use front-end type nodes consistently in the codebase Our front-end types a68_*_type, which are initialized in a68_build_a68_type_nodes, are references to the proper C types. This patch makes sure that the front-end code always use the a68_*_type rather than the C types, except for communicating with external entities that require a C type such as libcalls. Signed-off-by: Jose E. Marchesi <[email protected]> gcc/algol68/ChangeLog * a68-low-bits.cc: Use front-end type nodes consistently. * a68-low-bools.cc: Likewise. * a68-low-chars.cc: Likewise. * a68-low-clauses.cc: Likewise. * a68-low-ints.cc: Likewise. * a68-low-multiples.cc: Likewise. * a68-low-prelude.cc: Likewise. * a68-low-reals.cc: Likewise. * a68-low-unions.cc: Likewise. * a68-low-units.cc: Likewise. * a68-low.cc: Likewise. Diff: --- gcc/algol68/a68-low-bits.cc | 10 +++++----- gcc/algol68/a68-low-bools.cc | 4 ++-- gcc/algol68/a68-low-chars.cc | 30 +++++++++++++++--------------- gcc/algol68/a68-low-clauses.cc | 12 ++++++------ gcc/algol68/a68-low-ints.cc | 16 ++++++++-------- gcc/algol68/a68-low-multiples.cc | 20 ++++++++++---------- gcc/algol68/a68-low-prelude.cc | 2 +- gcc/algol68/a68-low-reals.cc | 16 ++++++++-------- gcc/algol68/a68-low-unions.cc | 2 +- gcc/algol68/a68-low-units.cc | 10 +++++----- gcc/algol68/a68-low.cc | 6 +++--- 11 files changed, 64 insertions(+), 64 deletions(-) diff --git a/gcc/algol68/a68-low-bits.cc b/gcc/algol68/a68-low-bits.cc index 2a4cd8b5adad..12b91cd66699 100644 --- a/gcc/algol68/a68-low-bits.cc +++ b/gcc/algol68/a68-low-bits.cc @@ -225,10 +225,10 @@ a68_bits_elem (NODE_T *p, tree pos, tree bits) filename, build_int_cst (unsigned_type_node, lineno), fold_convert (ssizetype, pos)); - tree check = fold_build2 (TRUTH_AND_EXPR, integer_type_node, - fold_build2 (GT_EXPR, integer_type_node, + tree check = fold_build2 (TRUTH_AND_EXPR, a68_int_type, + fold_build2 (GT_EXPR, a68_int_type, pos, fold_convert (TREE_TYPE (pos), integer_zero_node)), - fold_build2 (LE_EXPR, integer_type_node, + fold_build2 (LE_EXPR, a68_int_type, fold_convert (bitsizetype, pos), TYPE_SIZE (TREE_TYPE (bits)))); @@ -298,7 +298,7 @@ a68_bits_shift (NODE_T *p, tree shift, tree bits) tree a68_bits_eq (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, EQ_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, EQ_EXPR, a68_bool_type, a, b); } /* Given two bits values, build an expression that calculates whether A /= @@ -307,7 +307,7 @@ a68_bits_eq (tree a, tree b, location_t loc) tree a68_bits_ne (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, NE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, NE_EXPR, a68_bool_type, a, b); } /* Set the bit NUMBIT in BITS. diff --git a/gcc/algol68/a68-low-bools.cc b/gcc/algol68/a68-low-bools.cc index 000e919407d9..f8df5233ad9f 100644 --- a/gcc/algol68/a68-low-bools.cc +++ b/gcc/algol68/a68-low-bools.cc @@ -64,7 +64,7 @@ a68_bool_abs (tree val) tree a68_bool_eq (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, EQ_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, EQ_EXPR, a68_bool_type, a, b); } /* Given two boolean values, build an expression that calculates whether A /= @@ -73,5 +73,5 @@ a68_bool_eq (tree a, tree b, location_t loc) tree a68_bool_ne (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, NE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, NE_EXPR, a68_bool_type, a, b); } diff --git a/gcc/algol68/a68-low-chars.cc b/gcc/algol68/a68-low-chars.cc index 381e455b7f1f..b60b0ec3127c 100644 --- a/gcc/algol68/a68-low-chars.cc +++ b/gcc/algol68/a68-low-chars.cc @@ -72,20 +72,20 @@ a68_char_repr (NODE_T *p, tree val) tree val_type = TREE_TYPE (val); /* (c >= 0 && c < 0xd800) */ - tree range1 = fold_build2 (TRUTH_AND_EXPR, integer_type_node, - fold_build2 (GE_EXPR, integer_type_node, + tree range1 = fold_build2 (TRUTH_AND_EXPR, a68_int_type, + fold_build2 (GE_EXPR, a68_int_type, c, fold_convert (val_type, integer_zero_node)), - fold_build2 (LT_EXPR, integer_type_node, + fold_build2 (LT_EXPR, a68_int_type, c, build_int_cst (val_type, 0xd800))); /* (c >= 0xe000 && c < 0x110000) */ - tree range2 = fold_build2 (TRUTH_AND_EXPR, integer_type_node, - fold_build2 (GE_EXPR, integer_type_node, + tree range2 = fold_build2 (TRUTH_AND_EXPR, a68_int_type, + fold_build2 (GE_EXPR, a68_int_type, c, build_int_cst (val_type, 0xe000)), - fold_build2 (LT_EXPR, integer_type_node, + fold_build2 (LT_EXPR, a68_int_type, c, build_int_cst (val_type, 0x110000))); tree notvalid = fold_build1 (TRUTH_NOT_EXPR, - integer_type_node, - fold_build2 (TRUTH_OR_EXPR, integer_type_node, + a68_int_type, + fold_build2 (TRUTH_OR_EXPR, a68_int_type, range1, range2)); /* Call to the runtime run-time error handler. */ @@ -101,7 +101,7 @@ a68_char_repr (NODE_T *p, tree val) /* Return the REPR of the given integer value, or raise run-time error. */ return fold_build2 (COMPOUND_EXPR, a68_char_type, - fold_build3 (COND_EXPR, integer_type_node, + fold_build3 (COND_EXPR, a68_int_type, notvalid, call, integer_zero_node), fold_convert (a68_char_type, c)); @@ -121,7 +121,7 @@ a68_char_abs (tree val) tree a68_char_eq (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, EQ_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, EQ_EXPR, a68_bool_type, a, b); } /* Given two characters, build an expression that calculates whether A /= @@ -130,7 +130,7 @@ a68_char_eq (tree a, tree b, location_t loc) tree a68_char_ne (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, NE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, NE_EXPR, a68_bool_type, a, b); } /* Given two characters, build an expression that calculates @@ -139,7 +139,7 @@ a68_char_ne (tree a, tree b, location_t loc) tree a68_char_lt (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, LT_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, LT_EXPR, a68_bool_type, a, b); } /* Given two characters, build an expression that calculates @@ -148,7 +148,7 @@ a68_char_lt (tree a, tree b, location_t loc) tree a68_char_le (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, LE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, LE_EXPR, a68_bool_type, a, b); } /* Given two characters, build an expression that calculates @@ -157,7 +157,7 @@ a68_char_le (tree a, tree b, location_t loc) tree a68_char_gt (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, GT_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, GT_EXPR, a68_bool_type, a, b); } /* Given two characters, build an expression that calculates @@ -166,5 +166,5 @@ a68_char_gt (tree a, tree b, location_t loc) tree a68_char_ge (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, GE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, GE_EXPR, a68_bool_type, a, b); } diff --git a/gcc/algol68/a68-low-clauses.cc b/gcc/algol68/a68-low-clauses.cc index 683755217d4c..168b3f49fe52 100644 --- a/gcc/algol68/a68-low-clauses.cc +++ b/gcc/algol68/a68-low-clauses.cc @@ -375,7 +375,7 @@ a68_lower_loop_clause (NODE_T *p ATTRIBUTE_UNUSED, to_part = a68_lower_tmpvar ("to_part%", TREE_TYPE (to_part), to_part); /* We need to detect overflow/underflow of the iterator. */ - overflow = a68_lower_tmpvar ("overflow%", boolean_type_node, + overflow = a68_lower_tmpvar ("overflow%", a68_bool_type, boolean_false_node); } @@ -403,7 +403,7 @@ a68_lower_loop_clause (NODE_T *p ATTRIBUTE_UNUSED, tree exit_condition = NULL_TREE; /* IF overflow OREL (by_part < 0 THEN iterator < to_part ELSE iterator > to_part) FI */ if (has_iterator) - exit_condition = fold_build2 (TRUTH_ORIF_EXPR, boolean_type_node, + exit_condition = fold_build2 (TRUTH_ORIF_EXPR, a68_bool_type, overflow, fold_build3 (COND_EXPR, a68_bool_type, @@ -449,9 +449,9 @@ a68_lower_loop_clause (NODE_T *p ATTRIBUTE_UNUSED, tree a = iterator; tree b = save_expr (by_part); tree sum = fold_build2 (PLUS_EXPR, type, a, b); - a68_add_stmt (fold_build2 (MODIFY_EXPR, boolean_type_node, + a68_add_stmt (fold_build2 (MODIFY_EXPR, a68_bool_type, overflow, - fold_build2 (LT_EXPR, boolean_type_node, + fold_build2 (LT_EXPR, a68_bool_type, fold_build2 (BIT_AND_EXPR, type, fold_build1 (BIT_NOT_EXPR, type, fold_build2 (BIT_XOR_EXPR, type, @@ -537,14 +537,14 @@ lower_unite_case_unit (NODE_T *p, { int index = a68_united_mode_index (enquiry_mode, MOID (pack)); tree expr = fold_build2 (EQ_EXPR, - boolean_type_node, + a68_bool_type, overhead, build_int_cst (TREE_TYPE (overhead), index)); if (entry_selected == NULL_TREE) entry_selected = expr; else entry_selected = fold_build2 (TRUTH_OR_EXPR, - boolean_type_node, + a68_bool_type, entry_selected, expr); } diff --git a/gcc/algol68/a68-low-ints.cc b/gcc/algol68/a68-low-ints.cc index d80d35e8302b..4bf97e9ebea4 100644 --- a/gcc/algol68/a68-low-ints.cc +++ b/gcc/algol68/a68-low-ints.cc @@ -94,11 +94,11 @@ a68_int_sign (tree val) val = save_expr (val); return fold_build3 (COND_EXPR, a68_int_type, - fold_build2 (EQ_EXPR, integer_type_node, val, zero), + fold_build2 (EQ_EXPR, a68_int_type, val, zero), build_int_cst (a68_int_type, 0), fold_build3 (COND_EXPR, a68_int_type, - fold_build2 (GT_EXPR, integer_type_node, val, zero), + fold_build2 (GT_EXPR, a68_int_type, val, zero), build_int_cst (a68_int_type, 1), build_int_cst (a68_int_type, -1))); } @@ -193,7 +193,7 @@ a68_int_div (MOID_T *m, tree a, tree b, location_t loc) tree a68_int_eq (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, EQ_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, EQ_EXPR, a68_bool_type, a, b); } /* Given two integral values of mode M, build an expression that calculates @@ -202,7 +202,7 @@ a68_int_eq (tree a, tree b, location_t loc) tree a68_int_ne (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, NE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, NE_EXPR, a68_bool_type, a, b); } /* Given two integral values of mode M, build an expression that calculates @@ -211,7 +211,7 @@ a68_int_ne (tree a, tree b, location_t loc) tree a68_int_lt (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, LT_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, LT_EXPR, a68_bool_type, a, b); } /* Given two integral values of mode M, build an expression that calculates @@ -220,7 +220,7 @@ a68_int_lt (tree a, tree b, location_t loc) tree a68_int_le (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, LE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, LE_EXPR, a68_bool_type, a, b); } /* Given two integral values of mode M, build an expression that calculates @@ -229,7 +229,7 @@ a68_int_le (tree a, tree b, location_t loc) tree a68_int_gt (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, GT_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, GT_EXPR, a68_bool_type, a, b); } /* Given two integral values of mode M, build an expression that calculates @@ -238,7 +238,7 @@ a68_int_gt (tree a, tree b, location_t loc) tree a68_int_ge (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, GE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, GE_EXPR, a68_bool_type, a, b); } /* Given two integral values of mode M, build and expression that calculates the diff --git a/gcc/algol68/a68-low-multiples.cc b/gcc/algol68/a68-low-multiples.cc index 3f63d7d93b2d..fb1683eeac2c 100644 --- a/gcc/algol68/a68-low-multiples.cc +++ b/gcc/algol68/a68-low-multiples.cc @@ -544,7 +544,7 @@ a68_multiple_slice (NODE_T *p, fold_build2 (LE_EXPR, ssizetype, lower_bound, upper_bound), fold_build2 (TRUTH_AND_EXPR, - boolean_type_node, + a68_bool_type, fold_build2 (GE_EXPR, ssizetype, fold_convert (ssizetype, index_expr), @@ -908,9 +908,9 @@ a68_boundable_dim_check (NODE_T *p, tree boundable_dim, tree dim) boundable_dim, dim); call = fold_build2 (COMPOUND_EXPR, a68_bool_type, call, boolean_false_node); - tree dim_check = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, - fold_build2 (GT_EXPR, boolean_type_node, dim, size_zero_node), - fold_build2 (LE_EXPR, boolean_type_node, dim, boundable_dim)); + tree dim_check = fold_build2 (TRUTH_AND_EXPR, a68_bool_type, + fold_build2 (GT_EXPR, a68_bool_type, dim, size_zero_node), + fold_build2 (LE_EXPR, a68_bool_type, dim, boundable_dim)); return fold_build2_loc (a68_get_node_location (p), TRUTH_ORIF_EXPR, ssizetype, @@ -984,7 +984,7 @@ a68_multiple_bounds_check (NODE_T *p, tree dim, fold_build2 (LE_EXPR, ssizetype, lower_bound, upper_bound), fold_build2 (TRUTH_AND_EXPR, - boolean_type_node, + a68_bool_type, fold_build2 (GE_EXPR, ssizetype, fold_convert (ssizetype, index), @@ -1037,10 +1037,10 @@ a68_multiple_bounds_check_equal (NODE_T *p, tree m1, tree m2) tree ub2 = save_expr (a68_multiple_upper_bound (m2, dim_tree)); tree bounds_equal = fold_build2 (TRUTH_AND_EXPR, - boolean_type_node, - fold_build2 (EQ_EXPR, boolean_type_node, + a68_bool_type, + fold_build2 (EQ_EXPR, a68_bool_type, lb1, lb2), - fold_build2 (EQ_EXPR, boolean_type_node, + fold_build2 (EQ_EXPR, a68_bool_type, ub1, ub2)); unsigned int lineno = LINE_NUMBER (p); @@ -1053,10 +1053,10 @@ a68_multiple_bounds_check_equal (NODE_T *p, tree m1, tree m2) build_int_cst (unsigned_type_node, lineno), dim_plus_one, lb1, ub1, lb2, ub2); - call = fold_build2 (COMPOUND_EXPR, boolean_type_node, call, boolean_false_node); + call = fold_build2 (COMPOUND_EXPR, a68_bool_type, call, boolean_false_node); tree check = fold_build2_loc (a68_get_node_location (p), - TRUTH_ORIF_EXPR, boolean_type_node, + TRUTH_ORIF_EXPR, a68_bool_type, bounds_equal, call); a68_add_stmt (check); diff --git a/gcc/algol68/a68-low-prelude.cc b/gcc/algol68/a68-low-prelude.cc index 804febf2c613..eea57ae666cc 100644 --- a/gcc/algol68/a68-low-prelude.cc +++ b/gcc/algol68/a68-low-prelude.cc @@ -731,7 +731,7 @@ elems (NODE_T *p, tree boundable, tree dim) size_one_node); tree elems = fold_build3 (COND_EXPR, sizetype, - fold_build2 (LT_EXPR, boolean_type_node, + fold_build2 (LT_EXPR, a68_bool_type, upper_bound, lower_bound), size_zero_node, non_flat); diff --git a/gcc/algol68/a68-low-reals.cc b/gcc/algol68/a68-low-reals.cc index 418fbc8b796a..f24add7b43f1 100644 --- a/gcc/algol68/a68-low-reals.cc +++ b/gcc/algol68/a68-low-reals.cc @@ -140,11 +140,11 @@ a68_real_sign (tree val) val = save_expr (val); return fold_build3 (COND_EXPR, a68_int_type, - build2 (EQ_EXPR, integer_type_node, val, zero), + build2 (EQ_EXPR, a68_int_type, val, zero), build_int_cst (a68_int_type, 0), fold_build3 (COND_EXPR, a68_int_type, - fold_build2 (GT_EXPR, integer_type_node, val, zero), + fold_build2 (GT_EXPR, a68_int_type, val, zero), build_int_cst (a68_int_type, 1), build_int_cst (a68_int_type, -1))); } @@ -507,7 +507,7 @@ a68_real_div (MOID_T *m, tree a, tree b, location_t loc) tree a68_real_eq (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, EQ_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, EQ_EXPR, a68_bool_type, a, b); } /* Given two real values of mode M, build an expression that calculates whether @@ -516,7 +516,7 @@ a68_real_eq (tree a, tree b, location_t loc) tree a68_real_ne (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, NE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, NE_EXPR, a68_bool_type, a, b); } /* Given two real values of mode M, build an expression that calculates whether @@ -525,7 +525,7 @@ a68_real_ne (tree a, tree b, location_t loc) tree a68_real_lt (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, LT_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, LT_EXPR, a68_bool_type, a, b); } /* Given two real values of mode M, build an expression that calculates @@ -534,7 +534,7 @@ a68_real_lt (tree a, tree b, location_t loc) tree a68_real_le (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, LE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, LE_EXPR, a68_bool_type, a, b); } /* Given two real values of mode M, build an expression that calculates whether @@ -543,7 +543,7 @@ a68_real_le (tree a, tree b, location_t loc) tree a68_real_gt (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, GT_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, GT_EXPR, a68_bool_type, a, b); } /* Given two real values of mode M, build an expression that calculates whether @@ -552,7 +552,7 @@ a68_real_gt (tree a, tree b, location_t loc) tree a68_real_ge (tree a, tree b, location_t loc) { - return fold_build2_loc (loc, GE_EXPR, boolean_type_node, a, b); + return fold_build2_loc (loc, GE_EXPR, a68_bool_type, a, b); } /* Exponentiation involving real values. diff --git a/gcc/algol68/a68-low-unions.cc b/gcc/algol68/a68-low-unions.cc index f775877f3271..7b84be014667 100644 --- a/gcc/algol68/a68-low-unions.cc +++ b/gcc/algol68/a68-low-unions.cc @@ -126,7 +126,7 @@ a68_union_translate_overhead (MOID_T *from, tree from_overhead, if (a68_union_contains_mode (to, mode)) { to_overhead = fold_build3 (COND_EXPR, sizetype, - fold_build2 (EQ_EXPR, boolean_type_node, + fold_build2 (EQ_EXPR, a68_bool_type, from_overhead, size_int (i)), size_int (a68_united_mode_index (to, mode)), diff --git a/gcc/algol68/a68-low-units.cc b/gcc/algol68/a68-low-units.cc index ac7accd9051a..b53a1c1b50fe 100644 --- a/gcc/algol68/a68-low-units.cc +++ b/gcc/algol68/a68-low-units.cc @@ -324,11 +324,11 @@ a68_lower_denotation (NODE_T *p, LOW_CTX_T ctx) s = SUB (p); if (moid == M_REAL) - type = float_type_node; + type = a68_real_type; else if (moid == M_LONG_REAL) - type = double_type_node; + type = a68_long_real_type; else if (moid == M_LONG_LONG_REAL) - type = long_double_type_node; + type = a68_long_long_real_type; else gcc_unreachable (); @@ -412,7 +412,7 @@ a68_lower_identity_relation (NODE_T *p, LOW_CTX_T ctx) gcc_unreachable (); return fold_build2_loc (a68_get_node_location (p), - code, boolean_type_node, op1, op2); + code, a68_bool_type, op1, op2); } /* Lower AND_FUNCTION and OR_FUNCTION. @@ -445,7 +445,7 @@ a68_lower_logic_function (NODE_T *p, LOW_CTX_T ctx) gcc_unreachable (); return fold_build2_loc (a68_get_node_location (p), - code, boolean_type_node, op1, op2); + code, a68_bool_type, op1, op2); } /* Lower a primary. diff --git a/gcc/algol68/a68-low.cc b/gcc/algol68/a68-low.cc index 62fbdc49d3fa..bc9da115d15b 100644 --- a/gcc/algol68/a68-low.cc +++ b/gcc/algol68/a68-low.cc @@ -916,13 +916,13 @@ a68_low_dup (tree expr, bool use_heap) a68_add_decl (continue_label_decl); a68_add_stmt (fold_build2 (TRUTH_ORIF_EXPR, - integer_type_node, + a68_int_type, fold_build2 (EQ_EXPR, - integer_type_node, + a68_int_type, a68_union_overhead (dup), size_int (a68_united_mode_index (union_mode, MOID (pack)))), fold_build2 (COMPOUND_EXPR, - integer_type_node, + a68_int_type, build1 (GOTO_EXPR, void_type_node, continue_label_decl), integer_zero_node))); a68_add_stmt (fold_build2 (MODIFY_EXPR, type,
