target.h (encode_section_info): Add new argument carrying the RTL to be modified...
authorZack Weinberg <zack@gcc.gnu.org>
Sun, 20 Apr 2003 18:20:39 +0000 (18:20 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Sun, 20 Apr 2003 18:20:39 +0000 (18:20 +0000)
* target.h (encode_section_info): Add new argument carrying
the RTL to be modified by the hook.

* varasm.c (make_decl_rtl, output_constant_def): Update calls
to encode_section_info.
(default_encode_section_info): Take and use RTL argument,
don't use TREE_CST_RTL or DECL_RTL.
* output.h: Update prototype of default_encode_section_info.
* config/darwin.h (ASM_DECLARE_OBJECT_NAME)
(ASM_DECLARE_FUNCTION_NAME, ASM_OUTPUT_ALIGNED_DECL_LOCAL):
Update calls to encode_section_info.

* config/darwin.c, config/arm/arm.c, config/arm/pe.c
* config/h8300/h8300.c, config/i386/winnt.c, config/m32r/m32r.c
* config/m68hc11/m68hc11.c, config/m88k/m88k.c, config/mcore/mcore.c
* config/mips/mips.c, config/mmix/mmix.c, config/pa/pa.c
* config/romp/romp.c, config/rs6000/rs6000.c, config/s390/s390.c
* config/v850/v850.c (TARGET_ENCODE_SECTION_INFO definitions):
Take and use RTL argument, don't use TREE_CST_RTL or DECL_RTL,
except for PE dllimport/dllexport.  Update calls to
default_encode_section_info.

* config/darwin-protos.h, config/arm/arm-protos.h, config/i386-protos.h:
Update prototypes.

* doc/tm.texi (TARGET_ENCODE_SECTION_INFO): Update.

From-SVN: r65859

25 files changed:
gcc/ChangeLog
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c
gcc/config/arm/pe.c
gcc/config/darwin-protos.h
gcc/config/darwin.c
gcc/config/darwin.h
gcc/config/h8300/h8300.c
gcc/config/i386/i386-protos.h
gcc/config/i386/winnt.c
gcc/config/m32r/m32r.c
gcc/config/m68hc11/m68hc11.c
gcc/config/m88k/m88k.c
gcc/config/mcore/mcore.c
gcc/config/mips/mips.c
gcc/config/mmix/mmix.c
gcc/config/pa/pa.c
gcc/config/romp/romp.c
gcc/config/rs6000/rs6000.c
gcc/config/s390/s390.c
gcc/config/v850/v850.c
gcc/doc/tm.texi
gcc/output.h
gcc/target.h
gcc/varasm.c

index f2167841c800bfa2aa9f599ca867238684ed0fcf..f4e81ebb4da93586b70d7c081ca1e420fad5d3d9 100644 (file)
@@ -1,3 +1,32 @@
+2003-04-20  Zack Weinberg  <zack@codesourcery.com>
+
+       * target.h (encode_section_info): Add new argument carrying
+       the RTL to be modified by the hook.
+
+       * varasm.c (make_decl_rtl, output_constant_def): Update calls
+       to encode_section_info.
+       (default_encode_section_info): Take and use RTL argument,
+       don't use TREE_CST_RTL or DECL_RTL.
+       * output.h: Update prototype of default_encode_section_info.
+       * config/darwin.h (ASM_DECLARE_OBJECT_NAME)
+       (ASM_DECLARE_FUNCTION_NAME, ASM_OUTPUT_ALIGNED_DECL_LOCAL):
+       Update calls to encode_section_info.
+
+       * config/darwin.c, config/arm/arm.c, config/arm/pe.c
+       * config/h8300/h8300.c, config/i386/winnt.c, config/m32r/m32r.c
+       * config/m68hc11/m68hc11.c, config/m88k/m88k.c, config/mcore/mcore.c
+       * config/mips/mips.c, config/mmix/mmix.c, config/pa/pa.c
+       * config/romp/romp.c, config/rs6000/rs6000.c, config/s390/s390.c
+       * config/v850/v850.c (TARGET_ENCODE_SECTION_INFO definitions):
+       Take and use RTL argument, don't use TREE_CST_RTL or DECL_RTL,
+       except for PE dllimport/dllexport.  Update calls to
+       default_encode_section_info.
+
+       * config/darwin-protos.h, config/arm/arm-protos.h, config/i386-protos.h:
+       Update prototypes.
+
+       * doc/tm.texi (TARGET_ENCODE_SECTION_INFO): Update.
+
 2003-04-20  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR/8705
@@ -251,19 +280,19 @@ Sat Apr 19 14:56:17 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
        * calls.c (expand_call): Move special case for constructor calls
        to right place. Ensures constructor calls used to initialize
-       arguments get a clean outgoing argument block for themselves. 
+       arguments get a clean outgoing argument block for themselves.
        Move check for stack deallocation completeness until after last
        deallocation.  Add stack_pointer_delta to set of state
        variables saved and restored along with current stack_level.
-       
-        * integrate.c (expand_inline_function): Ensure non-const actuals
-        don't end up const in the caller's flow after conversion to possibly
-        const formal type.
+
+       * integrate.c (expand_inline_function): Ensure non-const actuals
+       don't end up const in the caller's flow after conversion to possibly
+       const formal type.
 
 2003-04-18  Vincent Celier  <celier@gnat.com>
 
-        * dwarf2out.c (loc_descriptor_from_tree): Treat all *_MOD_EXPR
-        and *_DIV_EXPR as TRUNC_*_EXPR.
+       * dwarf2out.c (loc_descriptor_from_tree): Treat all *_MOD_EXPR
+       and *_DIV_EXPR as TRUNC_*_EXPR.
 
 2003-04-18  Mark Mitchell  <mark@codesourcery.com>
 
@@ -379,8 +408,8 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
 2003-04-17  Simon Law  <sfllaw@engmail.uwaterloo.ca>
 
-        * doc/include/gpl.texi: Fix double-spacing after "MA" to match
-        the one provided by the FSF.
+       * doc/include/gpl.texi: Fix double-spacing after "MA" to match
+       the one provided by the FSF.
 
 2003-04-17  Gerald Pfeifer  <pfeifer@dbai.tuwien.ac.at>
 
@@ -444,7 +473,7 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
        (tls_model_chars): Remove.
        (larl_operand): Use SYMBOL_REF_FLAGS.
        (tls_symbolic_operand): Use SYMBOL_REF_TLS_MODEL.
-       (legitimize_pic_address): Use SYMBOL_REF_LOCAL_P. 
+       (legitimize_pic_address): Use SYMBOL_REF_LOCAL_P.
        (s390_output_mi_thunk): Likewise.
        (s390_emit_prologue): Set SYMBOL_FLAG_LOCAL as needed.
        (s390_function_profiler): Likewise.
@@ -505,7 +534,7 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
 2003-04-17  Richard Henderson  <rth@redhat.com>
 
-       * varasm.c (default_encode_section_info): Don't set 
+       * varasm.c (default_encode_section_info): Don't set
        SYMBOL_FLAG_EXTERNAL if not TREE_PUBLIC.
        * config/i370/i370.c (i370_encode_section_info): Remove.
        * config/i370/i370.h (CONSTANT_ADDRESS_P): Use SYMBOL_REF_EXTERNAL_P.
@@ -577,7 +606,7 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
 2003-04-16  Richard Henderson  <rth@redhat.com>
 
        * arc.c (arc_encode_section_info): Remove.
-       (arc_assemble_integer): Use SYMBOL_REF_FUNCTION_P.      
+       (arc_assemble_integer): Use SYMBOL_REF_FUNCTION_P.
        (arc_print_operand, arc_print_operand_address): Likewise.
        * arc.h (EXTRA_CONSTRAINT): Likewise.
 
@@ -618,16 +647,16 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
 2003-04-16  Olivier Hainque <hainque@act-europe.fr>
 
-        * tree.c (skip_simple_arithmetics_at, saved_expr_p): New functions.
-        (save_expr): Replace loop by call to skip_simple_arithmetics_at.
-        * tree.h: Add prototypes for the two new functions.
-        * fold-const.c (fold_binary_op_with_conditional_arg): Replace test
-        updates introduced in the previous revision by call to saved_expr_p.
-        * stor-layout.c (put_pending_size): Use skip_simple_arithmetics_at.
+       * tree.c (skip_simple_arithmetics_at, saved_expr_p): New functions.
+       (save_expr): Replace loop by call to skip_simple_arithmetics_at.
+       * tree.h: Add prototypes for the two new functions.
+       * fold-const.c (fold_binary_op_with_conditional_arg): Replace test
+       updates introduced in the previous revision by call to saved_expr_p.
+       * stor-layout.c (put_pending_size): Use skip_simple_arithmetics_at.
 
-        * expr.c (store_field): Force usage of bitfield instructions when
-        the field position requires it, whatever SLOW_UNALIGNED_ACCESS.
-        (expand_expr, case BIT_FIELD_REF): likewise.
+       * expr.c (store_field): Force usage of bitfield instructions when
+       the field position requires it, whatever SLOW_UNALIGNED_ACCESS.
+       (expand_expr, case BIT_FIELD_REF): likewise.
 
 2003-04-16  Mark Mitchell  <mark@codesourcery.com>
 
@@ -673,9 +702,9 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
 
 2003-04-16  Aldy Hernandez  <aldyh@redhat.com>
 
-        * config.gcc: Add t-spe for eabispe.
+       * config.gcc: Add t-spe for eabispe.
 
-        * config/rs6000/t-spe: New.
+       * config/rs6000/t-spe: New.
 
 2003-04-16  J"orn Rennecke <joern.rennecke@superh.com>
 
@@ -690,7 +719,7 @@ Fri Apr 18 01:28:51 CEST 2003  Jan Hubicka  <jh@suse.cz>
        PR/10271
        * pa-protos.h (function_arg): Remove last argument.
        * pa.c (function_arg): Likewise.  Use CUMULATIVE_ARGS struct instead.
-       * pa.h (struct hppa_args): Add member incoming. 
+       * pa.h (struct hppa_args): Add member incoming.
        (INIT_CUMULATIVE_ARGS, INIT_CUMULATIVE_INCOMING_ARGS): Initialize
        member incoming.
        (FUNCTION_ARG): Revise call to function_arg.
index bfc2c0faaef755ab674ab293a65f40a027e1a01e..1defdf04728c5fc375c339266f0726dd962bd1fe 100644 (file)
@@ -206,7 +206,7 @@ extern int  arm_dllimport_name_p    PARAMS ((const char *));
 
 #ifdef TREE_CODE
 extern void arm_pe_unique_section      PARAMS ((tree, int));
-extern void arm_pe_encode_section_info         PARAMS ((tree, int));
+extern void arm_pe_encode_section_info         PARAMS ((tree, rtx, int));
 extern int  arm_dllexport_p            PARAMS ((tree));
 extern int  arm_dllimport_p            PARAMS ((tree));
 extern void arm_mark_dllexport                 PARAMS ((tree));
index 216e5a270c878502cc0a16b10241f2a8a1011d42..09a71c13b4e6f9657a5a566084877e58d8d744f7 100644 (file)
@@ -142,7 +142,7 @@ static void      cirrus_reorg                   PARAMS ((rtx));
 static void     arm_elf_asm_named_section      PARAMS ((Ccstar, unsigned int));
 #endif
 #ifndef ARM_PE
-static void     arm_encode_section_info        PARAMS ((tree, int));
+static void     arm_encode_section_info        PARAMS ((tree, rtx, int));
 #endif
 #ifdef AOF_ASSEMBLER
 static void     aof_globalize_label            PARAMS ((FILE *, Ccstar));
@@ -12152,8 +12152,9 @@ arm_elf_asm_named_section (name, flags)
    simplification.  */
 
 static void
-arm_encode_section_info (decl, first)
+arm_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   /* This doesn't work with AOF syntax, since the string table may be in
@@ -12161,11 +12162,7 @@ arm_encode_section_info (decl, first)
 #ifndef AOF_ASSEMBLER
   if (optimize > 0 && TREE_CONSTANT (decl)
       && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST))
-    {
-      rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'
-                 ? TREE_CST_RTL (decl) : DECL_RTL (decl));
-      SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-    }
+    SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 #endif
 
   /* If we are referencing a function that is weak then encode a long call
index 310e79f962b1752885c796ab9f8dbb899cd5d931..1413eeeb51d5335fe37c1db6a5d1d34f240a7588 100644 (file)
@@ -207,18 +207,15 @@ arm_mark_dllimport (decl)
 }
 
 void
-arm_pe_encode_section_info (decl, first)
+arm_pe_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
   /* This bit is copied from arm_encode_section_info.  */
   if (optimize > 0 && TREE_CONSTANT (decl)
       && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST))
