From 8478130d94af3313c5c8a8c3e1d5a8033e949750 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Wed, 28 Apr 2010 19:11:50 +0000 Subject: Uniquization of constants at the Tree level Uniquization of constants at the Tree level * tree.h (DECL_IN_CONSTANT_POOL): New macro (tree_decl_with_vis): Add in_constant_pool bit, move shadowed_for_var_p bit to the end. (tree_output_constant_def): Declare. * gimplify.c (gimplify_init_constructor): When using block copy, uniquize the constant constructor on the RHS. * lto-streamer-in.c (unpack_ts_decl_with_vis_value_fields): Deal with DECL_IN_CONSTANT_POOL flag. * lto-streamer-out.c (pack_ts_decl_with_vis_value_fields): Likewise. * varasm.c (make_decl_rtl): Deal with variables belonging to the global constant pool. (assemble_variable): Deal with symbols belonging to the tree constant pool. (get_constant_section): Add ALIGN parameter and simplify. (build_constant_desc): Build a VAR_DECL and attach it to the symbol. (assemble_constant_contents): Use the expression of the VAR_DECL. (output_constant_def_contents): Use the alignment of the VAR_DECL. (tree_output_constant_def): New global function. (mark_constant): Use the expression of the VAR_DECL. (place_block_symbol): Use the alignment of the VAR_DECL and the size of its expression. (output_object_block): Likewise and assemble the expression. ada/ * gcc-interface/trans.c (gnat_gimplify_expr) : Uniquize constant constructors before taking their address. From-SVN: r158838 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/trans.c | 12 ++---------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c5dac66..6303c39 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2010-04-28 Eric Botcazou + + * gcc-interface/trans.c (gnat_gimplify_expr) : Uniquize + constant constructors before taking their address. + 2010-04-25 Eric Botcazou * exp_dbug.ads: Fix outdated description. Mention link between XVS diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 84fa138..743a652 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -6036,16 +6036,8 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, the reference is in an elaboration procedure. */ if (TREE_CONSTANT (op)) { - tree new_var = create_tmp_var_raw (TREE_TYPE (op), "C"); - TREE_ADDRESSABLE (new_var) = 1; - gimple_add_tmp_var (new_var); - - TREE_READONLY (new_var) = 1; - TREE_STATIC (new_var) = 1; - DECL_INITIAL (new_var) = op; - - TREE_OPERAND (expr, 0) = new_var; - recompute_tree_invariant_for_addr_expr (expr); + tree addr = build_fold_addr_expr (tree_output_constant_def (op)); + *expr_p = fold_convert (TREE_TYPE (expr), addr); } /* Otherwise explicitly create the local temporary. That's required -- cgit v1.1