-    {
-      rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'
-                 ? TREE_CST_RTL (decl) : DECL_RTL (decl));
-      SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-    }
+    SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 
   /* Mark the decl so we can tell from the rtl whether the object is
      dllexport'd or dllimport'd.  */
index d199854a633f42e9793bf5786813f32f9557eba3..518bea83c69b438f71d18d7dcddc8541928196c9 100644 (file)
@@ -58,7 +58,7 @@ extern void machopic_define_ident PARAMS ((tree));
 extern void machopic_define_name PARAMS ((const char*));
 extern int machopic_name_defined_p PARAMS ((const char*));
 extern int machopic_ident_defined_p PARAMS ((tree));
-extern void darwin_encode_section_info PARAMS ((tree, int));
+extern void darwin_encode_section_info PARAMS ((tree, rtx, int));
 extern const char *darwin_strip_name_encoding PARAMS ((const char *));
 
 #endif /* TREE_CODE */
index 934d99725bfd675fe2088989192a95f499f08b86..8f7599f0f91e783a904a3dbce31c3e5b8f0253a0 100644 (file)
@@ -974,8 +974,9 @@ machopic_operand_p (op)
    use later.  */
 
 void
-darwin_encode_section_info (decl, first)
+darwin_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
   char code = '\0';
@@ -1002,7 +1003,7 @@ darwin_encode_section_info (decl, first)
   if (code == '\0')
     return;
 
-  sym_ref = XEXP (DECL_RTL (decl), 0);
+  sym_ref = XEXP (rtl, 0);
   orig_str = XSTR (sym_ref, 0);
   len = strlen (orig_str) + 1;
 
index 8826a7dfa0bc335e37b3998f60e70da05d45bee0..314235109e7ec762c9f4ddf1d1a9ee4ea96e30cb 100644 (file)
@@ -379,7 +379,7 @@ do { text_section ();                                                       \
     if ((TREE_STATIC (DECL)                                             \
         && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
         || DECL_INITIAL (DECL))                                         \
-      (* targetm.encode_section_info) (DECL, false);                   \
+      (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false);  \
     ASM_OUTPUT_LABEL (FILE, xname);                                     \
   } while (0)
 
@@ -395,7 +395,7 @@ do { text_section ();                                                       \
     if ((TREE_STATIC (DECL)                                             \
         && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
         || DECL_INITIAL (DECL))                                         \
-      (* targetm.encode_section_info) (DECL, false);                   \
+      (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false);  \
     ASM_OUTPUT_LABEL (FILE, xname);                                     \
     /* Avoid generating stubs for functions we've just defined by      \
        outputting any required stub name label now.  */                        \
@@ -459,7 +459,7 @@ do { text_section ();                                                       \
     if ((DECL) && ((TREE_STATIC (DECL)                                 \
         && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
         || DECL_INITIAL (DECL)))                                       \
-      (* targetm.encode_section_info) (DECL, false);                   \
+      (* targetm.encode_section_info) (DECL, DECL_RTL (DECL), false);  \
     if ((DECL) && ((TREE_STATIC (DECL)                                 \
         && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL)))               \
         || DECL_INITIAL (DECL)))                                       \
index b4e7a33e9bc0ef983f8738083d29d50b42d1cd4d..53b4b51059bd9b72064eaabf6aa9cf865883209c 100644 (file)
@@ -66,7 +66,7 @@ static void h8300_insert_attributes PARAMS ((tree, tree *));
 #ifndef OBJECT_FORMAT_ELF
 static void h8300_asm_named_section PARAMS ((const char *, unsigned int));
 #endif
-static void h8300_encode_section_info PARAMS ((tree, int));
+static void h8300_encode_section_info PARAMS ((tree, rtx, int));
 static int const_costs PARAMS ((rtx, enum rtx_code, enum rtx_code));
 static int h8300_and_costs PARAMS ((rtx));
 static int h8300_shift_costs PARAMS ((rtx));
@@ -4171,13 +4171,14 @@ h8300_handle_tiny_data_attribute (node, name, args, flags, no_add_attrs)
 /* Mark function vectors, and various small data objects.  */
 
 static void
-h8300_encode_section_info (decl, first)
+h8300_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   int extra_flags = 0;
 
-  default_encode_section_info (decl, first);
+  default_encode_section_info (decl, rtl, first);
 
   if (TREE_CODE (decl) == FUNCTION_DECL
       && h8300_funcvec_function_p (decl))
@@ -4192,7 +4193,7 @@ h8300_encode_section_info (decl, first)
     }
 
   if (extra_flags)
-    SYMBOL_REF_FLAGS (XEXP (DECL_RTL (decl), 0)) |= extra_flags;
+    SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= extra_flags;
 }
 
 const char *
index beafa792cc7c1ee0ab2557e7de3f11890cec4779..6dd0a94d3f1a1063a03277588e6be64929d3d342 100644 (file)
@@ -236,7 +236,7 @@ extern void i386_pe_declare_function_type PARAMS ((FILE *, const char *, int));
 extern void i386_pe_record_external_function PARAMS ((const char *));
 extern void i386_pe_record_exported_symbol PARAMS ((const char *, int));
 extern void i386_pe_asm_file_end PARAMS ((FILE *));
-extern void i386_pe_encode_section_info PARAMS ((tree, int));
+extern void i386_pe_encode_section_info PARAMS ((tree, rtx, int));
 extern const char *i386_pe_strip_name_encoding PARAMS ((const char *));
 extern const char *i386_pe_strip_name_encoding_full PARAMS ((const char *));
 extern void i386_pe_output_labelref PARAMS ((FILE *, const char *));
index 98e579220578a1c9e6a7925ff2e123de4fb342f5..ee3448da339d2e69ab3da163c1332f559ab4e913 100644 (file)
@@ -420,14 +420,15 @@ gen_stdcall_suffix (decl)
 }
 
 void
-i386_pe_encode_section_info (decl, first)
+i386_pe_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   if (!first)
     return;
 
-  default_encode_section_info (decl, first);
+  default_encode_section_info (decl, rtl, first);
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
index 0170f4d54e8d39f5183ad1b89c80d1c84cdf9270..a4e2ea2ba653b3b8151cbfa2103f0d1c3dd8a38f 100644 (file)
@@ -84,7 +84,7 @@ static int    m32r_sched_reorder   PARAMS ((FILE *, int, rtx *, int *, int));
 static int    m32r_variable_issue  PARAMS ((FILE *, int, rtx, int));
 static int    m32r_issue_rate     PARAMS ((void));
 
-static void m32r_encode_section_info PARAMS ((tree, int));
+static void m32r_encode_section_info PARAMS ((tree, rtx, int));
 static bool m32r_in_small_data_p PARAMS ((tree));
 static void init_idents PARAMS ((void));
 static bool m32r_rtx_costs PARAMS ((rtx, int, int, int *));
@@ -349,15 +349,16 @@ m32r_handle_model_attribute (node, name, args, flags, no_add_attrs)
 */
 
 static void
-m32r_encode_section_info (decl, first)
+m32r_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   int extra_flags = 0;
   tree model_attr;
   enum m32r_model model;
 
-  default_encode_section_info (decl, first);
+  default_encode_section_info (decl, rtl, first);
 
   if (!DECL_P (decl))
     return;
@@ -394,7 +395,7 @@ m32r_encode_section_info (decl, first)
   extra_flags |= model << SYMBOL_FLAG_MODEL_SHIFT;
 
   if (extra_flags)
-    SYMBOL_REF_FLAGS (XEXP (DECL_RTL (decl), 0)) |= extra_flags;
+    SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= extra_flags;
 }
 
 /* Only mark the object as being small data area addressable if
index abada3cc2848d7887b545da74742272745bbf0b8..1a129d1c43dd7329345759393cb9c6477be98b88 100644 (file)
@@ -81,7 +81,7 @@ static void asm_print_register PARAMS ((FILE *, int));
 static void m68hc11_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void m68hc11_asm_out_constructor PARAMS ((rtx, int));
 static void m68hc11_asm_out_destructor PARAMS ((rtx, int));
-static void m68hc11_encode_section_info PARAMS((tree, int));
+static void m68hc11_encode_section_info PARAMS((tree, rtx, int));
 static int autoinc_mode PARAMS((rtx));
 static int m68hc11_make_autoinc_notes PARAMS((rtx *, void *));
 
@@ -1287,20 +1287,18 @@ m68hc11_handle_fntype_attribute (node, name, args, flags, no_add_attrs)
    in SYMBOL_REF_FLAG.  */
 
 static void
-m68hc11_encode_section_info (decl, first)
+m68hc11_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
   tree func_attr;
   int trap_handler;
   int is_far = 0;
-  rtx rtl;
   
   if (TREE_CODE (decl) != FUNCTION_DECL)
     return;
 
-  rtl = DECL_RTL (decl);
-
   func_attr = TYPE_ATTRIBUTES (TREE_TYPE (decl));
 
 
index 441b6f44ab63dc0103382943e1c89a0f380d5ec7..33818a9095e6e34c1252b1bd5c9e8059b11d9ac8 100644 (file)
@@ -75,7 +75,7 @@ static void m88k_svr3_asm_out_destructor PARAMS ((rtx, int));
 #endif
 static void m88k_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT));
 static int m88k_adjust_cost PARAMS ((rtx, rtx, rtx, int));
-static void m88k_encode_section_info PARAMS ((tree, int));
+static void m88k_encode_section_info PARAMS ((tree, rtx, int));
 #ifdef AS_BUG_DOT_LABELS
 static void m88k_internal_label PARAMS ((FILE *, const char *, unsigned long));
 #endif
@@ -3335,8 +3335,9 @@ m88k_adjust_cost (insn, link, dep, cost)
 /* For the m88k, determine if the item should go in the global pool.  */
 
 static void
-m88k_encode_section_info (decl, first)
+m88k_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
   if (m88k_gp_threshold > 0)
@@ -3348,13 +3349,13 @@ m88k_encode_section_info (decl, first)
              int size = int_size_in_bytes (TREE_TYPE (decl));
 
              if (size > 0 && size <= m88k_gp_threshold)
-               SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+               SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
            }
        }
       else if (TREE_CODE (decl) == STRING_CST
               && flag_writable_strings
               && TREE_STRING_LENGTH (decl) <= m88k_gp_threshold)
-       SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (decl), 0)) = 1;
+       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
     }
 }
 
index e437f381bd69479c995e1f6e40dc6d4d1d279ac2..a7c2d379c632b3a0833afbc614a1953102997591 100644 (file)
@@ -139,7 +139,7 @@ static void   mcore_asm_named_section      PARAMS ((const char *,
                                                        unsigned int));
 #endif
 static void       mcore_unique_section        PARAMS ((tree, int));
-static void mcore_encode_section_info          PARAMS ((tree, int));
+static void mcore_encode_section_info          PARAMS ((tree, rtx, int));
 static const char *mcore_strip_name_encoding   PARAMS ((const char *));
 static int        mcore_const_costs                    PARAMS ((rtx, RTX_CODE));
 static int        mcore_and_cost                       PARAMS ((rtx));
@@ -3464,8 +3464,9 @@ mcore_dllimport_p (decl)
    install some info in the .drective (PE) or .exports (ELF) sections.   */
 
 static void
-mcore_encode_section_info (decl, first)
+mcore_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl ATTRIBUTE_UNUSED;
      int first ATTRIBUTE_UNUSED;
 {
   /* Mark the decl so we can tell from the rtl whether the object is
index 5ef92f03651d194c8de2012dc33cc9041a307828..0c4238ecf94ba54d961b0f65e6e69af6348fd697 100644 (file)
@@ -154,7 +154,7 @@ static void mips_unique_section                     PARAMS ((tree, int))
 static void mips_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                             unsigned HOST_WIDE_INT));
 static int mips_use_dfa_pipeline_interface      PARAMS ((void));
-static void mips_encode_section_info           PARAMS ((tree, int));
+static void mips_encode_section_info           PARAMS ((tree, rtx, int));
 static bool mips_rtx_costs                     PARAMS ((rtx, int, int, int *));
 static int mips_address_cost                   PARAMS ((rtx));
 
@@ -8521,8 +8521,9 @@ mips_select_section (decl, reloc, align)
    is why the DECL_INITIAL macros differ from mips_select_section.  */
 
 static void
-mips_encode_section_info (decl, first)
+mips_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   if (TARGET_MIPS16)
@@ -8545,7 +8546,7 @@ mips_encode_section_info (decl, first)
        {
          rtx symref;
 
-         symref = XEXP (TREE_CST_RTL (decl), 0);
+         symref = XEXP (rtl, 0);
          mips16_strings = alloc_EXPR_LIST (0, symref, mips16_strings);
          SYMBOL_REF_FLAG (symref) = 1;
          mips_string_length += TREE_STRING_LENGTH (decl);
@@ -8558,20 +8559,20 @@ mips_encode_section_info (decl, first)
       && (!DECL_INITIAL (decl)
          || TREE_CONSTANT (DECL_INITIAL (decl))))
     {
-      SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 0;
+      SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 0;
     }
 
   else if (TARGET_EMBEDDED_PIC)
     {
       if (TREE_CODE (decl) == VAR_DECL)
-       SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
       else if (TREE_CODE (decl) == FUNCTION_DECL)
-       SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 0;
+       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 0;
       else if (TREE_CODE (decl) == STRING_CST
               && ! flag_writable_strings)
-       SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (decl), 0)) = 0;
+       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 0;
       else
-       SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (decl), 0)) = 1;
+       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
     }
 
   else if (TREE_CODE (decl) == VAR_DECL
@@ -8581,7 +8582,7 @@ mips_encode_section_info (decl, first)
               || 0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)),
                               ".sbss")))
     {
-      SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+      SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
     }
 
   /* We can not perform GP optimizations on variables which are in
@@ -8597,7 +8598,7 @@ mips_encode_section_info (decl, first)
       int size = int_size_in_bytes (TREE_TYPE (decl));
 
       if (size > 0 && size <= mips_section_threshold)
-       SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
     }
 
 }
index 0eb36ae07d4d46ca735d9292af4c1ca14c1cf90a..7ce6bc0ca170e6056616633d5ea1c2502aef84a5 100644 (file)
@@ -124,7 +124,7 @@ static HOST_WIDEST_INT mmix_intval PARAMS ((rtx));
 static void mmix_output_octa PARAMS ((FILE *, HOST_WIDEST_INT, int));
 static bool mmix_assemble_integer PARAMS ((rtx, unsigned int, int));
 static struct machine_function * mmix_init_machine_status PARAMS ((void));
-static void mmix_encode_section_info PARAMS ((tree, int));
+static void mmix_encode_section_info PARAMS ((tree, rtx, int));
 static const char *mmix_strip_name_encoding PARAMS ((const char *));
 static void mmix_emit_sp_add PARAMS ((HOST_WIDE_INT offset));
 static void mmix_target_asm_function_prologue
@@ -1235,8 +1235,9 @@ mmix_data_section_asm_op ()
 }
 
 static void
-mmix_encode_section_info (decl, first)
+mmix_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   /* Test for an external declaration, and do nothing if it is one.  */
@@ -1256,7 +1257,7 @@ mmix_encode_section_info (decl, first)
         means that when -mtoplevel-symbols is in use, we can just handle
         well-behaved ISO-compliant code.  */
 
-      const char *str = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+      const char *str = XSTR (XEXP (rtl, 0), 0);
       int len = strlen (str);
       char *newstr;
 
@@ -1265,7 +1266,7 @@ mmix_encode_section_info (decl, first)
 
       strcpy (newstr + 1, str);
       *newstr = '@';
-      XSTR (XEXP (DECL_RTL (decl), 0), 0) = newstr;
+      XSTR (XEXP (rtl, 0), 0) = newstr;
     }
 
   /* Set SYMBOL_REF_FLAG for things that we want to access with GETA.  We
@@ -1278,11 +1279,7 @@ mmix_encode_section_info (decl, first)
          && !TREE_SIDE_EFFECTS (decl)
          && (!DECL_INITIAL (decl)
              || TREE_CONSTANT (DECL_INITIAL (decl)))))
-    {
-      rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'
-                 ? TREE_CST_RTL (decl) : DECL_RTL (decl));
-      SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-    }
+    SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 }
 
 static const char *
index 3e46ffba481e924fe91f99cf573b050acbf88e3f..601024a44a9fc0f3dcc16fa768d0c1bcbde551e5 100644 (file)
@@ -119,7 +119,7 @@ static int pa_adjust_priority PARAMS ((rtx, int));
 static int pa_issue_rate PARAMS ((void));
 static void pa_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT))
      ATTRIBUTE_UNUSED;
-static void pa_encode_section_info PARAMS ((tree, int));
+static void pa_encode_section_info PARAMS ((tree, rtx, int));
 static const char *pa_strip_name_encoding PARAMS ((const char *));
 static bool pa_function_ok_for_sibcall PARAMS ((tree, tree));
 static void pa_globalize_label PARAMS ((FILE *, const char *))
@@ -7114,21 +7114,16 @@ hppa_encode_label (sym)
 }
 
 static void
-pa_encode_section_info (decl, first)
+pa_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   if (first && TEXT_SPACE_P (decl))
     {
-      rtx rtl;
-      if (TREE_CODE (decl) == FUNCTION_DECL
-         || TREE_CODE (decl) == VAR_DECL)
-       rtl = DECL_RTL (decl);
-      else
-       rtl = TREE_CST_RTL (decl);
       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
       if (TREE_CODE (decl) == FUNCTION_DECL)
-       hppa_encode_label (XEXP (DECL_RTL (decl), 0));
+       hppa_encode_label (XEXP (rtl, 0));
     }
 }
 
index 0811ee81f46df1d50833c758b7cfc32d10e855f6..ab4430279b33ce1aba352a20600230a65f8c39e4 100644 (file)
@@ -58,7 +58,7 @@ static void romp_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void romp_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void romp_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                             unsigned HOST_WIDE_INT));
-static void romp_encode_section_info PARAMS ((tree, int));
+static void romp_encode_section_info PARAMS ((tree, rtx, int));
 static bool romp_rtx_costs PARAMS ((rtx, int, int, int *));
 static int romp_address_cost PARAMS ((rtx));
 \f
@@ -2098,12 +2098,13 @@ romp_select_rtx_section (mode, x, align)
    that we need to mark such SYMBOL_REFs.  We do so here.  */
 
 static void
-romp_encode_section_info (decl, first)
+romp_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
   if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE)
-    SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+    SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 }
 
 static bool
index 242b48026227394e7ed4b421cc11f37f2b686513..bd2f9e6227ea86f1a72cfec3c6120ed2c7d09754 100644 (file)
@@ -229,7 +229,7 @@ static void rs6000_elf_select_section PARAMS ((tree, int,
 static void rs6000_elf_unique_section PARAMS ((tree, int));
 static void rs6000_elf_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                   unsigned HOST_WIDE_INT));
-static void rs6000_elf_encode_section_info PARAMS ((tree, int))
+static void rs6000_elf_encode_section_info PARAMS ((tree, rtx, int))
      ATTRIBUTE_UNUSED;
 static const char *rs6000_elf_strip_name_encoding PARAMS ((const char *));
 static bool rs6000_elf_in_small_data_p PARAMS ((tree));
@@ -244,7 +244,7 @@ static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                     unsigned HOST_WIDE_INT));
 static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *));
 static unsigned int rs6000_xcoff_section_type_flags PARAMS ((tree, const char *, int));
-static void rs6000_xcoff_encode_section_info PARAMS ((tree, int))
+static void rs6000_xcoff_encode_section_info PARAMS ((tree, rtx, int))
      ATTRIBUTE_UNUSED;
 #endif
 #if TARGET_MACHO
@@ -12935,8 +12935,9 @@ rs6000_elf_unique_section (decl, reloc)
    to read the prefixes.  */
 
 static void
-rs6000_elf_encode_section_info (decl, first)
+rs6000_elf_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
   if (!first)
@@ -12944,7 +12945,7 @@ rs6000_elf_encode_section_info (decl, first)
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {
-      rtx sym_ref = XEXP (DECL_RTL (decl), 0);
+      rtx sym_ref = XEXP (rtl, 0);
       if ((*targetm.binds_local_p) (decl))
        SYMBOL_REF_FLAG (sym_ref) = 1;
 
@@ -12964,7 +12965,7 @@ rs6000_elf_encode_section_info (decl, first)
           && DEFAULT_ABI == ABI_V4
           && TREE_CODE (decl) == VAR_DECL)
     {
-      rtx sym_ref = XEXP (DECL_RTL (decl), 0);
+      rtx sym_ref = XEXP (rtl, 0);
       int size = int_size_in_bytes (TREE_TYPE (decl));
       tree section_name = DECL_SECTION_NAME (decl);
       const char *name = (char *)0;
@@ -13628,13 +13629,14 @@ rs6000_xcoff_section_type_flags (decl, name, reloc)
 }
 
 static void
-rs6000_xcoff_encode_section_info (decl, first)
+rs6000_xcoff_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
   if (TREE_CODE (decl) == FUNCTION_DECL
       && (*targetm.binds_local_p) (decl))
-    SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1;
+    SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
 }
 #endif /* TARGET_XCOFF */
 
index 18a7bcceb7e971ec9a516778d2bb49845cc90eb0..38c630db48c0f0651e2924e730c897234d740226 100644 (file)
@@ -57,7 +57,7 @@ Boston, MA 02111-1307, USA.  */
 static bool s390_assemble_integer PARAMS ((rtx, unsigned int, int));
 static void s390_select_rtx_section PARAMS ((enum machine_mode, rtx, 
                                             unsigned HOST_WIDE_INT));
-static void s390_encode_section_info PARAMS ((tree, int));
+static void s390_encode_section_info PARAMS ((tree, rtx, int));
 static bool s390_cannot_force_const_mem PARAMS ((rtx));
 static rtx s390_delegitimize_address PARAMS ((rtx));
 static void s390_init_builtins PARAMS ((void));
@@ -6406,17 +6406,18 @@ s390_select_rtx_section (mode, x, align)
    into its SYMBOL_REF_FLAGS.  */
 
 static void
-s390_encode_section_info (decl, first)
+s390_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
-  default_encode_section_info (decl, first);
+  default_encode_section_info (decl, rtl, first);
 
   /* If a variable has a forced alignment to < 2 bytes, mark it with
      SYMBOL_FLAG_ALIGN1 to prevent it from being used as LARL operand.  */
   if (TREE_CODE (decl) == VAR_DECL 
       && DECL_USER_ALIGN (decl) && DECL_ALIGN (decl) < 16)
-    SYMBOL_REF_FLAGS (XEXP (DECL_RTL (decl), 0)) |= SYMBOL_FLAG_ALIGN1;
+    SYMBOL_REF_FLAGS (XEXP (rtl, 0)) |= SYMBOL_FLAG_ALIGN1;
 }
 
 /* Output thunk to FILE that implements a C++ virtual function call (with
index b3cd34e5ac42e2f9e87d9b0b734db7d0524923d6..618af25238999f00c8e94f50435a57760a9bdbbc 100644 (file)
@@ -61,8 +61,8 @@ static tree v850_handle_interrupt_attribute PARAMS ((tree *, tree, tree, int, bo
 static tree v850_handle_data_area_attribute PARAMS ((tree *, tree, tree, int, bool *));
 static void v850_insert_attributes   PARAMS ((tree, tree *));
 static void v850_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT));
-static void v850_encode_data_area    PARAMS ((tree));
-static void v850_encode_section_info PARAMS ((tree, int));
+static void v850_encode_data_area    PARAMS ((tree, rtx));
+static void v850_encode_section_info PARAMS ((tree, rtx, int));
 
 /* Information about the various small memory areas.  */
 struct small_memory_info small_memory[ (int)SMALL_MEMORY_max ] =
@@ -2324,11 +2324,11 @@ v850_interrupt_function_p (func)
 
 \f
 static void
-v850_encode_data_area (decl)
+v850_encode_data_area (decl, symbol)
      tree decl;
+     rtx symbol;
 {
   int flags;
-  rtx symbol;
 
   /* Map explict sections into the appropriate attribute */
   if (v850_get_data_area (decl) == DATA_AREA_NORMAL)
@@ -2368,7 +2368,6 @@ v850_encode_data_area (decl)
        return;
     }
 
-  symbol = XEXP (DECL_RTL (decl), 0);
   flags = SYMBOL_REF_FLAGS (symbol);
   switch (v850_get_data_area (decl))
     {
@@ -2381,15 +2380,16 @@ v850_encode_data_area (decl)
 }
 
 static void
-v850_encode_section_info (decl, first)
+v850_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first;
 {
-  default_encode_section_info (decl, first);
+  default_encode_section_info (decl, rtl, first);
 
   if (TREE_CODE (decl) == VAR_DECL
       && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
-    v850_encode_data_area (decl);
+    v850_encode_data_area (decl, XEXP (rtl, 0));
 }
 
 /* Return true if the given RTX is a register which can be restored
index b824b1e7bfc4374cc539adf4d0071bcf440ec9e4..092e400dcec14bf537364d89f46b8116ef3fa880 100644 (file)
@@ -6047,30 +6047,43 @@ constants in @code{flag_pic} mode in @code{data_section} and everything
 else in @code{readonly_data_section}.
 @end deftypefn
 
-@deftypefn {Target Hook} void TARGET_ENCODE_SECTION_INFO (tree @var{decl}, int @var{new_decl_p})
+@deftypefn {Target Hook} void TARGET_ENCODE_SECTION_INFO (tree @var{decl}, rtx @var{rtl}, int @var{new_decl_p})
 Define this hook if references to a symbol or a constant must be
 treated differently depending on something about the variable or
 function named by the symbol (such as what section it is in).
 
-The hook is executed under two circumstances.  One is immediately after
-the rtl for @var{decl} that represents a variable or a function has been
-created and stored in @code{DECL_RTL(@var{decl})}.  The value of the rtl
-will be a @code{mem} whose address is a @code{symbol_ref}.  The other is
-immediately after the rtl for @var{decl} that represents a constant has
-been created and stored in @code{TREE_CST_RTL (@var{decl})}.  The macro
-is called once for each distinct constant in a source file.
+The hook is executed immediately after rtl has been created for
+@var{decl}, which may be a variable or function declaration or
+an entry in the constant pool.  In either case, @var{rtl} is the
+rtl in question.  Do @emph{not} use @code{DECL_RTL (@var{decl})}
+or @code{TREE_CST_RTL (@var{decl})} in this hook; that field may
+not have been initialized yet.
+
+In the case of a constant, it is safe to assume that the rtl is
+a @code{mem} whose address is a @code{symbol_ref}.  Most decls
+will also have this form, but that is not guaranteed.  Global
+register variables, for instance, will have a @code{reg} for their
+rtl.  (Normally the right thing to do with such unusual rtl is
+leave it alone.)
 
 The @var{new_decl_p} argument will be true if this is the first time
-that @code{ENCODE_SECTION_INFO} has been invoked on this decl.  It will
+that @code{TARGET_ENCODE_SECTION_INFO} has been invoked on this decl.  It will
 be false for subsequent invocations, which will happen for duplicate
 declarations.  Whether or not anything must be done for the duplicate
 declaration depends on whether the hook examines @code{DECL_ATTRIBUTES}.
+@var{new_decl_p} is always true when the hook is called for a constant.
 
 @cindex @code{SYMBOL_REF_FLAG}, in @code{TARGET_ENCODE_SECTION_INFO}
-The usual thing for this hook to do is to record a flag in the
-@code{symbol_ref} (such as @code{SYMBOL_REF_FLAG}) or to store a
-modified name string in the @code{symbol_ref} (if one bit is not
-enough information).
+The usual thing for this hook to do is to record flags in the
+@code{symbol_ref}, using @code{SYMBOL_REF_FLAG} or @code{SYMBOL_REF_FLAGS}.
+Historically, the name string was modified if it was necessary to
+encode more than one bit of information, but this practice is now
+discouraged; use @code{SYMBOL_REF_FLAGS}.
+
+The default definition of this hook, @code{default_encode_section_info}
+in @file{varasm.c}, sets a number of commonly-useful bits in
+@code{SYMBOL_REF_FLAGS}.  Check whether the default does what you need
+before overriding it.
 @end deftypefn
 
 @deftypefn {Target Hook} const char *TARGET_STRIP_NAME_ENCODING (const char *name)
index 5f70c7a748e47d5f703d67f1faedd2359bb0b5da..7fd9ec9cfe6d26c88825b30eddf2ca73e048ab13 100644 (file)
@@ -519,7 +519,7 @@ extern void default_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                unsigned HOST_WIDE_INT));
 extern void default_elf_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                    unsigned HOST_WIDE_INT));
-extern void default_encode_section_info PARAMS ((tree, int));
+extern void default_encode_section_info PARAMS ((tree, rtx, int));
 extern const char *default_strip_name_encoding PARAMS ((const char *));
 extern bool default_binds_local_p PARAMS ((tree));
 extern bool default_binds_local_p_1 PARAMS ((tree, int));
index 22558e9f7788c66d05910e0f486411c8e63982ea..8207b3216efd67e34620f8609601744551547c65 100644 (file)
@@ -312,7 +312,7 @@ struct gcc_target
 
   /* Do something target-specific to record properties of the DECL into
      the associated SYMBOL_REF.  */
-  void (* encode_section_info) PARAMS ((tree, int));
+  void (* encode_section_info) PARAMS ((tree, rtx, int));
 
   /* Undo the effects of encode_section_info on the symbol string.  */
   const char * (* strip_name_encoding) PARAMS ((const char *));
index a5174501b684aa71b728703adc01d4378194d72e..72141f16403255cda89dc7a5fb3efca50a5342c7 100644 (file)
@@ -809,7 +809,7 @@ make_decl_rtl (decl, asmspec)
       /* Let the target reassign the RTL if it wants.
         This is necessary, for example, when one machine specific
         decl attribute overrides another.  */
-      (* targetm.encode_section_info) (decl, false);
+      (* targetm.encode_section_info) (decl, DECL_RTL (decl), false);
       return;
     }
 
@@ -932,7 +932,7 @@ make_decl_rtl (decl, asmspec)
      such as that it is a function name.
      If the name is changed, the macro ASM_OUTPUT_LABELREF
      will have to know how to strip this information.  */
-  (* targetm.encode_section_info) (decl, true);
+  (* targetm.encode_section_info) (decl, DECL_RTL (decl), true);
 }
 
 /* Make the rtl for variable VAR be volatile.
@@ -2674,10 +2674,7 @@ output_constant_def (exp, defer)
      encoded in it.  */
   if (! found)
     {
-      /* Take care not to invoke targetm.encode_section_info for
-        constants which don't have a TREE_CST_RTL.  */
-      if (TREE_CODE (exp) != INTEGER_CST)
-       (*targetm.encode_section_info) (exp, true);
+      (*targetm.encode_section_info) (exp, rtl, true);
 
       desc->rtl = rtl;
       desc->label = XSTR (XEXP (desc->rtl, 0), 0);
@@ -5346,15 +5343,14 @@ default_elf_select_rtx_section (mode, x, align)
 /* Set the generally applicable flags on the SYMBOL_REF for EXP.  */
 
 void
-default_encode_section_info (decl, first)
+default_encode_section_info (decl, rtl, first)
      tree decl;
+     rtx rtl;
      int first ATTRIBUTE_UNUSED;
 {
-  rtx rtl, symbol;
+  rtx symbol;
   int flags;
 
-  rtl = DECL_P (decl) ? DECL_RTL (decl) : TREE_CST_RTL (decl);
-
   /* Careful not to prod global register variables.  */
   if (GET_CODE (rtl) != MEM)
     return;