From 7811991d015679f79068872ce32cab8b31907713 Mon Sep 17 00:00:00 2001 From: rth Date: Sun, 19 May 2002 05:23:27 +0000 Subject: [PATCH] * system.h (ENCODE_SECTION_INFO): Poison it. * target-def.h (TARGET_ENCODE_SECTION_INFO): New. * target.h (encode_section_info): New. * varasm.c (make_decl_rtl, output_constant_def): Use it. * hooks.c (hook_tree_int_void): New. * hooks.h: Declare it. * config/darwin.h, config/alpha/alpha-protos.h, config/alpha/alpha.c, config/alpha/alpha.h, config/arm/pe.h, config/avr/avr-protos.h, config/avr/avr.c, config/avr/avr.h, config/c4x/c4x-protos.h, config/c4x/c4x.c, config/c4x/c4x.h, config/cris/cris-protos.h, config/cris/cris.c, config/cris/cris.h, config/i386/cygwin.h, config/i386/win32.h, config/ia64/ia64-protos.h, config/ia64/ia64.c, config/ia64/ia64.h, config/m32r/m32r-protos.h, config/m32r/m32r.c, config/m32r/m32r.h, config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c, config/m68hc11/m68hc11.h, config/mcore/mcore-protos.h, config/mcore/mcore.c, config/mcore/mcore.h, config/mmix/mmix-protos.h, config/mmix/mmix.c, config/mmix/mmix.h, config/rs6000/rs6000-protos.h, config/rs6000/sysv4.h, config/stormy16/stormy16-protos.h, config/stormy16/stormy16.c, config/stormy16/stormy16.h: Replace ENCODE_SECTION_INFO with TARGET_ENCODE_SECTION_INFO referencing existing function. Make function static. * config/a29k/a29k.c, config/a29k/a29k.h, config/arc/arc.c, config/arc/arc.h, config/arm/arm.c, config/arm/arm.h, config/h8300/h8300.c, config/h8300/h8300.h, config/i370/i370.c, config/i370/i370.h, config/i386/i386-interix.h, config/i386/i386.c, config/i386/i386.h, config/i386/interix.c, config/m88k/m88k.c, config/m88k/m88k.h, config/mips/mips.c, config/mips/mips.h, config/ns32k/ns32k.c, config/ns32k/ns32k.h, config/pa/pa.c, config/pa/pa.h, config/romp/romp.c, config/romp/romp.h, config/rs6000/linux64.h, config/rs6000/xcoff.h, config/s390/s390.c, config/s390/s390.h, config/sh/sh.c, config/sh/sh.h, config/sparc/sparc.c, config/sparc/sparc.h, config/v850/v850.c, config/v850/v850.h, config/vax/vax.c, config/vax/vms.h, config/xtensa/xtensa.c, config/xtensa/xtensa.h: Move ENCODE_SECTION_INFO to out-of-line function and add TARGET_ENCODE_SECTION_INFO. * config/darwin.h (ASM_DECLARE_FUNCTION_NAME): Use hook, not macro. (ASM_DECLARE_OBJECT_NAME, ASM_OUTPUT_ALIGNED_DECL_LOCAL): Likewise. * config/arm/pe.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Rename from SUBTARGET_* (switch_to_section): Replace in_rdata case with in_readonly_data. * config/h8300/h8300.c (h8300_encode_label): Make static. * config/h8300/h8300-protos.h: Update. * config/rs6000/rs6000.c (rs6000_elf_encode_section_info): Rename from rs6000_encode_section_info; make static. (rs6000_xcoff_encode_section_info): New. * config/v850/v850.c (v850_encode_data_area): Make static. * config/v850/v850-protos.h: Update. * config/vax/vax.c: Include flags.h. (vms_select_section): Fix typo. * doc/tm.texi (TARGET_ENCODE_SECTION_INFO): Update from previous ENCODE_SECTION_INFO docs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53606 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 65 ++++++++++++ gcc/config/a29k/a29k.c | 18 ++++ gcc/config/a29k/a29k.h | 10 -- gcc/config/alpha/alpha-protos.h | 1 - gcc/config/alpha/alpha.c | 8 +- gcc/config/alpha/alpha.h | 7 -- gcc/config/arc/arc.c | 17 +++ gcc/config/arc/arc.h | 36 +------ gcc/config/arm/arm.c | 47 +++++++++ gcc/config/arm/arm.h | 41 -------- gcc/config/arm/pe.c | 4 +- gcc/config/arm/pe.h | 21 +--- gcc/config/avr/avr-protos.h | 1 - gcc/config/avr/avr.c | 9 +- gcc/config/avr/avr.h | 85 +-------------- gcc/config/c4x/c4x-protos.h | 2 - gcc/config/c4x/c4x.c | 7 +- gcc/config/c4x/c4x.h | 19 ---- gcc/config/cris/cris-protos.h | 1 - gcc/config/cris/cris.c | 13 ++- gcc/config/cris/cris.h | 4 - gcc/config/d30v/d30v.c | 66 +----------- gcc/config/d30v/d30v.h | 67 +----------- gcc/config/darwin.h | 9 +- gcc/config/fr30/fr30.h | 62 +---------- gcc/config/h8300/h8300-protos.h | 1 - gcc/config/h8300/h8300.c | 28 ++++- gcc/config/h8300/h8300.h | 18 +--- gcc/config/i370/i370.c | 15 +++ gcc/config/i370/i370.h | 6 -- gcc/config/i386/cygwin.h | 7 +- gcc/config/i386/i386-interix.h | 29 ++--- gcc/config/i386/i386.c | 35 ++++++- gcc/config/i386/i386.h | 32 +----- gcc/config/i386/interix.c | 22 +++- gcc/config/i386/win32.h | 35 +------ gcc/config/i386/winnt.c | 2 - gcc/config/ia64/ia64-protos.h | 2 - gcc/config/ia64/ia64.c | 13 ++- gcc/config/ia64/ia64.h | 6 -- gcc/config/m32r/m32r-protos.h | 1 - gcc/config/m32r/m32r.c | 6 +- gcc/config/m32r/m32r.h | 12 +-- gcc/config/m68hc11/m68hc11-protos.h | 1 - gcc/config/m68hc11/m68hc11.c | 19 ++-- gcc/config/m68hc11/m68hc11.h | 11 -- gcc/config/m68k/m68k.h | 7 +- gcc/config/m88k/m88k.c | 30 ++++++ gcc/config/m88k/m88k.h | 30 ------ gcc/config/mcore/mcore-protos.h | 2 - gcc/config/mcore/mcore.c | 9 +- gcc/config/mcore/mcore.h | 10 +- gcc/config/mips/mips.c | 136 +++++++++++++++++++++--- gcc/config/mips/mips.h | 192 +--------------------------------- gcc/config/mmix/mmix-protos.h | 1 - gcc/config/mmix/mmix.c | 8 +- gcc/config/mmix/mmix.h | 3 - gcc/config/ns32k/ns32k.c | 21 ++++ gcc/config/ns32k/ns32k.h | 23 ---- gcc/config/pa/elf.h | 6 +- gcc/config/pa/pa.c | 28 ++++- gcc/config/pa/pa.h | 18 +--- gcc/config/pa/som.h | 2 +- gcc/config/romp/romp.c | 16 +++ gcc/config/romp/romp.h | 7 -- gcc/config/rs6000/linux64.h | 13 +-- gcc/config/rs6000/rs6000-protos.h | 1 - gcc/config/rs6000/rs6000.c | 26 ++++- gcc/config/rs6000/sysv4.h | 13 +-- gcc/config/rs6000/xcoff.h | 18 +--- gcc/config/s390/s390.c | 26 +++++ gcc/config/s390/s390.h | 26 ----- gcc/config/sh/sh.c | 35 ++++++- gcc/config/sh/sh.h | 36 ------- gcc/config/sparc/sparc.c | 18 ++++ gcc/config/sparc/sparc.h | 10 -- gcc/config/stormy16/stormy16-protos.h | 1 - gcc/config/stormy16/stormy16.c | 5 +- gcc/config/stormy16/stormy16.h | 80 +------------- gcc/config/v850/v850-protos.h | 1 - gcc/config/v850/v850.c | 17 ++- gcc/config/v850/v850.h | 9 -- gcc/config/vax/vax.c | 18 +++- gcc/config/vax/vms.h | 9 -- gcc/config/xtensa/xtensa.c | 22 ++-- gcc/config/xtensa/xtensa.h | 8 -- gcc/doc/tm.texi | 69 ++++++------ gcc/hooks.c | 8 ++ gcc/hooks.h | 1 + gcc/optabs.c | 3 +- gcc/system.h | 3 +- gcc/target-def.h | 7 +- gcc/target.h | 4 + gcc/varasm.c | 19 ++-- 94 files changed, 795 insertions(+), 1181 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c2a3a87e51f..b0bd4754380 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,70 @@ 2002-05-18 Richard Henderson + * system.h (ENCODE_SECTION_INFO): Poison it. + * target-def.h (TARGET_ENCODE_SECTION_INFO): New. + * target.h (encode_section_info): New. + * varasm.c (make_decl_rtl, output_constant_def): Use it. + * hooks.c (hook_tree_int_void): New. + * hooks.h: Declare it. + + * config/darwin.h, config/alpha/alpha-protos.h, config/alpha/alpha.c, + config/alpha/alpha.h, config/arm/pe.h, config/avr/avr-protos.h, + config/avr/avr.c, config/avr/avr.h, config/c4x/c4x-protos.h, + config/c4x/c4x.c, config/c4x/c4x.h, config/cris/cris-protos.h, + config/cris/cris.c, config/cris/cris.h, config/i386/cygwin.h, + config/i386/win32.h, config/ia64/ia64-protos.h, config/ia64/ia64.c, + config/ia64/ia64.h, config/m32r/m32r-protos.h, config/m32r/m32r.c, + config/m32r/m32r.h, config/m68hc11/m68hc11-protos.h, + config/m68hc11/m68hc11.c, config/m68hc11/m68hc11.h, + config/mcore/mcore-protos.h, config/mcore/mcore.c, + config/mcore/mcore.h, config/mmix/mmix-protos.h, config/mmix/mmix.c, + config/mmix/mmix.h, config/rs6000/rs6000-protos.h, + config/rs6000/sysv4.h, config/stormy16/stormy16-protos.h, + config/stormy16/stormy16.c, config/stormy16/stormy16.h: + Replace ENCODE_SECTION_INFO with TARGET_ENCODE_SECTION_INFO + referencing existing function. Make function static. + + * config/a29k/a29k.c, config/a29k/a29k.h, config/arc/arc.c, + config/arc/arc.h, config/arm/arm.c, config/arm/arm.h, + config/h8300/h8300.c, config/h8300/h8300.h, config/i370/i370.c, + config/i370/i370.h, config/i386/i386-interix.h, config/i386/i386.c, + config/i386/i386.h, config/i386/interix.c, config/m88k/m88k.c, + config/m88k/m88k.h, config/mips/mips.c, config/mips/mips.h, + config/ns32k/ns32k.c, config/ns32k/ns32k.h, config/pa/pa.c, + config/pa/pa.h, config/romp/romp.c, config/romp/romp.h, + config/rs6000/linux64.h, config/rs6000/xcoff.h, config/s390/s390.c, + config/s390/s390.h, config/sh/sh.c, config/sh/sh.h, + config/sparc/sparc.c, config/sparc/sparc.h, config/v850/v850.c, + config/v850/v850.h, config/vax/vax.c, config/vax/vms.h, + config/xtensa/xtensa.c, config/xtensa/xtensa.h: + Move ENCODE_SECTION_INFO to out-of-line function and add + TARGET_ENCODE_SECTION_INFO. + + * config/darwin.h (ASM_DECLARE_FUNCTION_NAME): Use hook, not macro. + (ASM_DECLARE_OBJECT_NAME, ASM_OUTPUT_ALIGNED_DECL_LOCAL): Likewise. + + * config/arm/pe.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS): Rename + from SUBTARGET_* + (switch_to_section): Replace in_rdata case with in_readonly_data. + + * config/h8300/h8300.c (h8300_encode_label): Make static. + * config/h8300/h8300-protos.h: Update. + + * config/rs6000/rs6000.c (rs6000_elf_encode_section_info): Rename + from rs6000_encode_section_info; make static. + (rs6000_xcoff_encode_section_info): New. + + * config/v850/v850.c (v850_encode_data_area): Make static. + * config/v850/v850-protos.h: Update. + + * config/vax/vax.c: Include flags.h. + (vms_select_section): Fix typo. + + * doc/tm.texi (TARGET_ENCODE_SECTION_INFO): Update from previous + ENCODE_SECTION_INFO docs. + +2002-05-18 Richard Henderson + * config/darwin.h (DARWIN_REGISTER_TARGET_PRAGMAS): Rename from REGISTER_TARGET_PRAGMAS. * config/rs6000/darwin.h (REGISTER_TARGET_PRAGMAS): Redefine. diff --git a/gcc/config/a29k/a29k.c b/gcc/config/a29k/a29k.c index bd08c38c786..2f61dfe6127 100644 --- a/gcc/config/a29k/a29k.c +++ b/gcc/config/a29k/a29k.c @@ -50,6 +50,7 @@ static void output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void a29k_asm_named_section PARAMS ((const char *, unsigned int)); static int a29k_adjust_cost PARAMS ((rtx, rtx, rtx, int)); +static void a29k_encode_section_info PARAMS ((tree, int)); #define min(A,B) ((A) < (B) ? (A) : (B)) @@ -108,6 +109,8 @@ int a29k_compare_fp_p; #define TARGET_ASM_FUNCTION_EPILOGUE output_function_epilogue #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST a29k_adjust_cost +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO a29k_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -1611,3 +1614,18 @@ a29k_adjust_cost (insn, link, dep_insn, cost) return cost; } + +/* If we are referencing a function that is static or is known to be + in this file, make the SYMBOL_REF special. We can use this to + indicate that we can branch to this function without emitting a + no-op after the call. */ + +static void +a29k_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (TREE_CODE (decl) == FUNCTION_DECL + && (TREE_ASM_WRITTEN (decl) || ! TREE_PUBLIC (decl))) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} diff --git a/gcc/config/a29k/a29k.h b/gcc/config/a29k/a29k.h index 1dcd51c969c..1665368e920 100644 --- a/gcc/config/a29k/a29k.h +++ b/gcc/config/a29k/a29k.h @@ -1333,16 +1333,6 @@ extern const char *a29k_function_name; #define DATA_SECTION_ASM_OP "\t.data" -/* If we are referencing a function that is static or is known to be - in this file, make the SYMBOL_REF special. We can use this to indicate - that we can branch to this function without emitting a no-op after the - call. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - if (TREE_CODE (DECL) == FUNCTION_DECL \ - && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL))) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; - /* How to refer to registers in assembler output. This sequence is indexed by compiler's hard-register-number (see above). */ diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index f7745a1859d..2eb195a503d 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -165,7 +165,6 @@ extern void alpha_start_function PARAMS ((FILE *, const char *, tree)); extern void alpha_end_function PARAMS ((FILE *, const char *, tree)); extern void alpha_output_mi_thunk_osf PARAMS ((FILE *, tree, HOST_WIDE_INT, tree)); -extern void alpha_encode_section_info PARAMS ((tree, int)); #endif /* TREE CODE */ #ifdef RTX_CODE diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index eb2eff23711..837ec6d9088 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -117,6 +117,8 @@ static bool decl_in_text_section PARAMS ((tree)); static bool alpha_in_small_data_p PARAMS ((tree)); +static void alpha_encode_section_info + PARAMS ((tree, int)); static int some_small_symbolic_operand_1 PARAMS ((rtx *, void *)); static int split_small_symbolic_operand_1 @@ -208,6 +210,8 @@ static void vms_asm_out_destructor PARAMS ((rtx, int)); #undef TARGET_IN_SMALL_DATA_P #define TARGET_IN_SMALL_DATA_P alpha_in_small_data_p +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO alpha_encode_section_info #if TARGET_ABI_UNICOSMK static void unicosmk_asm_named_section PARAMS ((const char *, unsigned int)); @@ -950,7 +954,7 @@ local_symbol_p (op) unrecognizable insns. */ return (CONSTANT_POOL_ADDRESS_P (op) - /* If @, then ENCODE_SECTION_INFO sez it's local. */ + /* If @, then alpha_encode_section_info sez it's local. */ || str[0] == '@' /* If *$, then ASM_GENERATE_INTERNAL_LABEL sez it's local. */ || (str[0] == '*' && str[1] == '$')); @@ -1604,7 +1608,7 @@ alpha_in_small_data_p (exp) to the name. If in addition the variable is to go in .sdata/.sbss, then add "@s" instead. */ -void +static void alpha_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index b890bd63ce6..260e641805a 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -1724,13 +1724,6 @@ do { \ #define DATA_SECTION_ASM_OP "\t.data" -/* Define this macro if references to a symbol must be treated differently - depending on something about the variable or function named by the symbol - (such as what section it is in). */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - alpha_encode_section_info (DECL, FIRST) - #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ (VAR) = (SYMBOL_NAME); \ diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 663f50b6e84..9ea6df7a027 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -92,6 +92,7 @@ static tree arc_handle_interrupt_attribute PARAMS ((tree *, tree, tree, int, boo static bool arc_assemble_integer PARAMS ((rtx, unsigned int, int)); static void arc_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void arc_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); +static void arc_encode_section_info PARAMS ((tree, int)); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -107,6 +108,8 @@ static void arc_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); #define TARGET_ASM_FUNCTION_EPILOGUE arc_output_function_epilogue #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE arc_attribute_table +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO arc_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -2347,3 +2350,17 @@ arc_va_arg (valist, type) return addr_rtx; } + +/* On the ARC, function addresses are not the same as normal addresses. + Branch to absolute address insns take an address that is right-shifted + by 2. We encode the fact that we have a function here, and then emit a + special assembler op when outputting the address. */ + +static void +arc_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (TREE_CODE (decl) == FUNCTION_DECL) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index d431bd4636f..ae0176fcdf4 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1121,35 +1121,6 @@ extern const char *arc_text_section, *arc_data_section, *arc_rodata_section; This macro is irrelevant if there is no separate readonly data section. */ /*#define JUMP_TABLES_IN_TEXT_SECTION*/ -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - The macro definition, if any, is executed immediately after the - rtl for DECL or other node is created. - The value of the rtl will be a `mem' whose address is a - `symbol_ref'. - - The usual thing for this macro to do is to store a flag in the - `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified - name string in the `symbol_ref' (if one bit is not enough - information). */ - -/* On the ARC, function addresses are not the same as normal addresses. - Branch to absolute address insns take an address that is right-shifted - by 2. We encode the fact that we have a function here, and then emit a - special assembler op when outputting the address. */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do { \ - if (TREE_CODE (DECL) == FUNCTION_DECL) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ -} while (0) - -/* Decode SYM_NAME and store the real name part in VAR, sans - the characters that encode section info. Define this macro if - ENCODE_SECTION_INFO alters the symbol's name string. */ -/*#define STRIP_NAME_ENCODING(VAR, SYM_NAME)*/ - /* For DWARF. Marginally different than default so output is "prettier" (and consistent with above). */ #define PUSHSECTION_ASM_OP "\t.section " @@ -1324,12 +1295,7 @@ arc_print_operand (FILE, X, CODE) /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is ADDR. ADDR is an RTL expression. - - On some machines, the syntax for a symbolic address depends on - the section that the address refers to. On these machines, - define the macro `ENCODE_SECTION_INFO' to store the information - into the `symbol_ref', and then check for it here. */ + reference whose address is ADDR. ADDR is an RTL expression. */ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ arc_print_operand_address (FILE, ADDR) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index d784050c4b0..cbcd1a14dca 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -120,6 +120,9 @@ static int arm_adjust_cost PARAMS ((rtx, rtx, rtx, int)); #ifdef OBJECT_FORMAT_ELF static void arm_elf_asm_named_section PARAMS ((const char *, unsigned int)); #endif +#ifndef ARM_PE +static void arm_encode_section_info PARAMS ((tree, int)); +#endif #undef Hint #undef Mmode @@ -170,6 +173,13 @@ static void arm_elf_asm_named_section PARAMS ((const char *, unsigned int)); #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST arm_adjust_cost +#undef TARGET_ENCODE_SECTION_INFO +#ifdef ARM_PE +#define TARGET_ENCODE_SECTION_INFO arm_pe_encode_section_info +#else +#define TARGET_ENCODE_SECTION_INFO arm_encode_section_info +#endif + struct gcc_target targetm = TARGET_INITIALIZER; /* Obstack for minipool constant handling. */ @@ -11042,3 +11052,40 @@ arm_elf_asm_named_section (name, flags) name, flagchars, type); } #endif + +#ifndef ARM_PE +/* Symbols in the text segment can be accessed without indirecting via the + constant pool; it may take an extra binary operation, but this is still + faster than indirecting via memory. Don't do this when not optimizing, + since we won't be calculating al of the offsets necessary to do this + simplification. */ + +static void +arm_encode_section_info (decl, first) + tree decl; + int first; +{ + /* This doesn't work with AOF syntax, since the string table may be in + a different AREA. */ +#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; + } +#endif + + /* If we are referencing a function that is weak then encode a long call + flag in the function name, otherwise if the function is static or + or known to be defined in this file then encode a short call flag. */ + if (first && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') + { + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl)) + arm_encode_call_attribute (decl, LONG_CALL_FLAG_CHAR); + else if (! TREE_PUBLIC (decl)) + arm_encode_call_attribute (decl, SHORT_CALL_FLAG_CHAR); + } +} +#endif /* !ARM_PE */ diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index fcb2c1f4a67..c3946d64c56 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1860,47 +1860,6 @@ typedef struct #define ASM_OUTPUT_LABELREF(FILE, NAME) \ asm_fprintf (FILE, "%U%s", arm_strip_name_encoding (NAME)) -/* If we are referencing a function that is weak then encode a long call - flag in the function name, otherwise if the function is static or - or known to be defined in this file then encode a short call flag. - This macro is used inside the ENCODE_SECTION macro. */ -#define ARM_ENCODE_CALL_TYPE(decl) \ - if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') \ - { \ - if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl)) \ - arm_encode_call_attribute (decl, LONG_CALL_FLAG_CHAR); \ - else if (! TREE_PUBLIC (decl)) \ - arm_encode_call_attribute (decl, SHORT_CALL_FLAG_CHAR); \ - } - -/* Symbols in the text segment can be accessed without indirecting via the - constant pool; it may take an extra binary operation, but this is still - faster than indirecting via memory. Don't do this when not optimizing, - since we won't be calculating al of the offsets necessary to do this - simplification. */ -/* This doesn't work with AOF syntax, since the string table may be in - a different AREA. */ -#ifndef AOF_ASSEMBLER -#define ENCODE_SECTION_INFO(decl, first) \ -{ \ - 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; \ - } \ - if (first) \ - ARM_ENCODE_CALL_TYPE (decl) \ -} -#else -#define ENCODE_SECTION_INFO(decl, first) \ -{ \ - if (first) \ - ARM_ENCODE_CALL_TYPE (decl) \ -} -#endif - #define ARM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL) \ arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR) diff --git a/gcc/config/arm/pe.c b/gcc/config/arm/pe.c index 7fb0ed9b5df..de745586dc2 100644 --- a/gcc/config/arm/pe.c +++ b/gcc/config/arm/pe.c @@ -204,14 +204,12 @@ arm_mark_dllimport (decl) XEXP (DECL_RTL (decl), 0) = newrtl; } -/* Cover function to implement ENCODE_SECTION_INFO. */ - void arm_pe_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; { - /* This bit is copied from arm.h. */ + /* This bit is copied from arm_encode_section_info. */ if (optimize > 0 && TREE_CONSTANT (decl) && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) { diff --git a/gcc/config/arm/pe.h b/gcc/config/arm/pe.h index 72fa77d44e3..38727dad8ed 100644 --- a/gcc/config/arm/pe.h +++ b/gcc/config/arm/pe.h @@ -94,17 +94,6 @@ Boston, MA 02111-1307, USA. */ 1,1,1 \ } -/* In addition to the stuff done in arm.h, we must mark dll symbols specially. - Definitions of dllexport'd objects install some info in the .drectve - section. References to dllimport'd objects are fetched indirectly via - __imp_. If both are declared, dllexport overrides. - This is also needed to implement one-only vtables: they go into their own - section and we need to set DECL_SECTION_NAME so we do that here. - Note that we can be called twice on the same decl. */ -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - arm_pe_encode_section_info (DECL, FIRST) - /* Define this macro if in some cases global symbols from one translation unit may not be bound to undefined symbols in another translation unit without user intervention. For instance, under Microsoft Windows @@ -200,13 +189,13 @@ Boston, MA 02111-1307, USA. */ /* A list of other sections which the compiler might be "in" at any given time. */ -#undef SUBTARGET_EXTRA_SECTIONS -#define SUBTARGET_EXTRA_SECTIONS in_drectve, +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_drectve /* A list of extra section function definitions. */ -#undef SUBTARGET_EXTRA_SECTION_FUNCTIONS -#define SUBTARGET_EXTRA_SECTION_FUNCTIONS \ +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ DRECTVE_SECTION_FUNCTION \ SWITCH_TO_SECTION_FUNCTION @@ -239,7 +228,7 @@ switch_to_section (section, decl) \ case in_text: text_section (); break; \ case in_data: data_section (); break; \ case in_named: named_section (decl, NULL, 0); break; \ - case in_rdata: rdata_section (); break; \ + case in_readonly_data: readonly_data_section (); break; \ case in_ctors: ctors_section (); break; \ case in_dtors: dtors_section (); break; \ case in_drectve: drectve_section (); break; \ diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 1a239d22587..f6dd8802e98 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -43,7 +43,6 @@ extern void gas_output_ascii PARAMS ((FILE *file, const char *str, #ifdef TREE_CODE extern void asm_output_external PARAMS ((FILE *file, tree decl, char *name)); -extern void encode_section_info PARAMS ((tree decl, int)); extern int avr_progmem_p PARAMS ((tree decl)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 95b625f8e2e..262ed6323c4 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -65,6 +65,7 @@ static bool avr_assemble_integer PARAMS ((rtx, unsigned int, int)); static void avr_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void avr_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void avr_unique_section PARAMS ((tree, int)); +extern void avr_encode_section_info PARAMS ((tree, int)); /* Allocate registers from r25 to r8 for parameters for function calls */ #define FIRST_CUM_REG 26 @@ -200,6 +201,8 @@ int avr_case_values_threshold = 30000; #define TARGET_ATTRIBUTE_TABLE avr_attribute_table #undef TARGET_ASM_UNIQUE_SECTION #define TARGET_ASM_UNIQUE_SECTION avr_unique_section +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO avr_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -4749,10 +4752,10 @@ avr_progmem_p (decl) return 0; } -/* Encode section information about tree DECL */ +/* Encode section information about tree DECL. */ -void -encode_section_info (decl, first) +static void +avr_encode_section_info (decl, first) tree decl; int first; { diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 7e74c229883..c227241ff74 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -1322,64 +1322,7 @@ extern int avr_reg_order[]; #endif /* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target machine - for a memory operand of mode MODE. - - It usually pays to define several simpler macros to serve as - subroutines for this one. Otherwise it may be too complicated to - understand. - - This macro must exist in two variants: a strict variant and a - non-strict one. The strict variant is used in the reload pass. It - must be defined so that any pseudo-register that has not been - allocated a hard register is considered a memory reference. In - contexts where some kind of register is required, a pseudo-register - with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be - defined to accept all pseudo-registers in every context where some - kind of register is required. - - Compiler source files that want to use the strict variant of this - macro define the macro `REG_OK_STRICT'. You should use an `#ifdef - REG_OK_STRICT' conditional to define the strict variant in that - case and the non-strict variant otherwise. - - Subroutines to check for acceptable registers for various purposes - (one for base registers, one for index registers, and so on) are - typically among the subroutines used to define - `GO_IF_LEGITIMATE_ADDRESS'. Then only these subroutine macros - need have two variants; the higher levels of macros may be the - same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' - and an integer are stored inside a `const' RTX to mark them as - constant. Therefore, there is no need to recognize such sums - specifically as legitimate addresses. Normally you would simply - recognize any `const' as legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant - sums that are not marked with `const'. It assumes that a naked - `plus' indicates indexing. If so, then you *must* reject such - naked constant sums as illegitimate addresses, so that none of - them will be given to `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate depends - on the section that the address refers to. On these machines, - define the macro `ENCODE_SECTION_INFO' to store the information - into the `symbol_ref', and then check for it here. When you see a - `const', you will have to look inside it to find the `symbol_ref' - in order to determine the section. *Note Assembler Format::. - - The best way to modify the name string is by adding text to the - beginning, with suitable punctuation to prevent any ambiguity. - Allocate the new name in `saveable_obstack'. You will have to - modify `ASM_OUTPUT_LABELREF' to remove and decode the added text - and output the name accordingly, and define `STRIP_NAME_ENCODING' - to access the original name string. - - You can check the information stored here into the `symbol_ref' in - the definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and - `PRINT_OPERAND_ADDRESS'. */ + for a memory operand of mode MODE. */ /* `REG_OK_FOR_BASE_P (X)' A C expression that is nonzero if X (assumed to be a `reg' RTX) is @@ -1799,27 +1742,11 @@ progmem_section (void) \ This macro is irrelevant if there is no separate readonly data section. */ -#define ENCODE_SECTION_INFO(DECL, FIRST) encode_section_info(DECL, FIRST) -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or function - named by the symbol (such as what section it is in). - - The macro definition, if any, is executed immediately after the - rtl for DECL has been created and stored in `DECL_RTL (DECL)'. - The value of the rtl will be a `mem' whose address is a - `symbol_ref'. - - The usual thing for this macro to do is to record a flag in the - `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified - name string in the `symbol_ref' (if one bit is not enough - information). */ - #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ (VAR) = (SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' || (SYMBOL_NAME)[0] == '@'); /* `STRIP_NAME_ENCODING (VAR, SYM_NAME)' Decode SYM_NAME and store the real name part in VAR, sans the - characters that encode section info. Define this macro if - `ENCODE_SECTION_INFO' alters the symbol's name string. */ + characters that encode section info. */ #define ASM_FILE_START(STREAM) asm_file_start (STREAM) /* A C expression which outputs to the stdio stream STREAM some @@ -2307,13 +2234,7 @@ sprintf (STRING, "*.%s%d", PREFIX, NUM) #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X) /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is X. X is an RTL expression. - - On some machines, the syntax for a symbolic address depends on the - section that the address refers to. On these machines, define the - macro `ENCODE_SECTION_INFO' to store the information into the - `symbol_ref', and then check for it here. *Note Assembler - Format::. */ + reference whose address is X. X is an RTL expression. */ #define USER_LABEL_PREFIX "" /* `LOCAL_LABEL_PREFIX' diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 10ed818fde3..d8468d17090 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -53,8 +53,6 @@ extern struct rtx_def *c4x_function_arg PARAMS ((CUMULATIVE_ARGS *, enum machine_mode, tree, int)); -extern void c4x_encode_section_info PARAMS ((tree, int)); - #endif /* TREE_CODE */ diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index ff4ac02941a..126b132f5b5 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -193,6 +193,7 @@ const struct attribute_spec c4x_attribute_table[]; static void c4x_insert_attributes PARAMS ((tree, tree *)); static void c4x_asm_named_section PARAMS ((const char *, unsigned int)); static int c4x_adjust_cost PARAMS ((rtx, rtx, rtx, int)); +static void c4x_encode_section_info PARAMS ((tree, int)); /* Initialize the GCC target structure. */ #undef TARGET_ASM_BYTE_OP @@ -217,6 +218,9 @@ static int c4x_adjust_cost PARAMS ((rtx, rtx, rtx, int)); #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST c4x_adjust_cost +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO c4x_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Called to register all of our global variables with the garbage @@ -1478,7 +1482,8 @@ c4x_emit_libcall_mulhi (libcall, code, mode, operands) /* Set the SYMBOL_REF_FLAG for a function decl. However, wo do not yet use this info. */ -void + +static void c4x_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index ee5e38e710a..e7423f81595 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1516,25 +1516,6 @@ CUMULATIVE_ARGS; #define LEGITIMATE_DISPLACEMENT_P(X) IS_DISP8_CONST (INTVAL (X)) -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - The macro definition, if any, is executed immediately after the - rtl for DECL or other node is created. - The value of the rtl will be a `mem' whose address is a - `symbol_ref'. - - The usual thing for this macro to do is to a flag in the - `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified - name string in the `symbol_ref' (if one bit is not enough - information). - - On the C4x we use this to indicate if a symbol is in text or - data space. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) c4x_encode_section_info (DECL, FIRST); - /* Descripting Relative Cost of Operations. */ /* Provide the costs of a rtl expression. This is in the body of a diff --git a/gcc/config/cris/cris-protos.h b/gcc/config/cris/cris-protos.h index f5e9f76c7e2..4db5a2a54b4 100644 --- a/gcc/config/cris/cris-protos.h +++ b/gcc/config/cris/cris-protos.h @@ -49,7 +49,6 @@ extern void cris_target_asm_named_section # ifdef TREE_CODE extern rtx cris_expand_builtin_va_arg PARAMS ((tree, tree)); -extern void cris_encode_section_info PARAMS ((tree, int)); # endif #endif /* RTX_CODE */ diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c index 51f9ee9ffeb..e9a323257d8 100644 --- a/gcc/config/cris/cris.c +++ b/gcc/config/cris/cris.c @@ -97,6 +97,7 @@ static void cris_target_asm_function_prologue static void cris_target_asm_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); +static void cris_encode_section_info PARAMS ((tree, int)); static void cris_operand_lossage PARAMS ((const char *, rtx)); /* The function cris_target_asm_function_epilogue puts the last insn to @@ -148,6 +149,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION; #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE cris_target_asm_function_epilogue +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO cris_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Predicate functions. */ @@ -3033,12 +3037,11 @@ restart: } } -/* The ENCODE_SECTION_INFO worker. Code-in whether we can get away - without a GOT entry (needed for externally visible objects but not for - functions) into SYMBOL_REF_FLAG and add the PLT suffix for global - functions. */ +/* Code-in whether we can get away without a GOT entry (needed for + externally visible objects but not for functions) into + SYMBOL_REF_FLAG and add the PLT suffix for global functions. */ -void +static void cris_encode_section_info (exp, first) tree exp; int first ATTRIBUTE_UNUSED; diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 5bede238a24..ad8481c70e6 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -1442,10 +1442,6 @@ struct cum_args {int regs;}; /* The jump table is immediately connected to the preceding insn. */ #define JUMP_TABLES_IN_TEXT_SECTION 1 -/* We need to code in PIC-specific flags into SYMBOL_REF_FLAG. */ - -#define ENCODE_SECTION_INFO(EXP, FIRST) cris_encode_section_info (EXP, FIRST) - /* We pull a little trick to register the _fini function with atexit, after (presumably) registering the eh frame info, since we don't handle _fini (a.k.a. ___fini_start) in crt0 or have a crti for "pure" ELF. If diff --git a/gcc/config/d30v/d30v.c b/gcc/config/d30v/d30v.c index ba4d90b9f87..12ae39ad3b5 100644 --- a/gcc/config/d30v/d30v.c +++ b/gcc/config/d30v/d30v.c @@ -2632,12 +2632,7 @@ d30v_split_double (value, p_high, p_low) /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory reference whose address is X. X - is an RTL expression. - - On some machines, the syntax for a symbolic address depends on the section - that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. *Note Assembler Format::. */ + is an RTL expression. */ void d30v_print_operand_address (stream, x) @@ -3101,64 +3096,7 @@ d30v_initialize_trampoline (addr, fnaddr, static_chain) /* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target machine for a memory - operand of mode MODE. - - It usually pays to define several simpler macros to serve as subroutines for - this one. Otherwise it may be too complicated to understand. - - This macro must exist in two variants: a strict variant and a non-strict - one. The strict variant is used in the reload pass. It must be defined so - that any pseudo-register that has not been allocated a hard register is - considered a memory reference. In contexts where some kind of register is - required, a pseudo-register with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be defined to - accept all pseudo-registers in every context where some kind of register is - required. - - Compiler source files that want to use the strict variant of this macro - define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' - conditional to define the strict variant in that case and the non-strict - variant otherwise. - - Subroutines to check for acceptable registers for various purposes (one for - base registers, one for index registers, and so on) are typically among the - subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these - subroutine macros need have two variants; the higher levels of macros may be - the same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' and an - integer are stored inside a `const' RTX to mark them as constant. - Therefore, there is no need to recognize such sums specifically as - legitimate addresses. Normally you would simply recognize any `const' as - legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that - are not marked with `const'. It assumes that a naked `plus' indicates - indexing. If so, then you *must* reject such naked constant sums as - illegitimate addresses, so that none of them will be given to - `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate depends on the - section that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. When you see a `const', you will have to look - inside it to find the `symbol_ref' in order to determine the section. *Note - Assembler Format::. - - The best way to modify the name string is by adding text to the beginning, - with suitable punctuation to prevent any ambiguity. Allocate the new name - in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to - remove and decode the added text and output the name accordingly, and define - `STRIP_NAME_ENCODING' to access the original name string. - - You can check the information stored here into the `symbol_ref' in the - definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and - `PRINT_OPERAND_ADDRESS'. - - Return 0 if the address is not legitimate, 1 if the address would fit - in a short instruction, or 2 if the address would fit in a long - instruction. */ + operand of mode MODE. */ #define XREGNO_OK_FOR_BASE_P(REGNO, STRICT_P) \ ((STRICT_P) \ diff --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index e66ba674d53..c0a949fc608 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -2270,60 +2270,7 @@ typedef struct machine_function /* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target machine for a memory - operand of mode MODE. - - It usually pays to define several simpler macros to serve as subroutines for - this one. Otherwise it may be too complicated to understand. - - This macro must exist in two variants: a strict variant and a non-strict - one. The strict variant is used in the reload pass. It must be defined so - that any pseudo-register that has not been allocated a hard register is - considered a memory reference. In contexts where some kind of register is - required, a pseudo-register with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be defined to - accept all pseudo-registers in every context where some kind of register is - required. - - Compiler source files that want to use the strict variant of this macro - define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' - conditional to define the strict variant in that case and the non-strict - variant otherwise. - - Subroutines to check for acceptable registers for various purposes (one for - base registers, one for index registers, and so on) are typically among the - subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these - subroutine macros need have two variants; the higher levels of macros may be - the same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' and an - integer are stored inside a `const' RTX to mark them as constant. - Therefore, there is no need to recognize such sums specifically as - legitimate addresses. Normally you would simply recognize any `const' as - legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that - are not marked with `const'. It assumes that a naked `plus' indicates - indexing. If so, then you *must* reject such naked constant sums as - illegitimate addresses, so that none of them will be given to - `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate depends on the - section that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. When you see a `const', you will have to look - inside it to find the `symbol_ref' in order to determine the section. *Note - Assembler Format::. - - The best way to modify the name string is by adding text to the beginning, - with suitable punctuation to prevent any ambiguity. Allocate the new name - in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to - remove and decode the added text and output the name accordingly, and define - `STRIP_NAME_ENCODING' to access the original name string. - - You can check the information stored here into the `symbol_ref' in the - definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and - `PRINT_OPERAND_ADDRESS'. */ + operand of mode MODE. */ #ifdef REG_OK_STRICT #define REG_OK_STRICT_P 1 @@ -2753,11 +2700,6 @@ extern const char *d30v_branch_cost_string; This macro is irrelevant if there is no separate readonly data section. */ /* #define JUMP_TABLES_IN_TEXT_SECTION */ - -/* Decode SYM_NAME and store the real name part in VAR, sans the characters - that encode section info. Define this macro if `ENCODE_SECTION_INFO' alters - the symbol's name string. */ -/* #define STRIP_NAME_ENCODING(VAR, SYM_NAME) */ /* Position Independent Code. */ @@ -3544,12 +3486,7 @@ do { \ /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory reference whose address is X. X - is an RTL expression. - - On some machines, the syntax for a symbolic address depends on the section - that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. *Note Assembler Format::. */ + is an RTL expression. */ #define PRINT_OPERAND_ADDRESS(STREAM, X) d30v_print_operand_address (STREAM, X) diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index 4602126d90b..14ab0ff98b7 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -208,7 +208,7 @@ do { text_section (); \ if ((TREE_STATIC (DECL) \ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ || DECL_INITIAL (DECL)) \ - ENCODE_SECTION_INFO (DECL, false); \ + (* targetm.encode_section_info) (DECL, false); \ ASM_OUTPUT_LABEL (FILE, xname); \ } while (0) @@ -224,7 +224,7 @@ do { text_section (); \ if ((TREE_STATIC (DECL) \ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ || DECL_INITIAL (DECL)) \ - ENCODE_SECTION_INFO (DECL, false); \ + (* targetm.encode_section_info) (DECL, false); \ ASM_OUTPUT_LABEL (FILE, xname); \ /* Avoid generating stubs for functions we've just defined by \ outputting any required stub name label now. */ \ @@ -279,7 +279,7 @@ do { text_section (); \ if ((DECL) && ((TREE_STATIC (DECL) \ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ || DECL_INITIAL (DECL))) \ - ENCODE_SECTION_INFO (DECL, false); \ + (* targetm.encode_section_info) (DECL, false); \ if ((DECL) && ((TREE_STATIC (DECL) \ && (!DECL_COMMON (DECL) || !TREE_PUBLIC (DECL))) \ || DECL_INITIAL (DECL))) \ @@ -552,8 +552,7 @@ enum machopic_addr_class { #define MACHOPIC_JUST_INDIRECT (flag_pic == 1) #define MACHOPIC_PURE (flag_pic == 2) -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - darwin_encode_section_info (DECL, FIRST) +#define TARGET_ENCODE_SECTION_INFO darwin_encode_section_info #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ ((VAR) = ((SYMBOL_NAME[0] == '!') ? (SYMBOL_NAME) + 4 : (SYMBOL_NAME))) diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h index 992788a04f6..2f0cf99561b 100644 --- a/gcc/config/fr30/fr30.h +++ b/gcc/config/fr30/fr30.h @@ -977,61 +977,7 @@ do \ /* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target machine for a memory - operand of mode MODE. - - It usually pays to define several simpler macros to serve as subroutines for - this one. Otherwise it may be too complicated to understand. - - This macro must exist in two variants: a strict variant and a non-strict - one. The strict variant is used in the reload pass. It must be defined so - that any pseudo-register that has not been allocated a hard register is - considered a memory reference. In contexts where some kind of register is - required, a pseudo-register with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be defined to - accept all pseudo-registers in every context where some kind of register is - required. - - Compiler source files that want to use the strict variant of this macro - define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' - conditional to define the strict variant in that case and the non-strict - variant otherwise. - - Subroutines to check for acceptable registers for various purposes (one for - base registers, one for index registers, and so on) are typically among the - subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these - subroutine macros need have two variants; the higher levels of macros may be - the same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' and an - integer are stored inside a `const' RTX to mark them as constant. - Therefore, there is no need to recognize such sums specifically as - legitimate addresses. Normally you would simply recognize any `const' as - legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that - are not marked with `const'. It assumes that a naked `plus' indicates - indexing. If so, then you *must* reject such naked constant sums as - illegitimate addresses, so that none of them will be given to - `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate depends on the - section that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. When you see a `const', you will have to look - inside it to find the `symbol_ref' in order to determine the section. - - The best way to modify the name string is by adding text to the beginning, - with suitable punctuation to prevent any ambiguity. Allocate the new name - in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to - remove and decode the added text and output the name accordingly, and define - `STRIP_NAME_ENCODING' to access the original name string. - - You can check the information stored here into the `symbol_ref' in the - definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and - `PRINT_OPERAND_ADDRESS'. - - Used in explow.c, recog.c, reload.c. */ + operand of mode MODE. */ /* On the FR30 we only have one real addressing mode - an address in a register. There are three special cases however: @@ -1293,12 +1239,8 @@ do \ /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory reference whose address is X. X - is an RTL expression. + is an RTL expression. */ - On some machines, the syntax for a symbolic address depends on the section - that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. *Note Assembler Format::. */ #define PRINT_OPERAND_ADDRESS(STREAM, X) fr30_print_operand_address (STREAM, X) /* If defined, C string expressions to be used for the `%R', `%L', `%U', and diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index c86484296cb..9a70284d806 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -68,7 +68,6 @@ extern struct rtx_def *function_arg PARAMS ((CUMULATIVE_ARGS *, extern int h8300_funcvec_function_p PARAMS ((tree)); extern int h8300_eightbit_data_p PARAMS ((tree)); extern int h8300_tiny_data_p PARAMS ((tree)); -extern void h8300_encode_label PARAMS ((tree)); #endif /* TREE_CODE */ extern void h8300_init_once PARAMS ((void)); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index aa23bada82a..64d4e85f237 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -64,6 +64,8 @@ static void h8300_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); #ifndef OBJECT_FORMAT_ELF static void h8300_asm_named_section PARAMS ((const char *, unsigned int)); #endif +static void h8300_encode_label PARAMS ((tree)); +static void h8300_encode_section_info PARAMS ((tree, int)); /* CPU_TYPE, says what cpu we're compiling for. */ int cpu_type; @@ -111,6 +113,8 @@ const char *h8_push_op, *h8_pop_op, *h8_mov_op; #define TARGET_ASM_FUNCTION_PROLOGUE h8300_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE h8300_output_function_epilogue +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO h8300_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -3436,7 +3440,7 @@ h8300_handle_tiny_data_attribute (node, name, args, flags, no_add_attrs) return NULL_TREE; } -void +static void h8300_encode_label (decl) tree decl; { @@ -3451,6 +3455,28 @@ h8300_encode_label (decl) ggc_alloc_string (newstr, len + 1); } +/* If we are referencing a function that is supposed to be called + through the function vector, the SYMBOL_REF_FLAG in the rtl + so the call patterns can generate the correct code. */ + +static void +h8300_encode_section_info (decl, first) + tree decl; + int first; +{ + if (TREE_CODE (decl) == FUNCTION_DECL + && h8300_funcvec_function_p (decl)) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; + else if (TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) + { + if (h8300_eightbit_data_p (decl)) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; + else if (first && h8300_tiny_data_p (decl)) + h8300_encode_label (decl); + } +} + const char * output_simode_bld (bild, operands) int bild; diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 97955a3c32f..1baa95901c0 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -1096,24 +1096,8 @@ struct cum_arg #define TINY_DATA_NAME_P(NAME) (*(NAME) == '&') -/* If we are referencing a function that is supposed to be called - through the function vector, the SYMBOL_REF_FLAG in the rtl - so the call patterns can generate the correct code. */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - if (TREE_CODE (DECL) == FUNCTION_DECL \ - && h8300_funcvec_function_p (DECL)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - else if (TREE_CODE (DECL) == VAR_DECL \ - && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \ - && h8300_eightbit_data_p (DECL)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - else if ((FIRST) && TREE_CODE (DECL) == VAR_DECL \ - && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL)) \ - && h8300_tiny_data_p (DECL)) \ - h8300_encode_label (DECL); - /* Store the user-specified part of SYMBOL_NAME in VAR. - This is sort of inverse to ENCODE_SECTION_INFO. */ + This is sort of inverse to targetm.encode_section_info. */ #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \ (VAR) = (SYMBOL_NAME) + ((SYMBOL_NAME)[0] == '*' \ || (SYMBOL_NAME)[0] == '@' \ diff --git a/gcc/config/i370/i370.c b/gcc/config/i370/i370.c index 5ee6b239951..e19f72e79b7 100644 --- a/gcc/config/i370/i370.c +++ b/gcc/config/i370/i370.c @@ -107,6 +107,7 @@ static void i370_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); #ifdef LONGEXTERNAL static int mvs_hash_alias PARAMS ((const char *)); #endif +static void i370_encode_section_info PARAMS ((tree, int)); /* ===================================================== */ /* defines and functions specific to the HLASM assembler */ @@ -306,6 +307,8 @@ static const unsigned char ebcasc[256] = #define TARGET_ASM_FUNCTION_PROLOGUE i370_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE i370_output_function_epilogue +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i370_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -1554,3 +1557,15 @@ i370_output_function_epilogue (file, l) for (i = function_base_page; i < mvs_page_num; i++) fprintf (file, "\tDC\tA(PG%d)\n", i); } + +/* Mark external references. */ + +static void +i370_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} + diff --git a/gcc/config/i370/i370.h b/gcc/config/i370/i370.h index adcaca675d7..be1e79d81d9 100644 --- a/gcc/config/i370/i370.h +++ b/gcc/config/i370/i370.h @@ -281,12 +281,6 @@ extern int mvs_function_name_length; (((MODE1) == SFmode || (MODE1) == DFmode) \ == ((MODE2) == SFmode || (MODE2) == DFmode)) -/* Mark external references. */ - -#define ENCODE_SECTION_INFO(decl, first) \ - if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; - /* Specify the registers used for certain standard purposes. The values of these macros are register numbers. */ diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h index 739977b922e..7098066adc1 100644 --- a/gcc/config/i386/cygwin.h +++ b/gcc/config/i386/cygwin.h @@ -257,9 +257,8 @@ do { \ extern void i386_pe_encode_section_info PARAMS ((TREE, int)); -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - i386_pe_encode_section_info (DECL, FIRST) +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info /* Utility used only in this file. */ #define I386_PE_STRIP_ENCODING(SYM_NAME) \ @@ -269,7 +268,7 @@ extern void i386_pe_encode_section_info PARAMS ((TREE, int)); /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ + trailing @[NUM] encoded by targetm.encode_section_info. */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h index ea37a1cc543..fb0a9a9d87c 100644 --- a/gcc/config/i386/i386-interix.h +++ b/gcc/config/i386/i386-interix.h @@ -305,32 +305,15 @@ while (0) stddef renaming does NOT apply to Alpha. */ -union tree_node; -const char *gen_stdcall_suffix PARAMS ((union tree_node *)); - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if ((FIRST) && TREE_CODE (DECL) == FUNCTION_DECL) \ - if (lookup_attribute ("stdcall", \ - TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ - XEXP (DECL_RTL (DECL), 0) = \ - gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ - } \ -while (0) +const char *gen_stdcall_suffix PARAMS ((tree)); +void i386_interix_encode_section_info PARAMS ((tree, int)); + +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i386_interix_encode_section_info /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. */ + trailing @[NUM] encoded by targetm.encode_section_info. */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ do { \ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c5250f6534b..ff77510ab30 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -691,6 +691,8 @@ struct ix86_address static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *)); +static void i386_encode_section_info PARAMS ((tree, int)) ATTRIBUTE_UNUSED; + struct builtin_description; static rtx ix86_expand_sse_comi PARAMS ((const struct builtin_description *, tree, rtx)); @@ -2945,7 +2947,7 @@ local_symbolic_operand (op, mode) the compiler that assumes it can just stick the results of ASM_GENERATE_INTERNAL_LABEL in a symbol_ref and have done. */ /* ??? This is a hack. Should update the body of the compiler to - always create a DECL an invoke ENCODE_SECTION_INFO. */ + always create a DECL an invoke targetm.encode_section_info. */ if (strncmp (XSTR (op, 0), internal_label_prefix, internal_label_prefix_len) == 0) return 1; @@ -5084,6 +5086,37 @@ legitimize_pic_address (orig, reg) } return new; } + +/* If using PIC, mark a SYMBOL_REF for a non-global symbol so that we + may access it directly in the GOT. */ + +static void +i386_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (flag_pic) + { + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + ? TREE_CST_RTL (decl) : DECL_RTL (decl)); + + if (GET_CODE (rtl) == MEM) + { + if (TARGET_DEBUG_ADDR + && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd') + { + fprintf (stderr, "Encode %s, public = %d\n", + IDENTIFIER_POINTER (DECL_NAME (decl)), + TREE_PUBLIC (decl)); + } + + SYMBOL_REF_FLAG (XEXP (rtl, 0)) + = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + || ! TREE_PUBLIC (decl) + || MODULE_LOCAL_P (decl)); + } + } +} /* Try machine-dependent ways of modifying an illegitimate address to be legitimate. If we find one, return the new, valid address. diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 7ed0ddefd59..277290105e7 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2417,37 +2417,7 @@ enum ix86_builtins IX86_BUILTIN_MAX }; -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - \ - if (GET_CODE (rtl) == MEM) \ - { \ - if (TARGET_DEBUG_ADDR \ - && TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd') \ - { \ - fprintf (stderr, "Encode %s, public = %d\n", \ - IDENTIFIER_POINTER (DECL_NAME (DECL)), \ - TREE_PUBLIC (DECL)); \ - } \ - \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL) \ - || MODULE_LOCAL_P (DECL)); \ - } \ - } \ -} while (0) +#define TARGET_ENCODE_SECTION_INFO i386_encode_section_info /* The `FINALIZE_PIC' macro serves as a hook to emit these special codes once the function is being compiled into assembly code, but diff --git a/gcc/config/i386/interix.c b/gcc/config/i386/interix.c index e8caa60e605..dc9c3d6e422 100644 --- a/gcc/config/i386/interix.c +++ b/gcc/config/i386/interix.c @@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA. */ const char * gen_stdcall_suffix (decl) - tree decl; + tree decl; { int total = 0; /* ??? This probably should use XSTR (XEXP (DECL_RTL (decl), 0), 0) instead @@ -65,6 +65,26 @@ gen_stdcall_suffix (decl) return IDENTIFIER_POINTER (get_identifier (newsym)); } +void +i386_interix_encode_section_info (decl, first) + tree decl; + int first; +{ + if (flag_pic) + { + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + ? TREE_CST_RTL (decl) : DECL_RTL (decl)); + SYMBOL_REF_FLAG (XEXP (rtl, 0)) + = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + || ! TREE_PUBLIC (decl)); + } + if (first && TREE_CODE (decl) == FUNCTION_DECL) + if (lookup_attribute ("stdcall", + TYPE_ATTRIBUTES (TREE_TYPE (decl)))) + XEXP (DECL_RTL (decl), 0) = + gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (decl)); +} + #if 0 /* Turn this back on when the linker is updated to handle grouped .data$ sections correctly. See corresponding note in i386/interix.h. diff --git a/gcc/config/i386/win32.h b/gcc/config/i386/win32.h index 2119a19dc75..03ed4957775 100644 --- a/gcc/config/i386/win32.h +++ b/gcc/config/i386/win32.h @@ -102,41 +102,12 @@ Boston, MA 02111-1307, USA. */ #define NEED_ATEXIT 1 -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. - - On i386 running Windows NT, modify the assembler name with a suffix - consisting of an atsign (@) followed by string of digits that represents - the number of bytes of arguments passed to the function, if it has the - attribute STDCALL. */ - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if ((FIRST) && TREE_CODE (DECL) == FUNCTION_DECL) \ - if (lookup_attribute ("stdcall", \ - TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ - XEXP (DECL_RTL (DECL), 0) = \ - gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ - } \ -while (0) +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info /* This macro gets just the user-specified name out of the string in a SYMBOL_REF. Discard - trailing @[NUM] encoded by ENCODE_SECTION_INFO. + trailing @[NUM] encoded by targetm.encode_section_info. Do we need the stripping of leading '*'? */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 87f3c70849c..d88e7dbce73 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -367,8 +367,6 @@ gen_stdcall_suffix (decl) return IDENTIFIER_POINTER (get_identifier (newsym)); } -/* Cover function to implement ENCODE_SECTION_INFO. */ - void i386_pe_encode_section_info (decl, first) tree decl; diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 8b0d1852862..d28de455ec0 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -119,8 +119,6 @@ extern int ia64_function_arg_pass_by_reference PARAMS((CUMULATIVE_ARGS *, tree, int)); extern int ia64_return_in_memory PARAMS((tree)); extern void ia64_asm_output_external PARAMS((FILE *, tree, const char *)); - -extern void ia64_encode_section_info PARAMS((tree, int)); #endif /* TREE_CODE */ extern int ia64_register_move_cost PARAMS((enum machine_mode, enum reg_class, diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 0bbb3caf00a..f62f92a2735 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -126,6 +126,7 @@ static void emit_insn_group_barriers PARAMS ((FILE *, rtx)); static void emit_all_insn_group_barriers PARAMS ((FILE *, rtx)); static void emit_predicate_relation_info PARAMS ((void)); static bool ia64_in_small_data_p PARAMS ((tree)); +static void ia64_encode_section_info PARAMS ((tree, int)); static void process_epilogue PARAMS ((void)); static int process_set PARAMS ((FILE *, rtx)); @@ -208,6 +209,8 @@ static const struct attribute_spec ia64_attribute_table[] = #undef TARGET_IN_SMALL_DATA_P #define TARGET_IN_SMALL_DATA_P ia64_in_small_data_p +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO ia64_encode_section_info #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST ia64_adjust_cost @@ -6899,7 +6902,7 @@ ia64_in_small_data_p (exp) return false; } -void +static void ia64_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; @@ -6971,10 +6974,10 @@ ia64_encode_section_info (decl, first) XSTR (symbol, 0) = ggc_alloc_string (newstr, len); } - /* This decl is marked as being in small data/bss but it shouldn't be; - one likely explanation for this is that the decl has been moved into - a different section from the one it was in when ENCODE_SECTION_INFO - was first called. Remove the '@'. */ + /* This decl is marked as being in small data/bss but it shouldn't + be; one likely explanation for this is that the decl has been + moved into a different section from the one it was in when + targetm.encode_section_info was first called. Remove the '@'. */ else if (symbol_str[0] == SDATA_NAME_FLAG_CHAR) XSTR (symbol, 0) = ggc_strdup (symbol_str + 1); } diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 0b2aea59efd..eaa1a7d1c59 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1774,12 +1774,6 @@ do { \ #define BSS_SECTION_ASM_OP "\t.bss" -/* Define this macro if references to a symbol must be treated differently - depending on something about the variable or function named by the symbol - (such as what section it is in). */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) ia64_encode_section_info (DECL, FIRST) - #define SDATA_NAME_FLAG_CHAR '@' #define IA64_DEFAULT_GVALUE 8 diff --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h index cb8714d898e..4687e754d09 100644 --- a/gcc/config/m32r/m32r-protos.h +++ b/gcc/config/m32r/m32r-protos.h @@ -33,7 +33,6 @@ extern void m32r_finalize_pic PARAMS ((void)); extern void m32r_asm_file_start PARAMS ((FILE *)); extern int direct_return PARAMS ((void)); #ifdef TREE_CODE -extern void m32r_encode_section_info PARAMS ((tree, int)); extern enum m32r_function_type m32r_compute_function_type PARAMS ((tree)); #ifdef HAVE_MACHINE_MODES diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index a1f3c9115e0..6140d0ff10a 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -75,6 +75,7 @@ static int m32r_variable_issue PARAMS ((FILE *, int, rtx, int)); static int m32r_issue_rate PARAMS ((void)); static void m32r_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)); +static void m32r_encode_section_info PARAMS ((tree, int)); /* Initialize the GCC target structure. */ @@ -104,6 +105,9 @@ static void m32r_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)); #undef TARGET_SCHED_REORDER #define TARGET_SCHED_REORDER m32r_sched_reorder +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO m32r_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Called by OVERRIDE_OPTIONS to initialize various things. */ @@ -368,7 +372,7 @@ m32r_select_section (decl, reloc, align) large: prefixed with LARGE_FLAG_CHAR */ -void +static void m32r_encode_section_info (decl, first) tree decl; int first; diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 439ddf4708c..2d2b637e236 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1612,11 +1612,8 @@ sbss_section () \ || MEDIUM_NAME_P (SYMBOL_NAME) \ || LARGE_NAME_P (SYMBOL_NAME)) -#define ENCODE_SECTION_INFO(DECL, FIRST) m32r_encode_section_info (DECL, FIRST) - /* Decode SYM_NAME and store the real name part in VAR, sans - the characters that encode section info. Define this macro if - ENCODE_SECTION_INFO alters the symbol's name string. */ + the characters that encode section info. */ /* Note that we have to handle symbols like "%*start". */ #define STRIP_NAME_ENCODING(VAR, SYMBOL_NAME) \ do { \ @@ -1800,12 +1797,7 @@ extern char m32r_punct_chars[256]; /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is ADDR. ADDR is an RTL expression. - - On some machines, the syntax for a symbolic address depends on - the section that the address refers to. On these machines, - define the macro `ENCODE_SECTION_INFO' to store the information - into the `symbol_ref', and then check for it here. */ + reference whose address is ADDR. ADDR is an RTL expression. */ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) \ m32r_print_operand_address (FILE, ADDR) diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 36114850ca2..2feca9192aa 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -41,7 +41,6 @@ extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, enum machine_mode, tree, int)); -extern void m68hc11_encode_section_info PARAMS((tree, int)); #endif #ifdef RTX_CODE diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index f3c6a950f80..ab2b768d872 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -64,6 +64,7 @@ static int go_if_legitimate_address_internal PARAMS((rtx, enum machine_mode, int)); static int register_indirect_p PARAMS((rtx, enum machine_mode, int)); static rtx m68hc11_expand_compare PARAMS((enum rtx_code, rtx, rtx)); +static int m68hc11_autoinc_compatible_p PARAMS ((rtx, rtx)); static int must_parenthesize PARAMS ((rtx)); static int m68hc11_shift_cost PARAMS ((enum machine_mode, rtx, int)); static int m68hc11_auto_inc_p PARAMS ((rtx)); @@ -77,6 +78,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)); rtx m68hc11_soft_tmp_reg; @@ -219,6 +221,9 @@ static int nb_soft_regs; #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE m68hc11_output_function_epilogue +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO m68hc11_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; int @@ -1225,16 +1230,14 @@ m68hc11_handle_fntype_attribute (node, name, args, flags, no_add_attrs) return NULL_TREE; } -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or function - named by the symbol (such as what section it is in). +/* We want to recognize trap handlers so that we handle calls to traps + in a special manner (by issuing the trap). This information is stored + in SYMBOL_REF_FLAG. */ - For the 68HC11, we want to recognize trap handlers so that we - handle calls to traps in a special manner (by issuing the trap). - This information is stored in SYMBOL_REF_FLAG. */ -void -m68hc11_encode_section_info (decl) +static void +m68hc11_encode_section_info (decl, first) tree decl; + int first ATTRIBUTE_UNUSED; { tree func_attr; int trap_handler; diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index b81b9419c76..47a5cd83b7a 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1138,17 +1138,6 @@ typedef struct m68hc11_args m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT)) -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or function - named by the symbol (such as what section it is in). - - For the 68HC11, we want to recognize trap handlers so that we - handle calls to traps in a special manner (by issuing the trap). - This information is stored in SYMBOL_REF_FLAG. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - m68hc11_encode_section_info (DECL, FIRST) - /* `INIT_TARGET_OPTABS' Define this macro as a C statement that declares additional library routines renames existing ones. `init_optabs' calls this macro diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index bf81aff6723..de849695c36 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -1929,12 +1929,7 @@ __transfer_from_trampoline () \ /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is ADDR. ADDR is an RTL expression. - - On some machines, the syntax for a symbolic address depends on - the section that the address refers to. On these machines, - define the macro `ENCODE_SECTION_INFO' to store the information - into the `symbol_ref', and then check for it here. */ + reference whose address is ADDR. ADDR is an RTL expression. */ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 8e2c5c0832e..5fefab00790 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -73,6 +73,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)); /* Initialize the GCC target structure. */ #undef TARGET_ASM_BYTE_OP @@ -98,6 +99,9 @@ static int m88k_adjust_cost PARAMS ((rtx, rtx, rtx, int)); #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST m88k_adjust_cost +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO m88k_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Determine what instructions are needed to manufacture the integer VALUE @@ -3378,3 +3382,29 @@ m88k_adjust_cost (insn, link, dep, cost) return cost; } + +/* For the m88k, determine if the item should go in the global pool. */ + +static void +m88k_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (m88k_gp_threshold > 0) + { + if (TREE_CODE (decl) == VAR_DECL) + { + if (!TREE_READONLY (decl) || TREE_SIDE_EFFECTS (decl)) + { + 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; + } + } + 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; + } +} diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 0edec9faf4f..30c7070d36f 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -2350,36 +2350,6 @@ sdata_section () \ the text section. When we use a table of addresses, we explicitly change to the readonly data section. */ #define JUMP_TABLES_IN_TEXT_SECTION 1 - -/* Define this macro if references to a symbol must be treated differently - depending on something about the variable or function named by the - symbol (such as what section it is in). - - The macro definition, if any, is executed immediately after the rtl for - DECL has been created and stored in `DECL_RTL (DECL)'. The value of the - rtl will be a `mem' whose address is a `symbol_ref'. - - For the m88k, determine if the item should go in the global pool. */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - do { \ - if (m88k_gp_threshold > 0) \ - { \ - if (TREE_CODE (DECL) == VAR_DECL) \ - { \ - if (!TREE_READONLY (DECL) || TREE_SIDE_EFFECTS (DECL)) \ - { \ - 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; \ - } \ - } \ - 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; \ - } \ - } while (0) /* Print operand X (an rtx) in assembler syntax to file FILE. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h index 5cda48c6976..f985de4c0a2 100644 --- a/gcc/config/mcore/mcore-protos.h +++ b/gcc/config/mcore/mcore-protos.h @@ -35,8 +35,6 @@ extern int mcore_dllimport_name_p PARAMS ((const char *)); extern int mcore_naked_function_p PARAMS ((void)); #ifdef TREE_CODE -extern void mcore_encode_section_info PARAMS ((tree, int)); - #ifdef HAVE_MACHINE_MODES extern int mcore_function_arg_partial_nregs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int)); extern void mcore_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, enum machine_mode, tree, int *)); diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c index f9f5ae28ad4..61fc5bddbff 100644 --- a/gcc/config/mcore/mcore.c +++ b/gcc/config/mcore/mcore.c @@ -138,6 +138,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)); /* Initialize the GCC target structure. */ #ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES @@ -156,6 +157,8 @@ static void mcore_unique_section PARAMS ((tree, int)); #define TARGET_ATTRIBUTE_TABLE mcore_attribute_table #undef TARGET_ASM_UNIQUE_SECTION #define TARGET_ASM_UNIQUE_SECTION mcore_unique_section +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO mcore_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -3417,8 +3420,10 @@ mcore_dllimport_p (decl) return lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl)) != 0; } -/* Cover function to implement ENCODE_SECTION_INFO. */ -void +/* We must mark dll symbols specially. Definitions of dllexport'd objects + install some info in the .drective (PE) or .exports (ELF) sections. */ + +static void mcore_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h index 32ceac64ada..da9d20c57a5 100644 --- a/gcc/config/mcore/mcore.h +++ b/gcc/config/mcore/mcore.h @@ -1137,8 +1137,8 @@ switch_to_section (section, decl) \ #define MCORE_STRIP_NAME_ENCODING(SYM_NAME) \ ((SYM_NAME) + ((SYM_NAME)[0] == '@' ? 3 : 0)) -/* Strip any text from SYM_NAME added by ENCODE_SECTION_INFO and store - the result in VAR. */ +/* Strip any text from SYM_NAME added by targetm.encode_section_info + and store the result in VAR. */ #undef STRIP_NAME_ENCODING #define STRIP_NAME_ENCODING(VAR, SYM_NAME) \ (VAR) = MCORE_STRIP_NAME_ENCODING (SYM_NAME) @@ -1292,12 +1292,6 @@ extern long mcore_current_compilation_timestamp; } \ while (0) -/* We must mark dll symbols specially. Definitions of dllexport'd objects - install some info in the .drective (PE) or .exports (ELF) sections. */ -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - mcore_encode_section_info (DECL, FIRST) - /* Print operand X (an rtx) in assembler syntax to file FILE. CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified. For `%' followed by punctuation, CODE is the punctuation and X is null. */ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 05bebf48853..123028c759e 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -152,7 +152,7 @@ static void mips_unique_section PARAMS ((tree, int)) ATTRIBUTE_UNUSED; static void mips_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); - +static void mips_encode_section_info PARAMS ((tree, int)); struct machine_function { /* Pseudo-reg holding the address of the current function when @@ -579,10 +579,12 @@ enum reg_class mips_char_to_class[256] = #undef TARGET_SCHED_ADJUST_COST #define TARGET_SCHED_ADJUST_COST mips_adjust_cost - #undef TARGET_SCHED_ISSUE_RATE #define TARGET_SCHED_ISSUE_RATE mips_issue_rate +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO mips_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Return truth value of whether OP can be used as an operands @@ -5897,12 +5899,7 @@ print_operand (file, op, letter) /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is ADDR. ADDR is an RTL expression. - - On some machines, the syntax for a symbolic address depends on - the section that the address refers to. On these machines, - define the macro `ENCODE_SECTION_INFO' to store the information - into the `symbol_ref', and then check for it here. */ + reference whose address is ADDR. ADDR is an RTL expression. */ void print_operand_address (file, addr) @@ -7945,13 +7942,16 @@ mips_select_rtx_section (mode, x, align) any relocatable expression. Some of the logic used here needs to be replicated in - ENCODE_SECTION_INFO in mips.h so that references to these symbols - are done correctly. Specifically, at least all symbols assigned - here to rom (.text and/or .rodata) must not be referenced via - ENCODE_SECTION_INFO with %gprel, as the rom might be too far away. + mips_encode_section_info so that references to these symbols are + done correctly. Specifically, at least all symbols assigned here + to rom (.text and/or .rodata) must not be referenced via + mips_encode_section_info with %gprel, as the rom might be too far + away. If you need to make a change here, you probably should check - ENCODE_SECTION_INFO to see if it needs a similar change. */ + mips_encode_section_info to see if it needs a similar change. + + ??? This would be fixed by implementing targetm.is_small_data_p. */ static void mips_select_section (decl, reloc, align) @@ -8012,6 +8012,116 @@ mips_select_section (decl, reloc, align) data_section (); } } + +/* When optimizing for the $gp pointer, SYMBOL_REF_FLAG is set for all + small objects. + + When generating embedded PIC code, SYMBOL_REF_FLAG is set for + symbols which are not in the .text section. + + When generating mips16 code, SYMBOL_REF_FLAG is set for string + constants which are put in the .text section. We also record the + total length of all such strings; this total is used to decide + whether we need to split the constant table, and need not be + precisely correct. + + When not mips16 code nor embedded PIC, if a symbol is in a + gp addresable section, SYMBOL_REF_FLAG is set prevent gcc from + splitting the reference so that gas can generate a gp relative + reference. + + When TARGET_EMBEDDED_DATA is set, we assume that all const + variables will be stored in ROM, which is too far from %gp to use + %gprel addressing. Note that (1) we include "extern const" + variables in this, which mips_select_section doesn't, and (2) we + can't always tell if they're really const (they might be const C++ + objects with non-const constructors), so we err on the side of + caution and won't use %gprel anyway (otherwise we'd have to defer + this decision to the linker/loader). The handling of extern consts + is why the DECL_INITIAL macros differ from mips_select_section. */ + +static void +mips_encode_section_info (decl, first) + tree decl; + int first; +{ + if (TARGET_MIPS16) + { + if (first && TREE_CODE (decl) == STRING_CST + && ! flag_writable_strings + /* If this string is from a function, and the function will + go in a gnu linkonce section, then we can't directly + access the string. This gets an assembler error + "unsupported PC relative reference to different section". + If we modify SELECT_SECTION to put it in function_section + instead of text_section, it still fails because + DECL_SECTION_NAME isn't set until assemble_start_function. + If we fix that, it still fails because strings are shared + among multiple functions, and we have cross section + references again. We force it to work by putting string + addresses in the constant pool and indirecting. */ + && (! current_function_decl + || ! DECL_ONE_ONLY (current_function_decl))) + { + SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (decl), 0)) = 1; + mips_string_length += TREE_STRING_LENGTH (decl); + } + } + + if (TARGET_EMBEDDED_DATA + && (TREE_CODE (decl) == VAR_DECL + && TREE_READONLY (decl) && !TREE_SIDE_EFFECTS (decl)) + && (!DECL_INITIAL (decl) + || TREE_CONSTANT (DECL_INITIAL (decl)))) + { + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 0; + } + + else if (TARGET_EMBEDDED_PIC) + { + if (TREE_CODE (decl) == VAR_DECL) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; + else if (TREE_CODE (decl) == FUNCTION_DECL) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 0; + else if (TREE_CODE (decl) == STRING_CST + && ! flag_writable_strings) + SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (decl), 0)) = 0; + else + SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (decl), 0)) = 1; + } + + else if (TREE_CODE (decl) == VAR_DECL + && DECL_SECTION_NAME (decl) != NULL_TREE + && (0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), + ".sdata") + || 0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), + ".sbss"))) + { + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; + } + + /* We can not perform GP optimizations on variables which are in + specific sections, except for .sdata and .sbss which are + handled above. */ + else if (TARGET_GP_OPT && TREE_CODE (decl) == VAR_DECL + && DECL_SECTION_NAME (decl) == NULL_TREE + && ! (TARGET_MIPS16 && TREE_PUBLIC (decl) + && (DECL_COMMON (decl) + || DECL_ONE_ONLY (decl) + || DECL_WEAK (decl)))) + { + 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; + } + + else if (HALF_PIC_P ()) + { + if (first) + HALF_PIC_ENCODE (decl); + } +} /* Return register to use for a function return value with VALTYPE for function FUNC. MODE is used instead of VALTYPE for LIBCALLs. */ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index aab99807d4f..e18cf2f8d33 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3054,53 +3054,7 @@ typedef struct mips_args { /* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target - machine for a memory operand of mode MODE. - - It usually pays to define several simpler macros to serve as - subroutines for this one. Otherwise it may be too complicated - to understand. - - This macro must exist in two variants: a strict variant and a - non-strict one. The strict variant is used in the reload pass. - It must be defined so that any pseudo-register that has not been - allocated a hard register is considered a memory reference. In - contexts where some kind of register is required, a - pseudo-register with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be - defined to accept all pseudo-registers in every context where - some kind of register is required. - - Compiler source files that want to use the strict variant of - this macro define the macro `REG_OK_STRICT'. You should use an - `#ifdef REG_OK_STRICT' conditional to define the strict variant - in that case and the non-strict variant otherwise. - - Typically among the subroutines used to define - `GO_IF_LEGITIMATE_ADDRESS' are subroutines to check for - acceptable registers for various purposes (one for base - registers, one for index registers, and so on). Then only these - subroutine macros need have two variants; the higher levels of - macros may be the same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' - and an integer are stored inside a `const' RTX to mark them as - constant. Therefore, there is no need to recognize such sums - specifically as legitimate addresses. Normally you would simply - recognize any `const' as legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle - constant sums that are not marked with `const'. It assumes - that a naked `plus' indicates indexing. If so, then you *must* - reject such naked constant sums as illegitimate addresses, so - that none of them will be given to `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate - depends on the section that the address refers to. On these - machines, define the macro `ENCODE_SECTION_INFO' to store the - information into the `symbol_ref', and then check for it here. - When you see a `const', you will have to look inside it to find - the `symbol_ref' in order to determine the section. */ + machine for a memory operand of mode MODE. */ #if 1 #define GO_PRINTF(x) fprintf(stderr, (x)) @@ -3306,143 +3260,6 @@ typedef struct mips_args { #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) {} - -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - The macro definition, if any, is executed immediately after the - rtl for DECL has been created and stored in `DECL_RTL (DECL)'. - The value of the rtl will be a `mem' whose address is a - `symbol_ref'. - - The usual thing for this macro to do is to a flag in the - `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified - name string in the `symbol_ref' (if one bit is not enough - information). - - The best way to modify the name string is by adding text to the - beginning, with suitable punctuation to prevent any ambiguity. - Allocate the new name in `saveable_obstack'. You will have to - modify `ASM_OUTPUT_LABELREF' to remove and decode the added text - and output the name accordingly. - - You can also check the information stored in the `symbol_ref' in - the definition of `GO_IF_LEGITIMATE_ADDRESS' or - `PRINT_OPERAND_ADDRESS'. - - When optimizing for the $gp pointer, SYMBOL_REF_FLAG is set for all - small objects. - - When generating embedded PIC code, SYMBOL_REF_FLAG is set for - symbols which are not in the .text section. - - When generating mips16 code, SYMBOL_REF_FLAG is set for string - constants which are put in the .text section. We also record the - total length of all such strings; this total is used to decide - whether we need to split the constant table, and need not be - precisely correct. - - When not mips16 code nor embedded PIC, if a symbol is in a - gp addresable section, SYMBOL_REF_FLAG is set prevent gcc from - splitting the reference so that gas can generate a gp relative - reference. - - When TARGET_EMBEDDED_DATA is set, we assume that all const - variables will be stored in ROM, which is too far from %gp to use - %gprel addressing. Note that (1) we include "extern const" - variables in this, which mips_select_section doesn't, and (2) we - can't always tell if they're really const (they might be const C++ - objects with non-const constructors), so we err on the side of - caution and won't use %gprel anyway (otherwise we'd have to defer - this decision to the linker/loader). The handling of extern consts - is why the DECL_INITIAL macros differ from mips_select_section. - - If you are changing this macro, you should look at - mips_select_section and see if it needs a similar change. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { \ - if (TARGET_MIPS16) \ - { \ - if ((FIRST) && TREE_CODE (DECL) == STRING_CST \ - && ! flag_writable_strings \ - /* If this string is from a function, and the function will \ - go in a gnu linkonce section, then we can't directly \ - access the string. This gets an assembler error \ - "unsupported PC relative reference to different section".\ - If we modify SELECT_SECTION to put it in function_section\ - instead of text_section, it still fails because \ - DECL_SECTION_NAME isn't set until assemble_start_function.\ - If we fix that, it still fails because strings are shared\ - among multiple functions, and we have cross section \ - references again. We force it to work by putting string \ - addresses in the constant pool and indirecting. */ \ - && (! current_function_decl \ - || ! DECL_ONE_ONLY (current_function_decl))) \ - { \ - SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \ - mips_string_length += TREE_STRING_LENGTH (DECL); \ - } \ - } \ - \ - if (TARGET_EMBEDDED_DATA \ - && (TREE_CODE (DECL) == VAR_DECL \ - && TREE_READONLY (DECL) && !TREE_SIDE_EFFECTS (DECL)) \ - && (!DECL_INITIAL (DECL) \ - || TREE_CONSTANT (DECL_INITIAL (DECL)))) \ - { \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 0; \ - } \ - \ - else if (TARGET_EMBEDDED_PIC) \ - { \ - if (TREE_CODE (DECL) == VAR_DECL) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - else if (TREE_CODE (DECL) == FUNCTION_DECL) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 0; \ - else if (TREE_CODE (DECL) == STRING_CST \ - && ! flag_writable_strings) \ - SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 0; \ - else \ - SYMBOL_REF_FLAG (XEXP (TREE_CST_RTL (DECL), 0)) = 1; \ - } \ - \ - else if (TREE_CODE (DECL) == VAR_DECL \ - && DECL_SECTION_NAME (DECL) != NULL_TREE \ - && (0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (DECL)), \ - ".sdata") \ - || 0 == strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (DECL)),\ - ".sbss"))) \ - { \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - } \ - \ - /* We can not perform GP optimizations on variables which are in \ - specific sections, except for .sdata and .sbss which are \ - handled above. */ \ - else if (TARGET_GP_OPT && TREE_CODE (DECL) == VAR_DECL \ - && DECL_SECTION_NAME (DECL) == NULL_TREE \ - && ! (TARGET_MIPS16 && TREE_PUBLIC (DECL) \ - && (DECL_COMMON (DECL) \ - || DECL_ONE_ONLY (DECL) \ - || DECL_WEAK (DECL)))) \ - { \ - 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; \ - } \ - \ - else if (HALF_PIC_P ()) \ - { \ - if (FIRST) \ - HALF_PIC_ENCODE (DECL); \ - } \ - } \ -while (0) - /* This handles the magic '..CURRENT_FUNCTION' symbol, which means 'the start of the function that this code is output in'. */ @@ -4383,12 +4200,7 @@ while (0) /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is ADDR. ADDR is an RTL expression. - - On some machines, the syntax for a symbolic address depends on - the section that the address refers to. On these machines, - define the macro `ENCODE_SECTION_INFO' to store the information - into the `symbol_ref', and then check for it here. */ + reference whose address is ADDR. ADDR is an RTL expression. */ #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address (FILE, ADDR) diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h index cc81308c9b6..baa0849480a 100644 --- a/gcc/config/mmix/mmix-protos.h +++ b/gcc/config/mmix/mmix-protos.h @@ -74,7 +74,6 @@ extern int mmix_constant_alignment PARAMS ((tree, int)); extern int mmix_local_alignment PARAMS ((tree, int)); extern void mmix_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, enum machine_mode, tree, int *, int)); -extern void mmix_encode_section_info PARAMS ((tree, int)); extern void mmix_asm_output_pool_prologue PARAMS ((FILE *, const char *, tree, int)); extern void mmix_asm_output_aligned_common diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 40bd94f8d74..d798fa91031 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -98,6 +98,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 void mmix_init_machine_status PARAMS ((struct function *)); +static void mmix_encode_section_info PARAMS ((tree, int)); extern void mmix_target_asm_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); @@ -127,6 +128,9 @@ extern void mmix_target_asm_function_epilogue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE mmix_target_asm_function_epilogue +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO mmix_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Functions that are expansions for target macros. @@ -1713,9 +1717,7 @@ mmix_data_section_asm_op () return "\t.data ! mmixal:= 8H LOC 9B"; } -/* ENCODE_SECTION_INFO. */ - -void +static void mmix_encode_section_info (decl, first) tree decl; int first; diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 80e928b42b5..9eb968b74bf 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -907,9 +907,6 @@ typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS; #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata" -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - mmix_encode_section_info (DECL, FIRST) - #define STRIP_NAME_ENCODING(VAR, SYM_NAME) \ (VAR) = mmix_strip_name_encoding (SYM_NAME) diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c index 8c980c577b3..5c5252cbf02 100644 --- a/gcc/config/ns32k/ns32k.c +++ b/gcc/config/ns32k/ns32k.c @@ -69,6 +69,7 @@ static tree ns32k_handle_fntype_attribute PARAMS ((tree *, tree, tree, int, bool const struct attribute_spec ns32k_attribute_table[]; static void ns32k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void ns32k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); +static void ns32k_encode_section_info PARAMS ((tree, int)); /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE @@ -86,6 +87,8 @@ static void ns32k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); #define TARGET_ASM_FUNCTION_PROLOGUE ns32k_output_function_prologue #undef TARGET_ASM_FUNCTION_EPILOGUE #define TARGET_ASM_FUNCTION_EPILOGUE ns32k_output_function_epilogue +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO ns32k_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -1552,3 +1555,21 @@ output_move_dconst (n, s) strcat (r, s); return r; } + +/* If using PIC, mark a SYMBOL_REF for a non-global symbol or a code + symbol. These symbols are referenced via pc and not via sb. */ + +static void +ns32k_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (flag_pic) + { + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + ? TREE_CST_RTL (decl) : DECL_RTL (decl)); + SYMBOL_REF_FLAG (XEXP (rtl, 0)) + = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + || ! TREE_PUBLIC (decl)); + } +} diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index 04bf0b2e949..f8a3cba80db 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -1046,29 +1046,6 @@ __transfer_from_trampoline () \ || GET_CODE (X) == LABEL_REF \ || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X))) -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On the ns32k, if using PIC, mark a SYMBOL_REF for a non-global - symbol or a code symbol. These symbols are referenced via pc - and not via sb. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { \ - extern int flag_pic; \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - } \ -while (0) - /* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. On the ns32k, only predecrement and postincrement address depend thus diff --git a/gcc/config/pa/elf.h b/gcc/config/pa/elf.h index db2f20fe969..e5b7478154e 100644 --- a/gcc/config/pa/elf.h +++ b/gcc/config/pa/elf.h @@ -85,9 +85,9 @@ do { \ "imported", even library calls. They look a bit different, so here's this macro. - Also note not all libcall names are passed to ENCODE_SECTION_INFO - (__main for example). To make sure all libcall names have section - info recorded in them, we do it here. */ + Also note not all libcall names are passed to + targetm.encode_section_info (__main for example). To make sure all + libcall names have section info recorded in them, we do it here. */ #undef ASM_OUTPUT_EXTERNAL_LIBCALL #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, RTL) \ diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index babf1a86e01..d12c1be910a 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -116,6 +116,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)); /* Save the operands last given to a compare for use when we generate a scc or bcc insn. */ @@ -185,6 +186,9 @@ int n_deferred_plabels = 0; #undef TARGET_SCHED_ISSUE_RATE #define TARGET_SCHED_ISSUE_RATE pa_issue_rate +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO pa_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -1828,8 +1832,9 @@ reloc_needed (exp) return reloc; } -/* Does operand (which is a symbolic_operand) live in text space? If - so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true. */ +/* Does operand (which is a symbolic_operand) live in text space? + If so, SYMBOL_REF_FLAG, which is set by pa_encode_section_info, + will be true. */ int read_only_operand (operand, mode) @@ -6436,6 +6441,25 @@ hppa_encode_label (sym) XSTR (sym, 0) = ggc_alloc_string (newstr, len); } +static void +pa_encode_section_info (decl, first) + tree decl; + 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)); + } +} + int function_label_operand (op, mode) rtx op; diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index fbab5b73ae5..55e4311b1a3 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -1522,24 +1522,8 @@ do { \ #define FUNCTION_NAME_P(NAME) (*(NAME) == '@') -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { 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));\ - } \ - } \ -while (0) - /* Store the user-specified part of SYMBOL_NAME in VAR. - This is sort of inverse to ENCODE_SECTION_INFO. */ + This is sort of inverse to targetm.encode_section_info. */ #define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME) \ (VAR) = ((SYMBOL_NAME) \ diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index 062fff756f7..7c17ff6b810 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -322,7 +322,7 @@ readonly_data () \ "imported", even library calls. They look a bit different, so here's this macro. - Also note not all libcall names are passed to ENCODE_SECTION_INFO + Also note not all libcall names are passed to pa_encode_section_info (__main for example). To make sure all libcall names have section info recorded in them, we do it here. We must also ensure that we don't import a libcall that has been previously exported since diff --git a/gcc/config/romp/romp.c b/gcc/config/romp/romp.c index 003495c0b25..f60fcde5688 100644 --- a/gcc/config/romp/romp.c +++ b/gcc/config/romp/romp.c @@ -55,6 +55,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)); /* Initialize the GCC target structure. */ #undef TARGET_ASM_FUNCTION_PROLOGUE @@ -63,6 +64,8 @@ static void romp_select_rtx_section PARAMS ((enum machine_mode, rtx, #define TARGET_ASM_FUNCTION_EPILOGUE romp_output_function_epilogue #undef TARGET_ASM_SELECT_RTX_SECTION #define TARGET_ASM_SELECT_RTX_SECTION romp_select_rtx_section +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO romp_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -2083,3 +2086,16 @@ romp_select_rtx_section (mode, x, align) { data section (); } + +/* For no good reason, we do the same as the other RT compilers and load + the addresses of data areas for a function from our data area. That means + that we need to mark such SYMBOL_REFs. We do so here. */ + +static void +romp_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (TREE_CODE (TREE_TYPE (decl)) == FUNCTION_TYPE) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} diff --git a/gcc/config/romp/romp.h b/gcc/config/romp/romp.h index fb8cd3587bf..2b1674175b5 100644 --- a/gcc/config/romp/romp.h +++ b/gcc/config/romp/romp.h @@ -904,13 +904,6 @@ struct rt_cargs {int gregs, fregs; }; || GET_CODE (X) == CONST_DOUBLE) \ && ! (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_FLAG (X))) -/* For no good reason, we do the same as the other RT compilers and load - the addresses of data areas for a function from our data area. That means - that we need to mark such SYMBOL_REFs. We do so here. */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - if (TREE_CODE (TREE_TYPE (DECL)) == FUNCTION_TYPE) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; - /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. We have two alternate definitions for each of them. diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 109985998bc..012aecbb6f9 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -212,17 +212,8 @@ Boston, MA 02111-1307, USA. */ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -/* If we are referencing a function that is static or is known to be - in this file, make the SYMBOL_REF special. We can use this to indicate - that we can branch to this function without emitting a no-op after the - call. Do not set this flag if the function is weakly defined. */ - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - if (TREE_CODE (DECL) == FUNCTION_DECL \ - && (TREE_ASM_WRITTEN (DECL) || ! TREE_PUBLIC (DECL)) \ - && ! DECL_WEAK (DECL)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info /* This is how to output a reference to a user-level label named NAME. `assemble_name' uses this. */ diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index 18c03abb558..8d9d12eb81a 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -145,7 +145,6 @@ extern void setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, int *, int)); extern struct rtx_def *rs6000_va_arg PARAMS ((tree, tree)); extern void output_mi_thunk PARAMS ((FILE *, tree, int, tree)); -extern void rs6000_encode_section_info PARAMS ((tree, int)); #ifdef ARGS_SIZE_RTX /* expr.h defines ARGS_SIZE_RTX and `enum direction' */ extern enum direction function_arg_padding PARAMS ((enum machine_mode, tree)); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 49fa94e575f..e6e8ef93a54 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -168,6 +168,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)); #endif #ifdef OBJECT_FORMAT_COFF static void xcoff_asm_named_section PARAMS ((const char *, unsigned int)); @@ -177,6 +178,8 @@ static void rs6000_xcoff_unique_section PARAMS ((tree, int)); static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); #endif +static void rs6000_xcoff_encode_section_info PARAMS ((tree, int)) + ATTRIBUTE_UNUSED; static int rs6000_adjust_cost PARAMS ((rtx, rtx, rtx, int)); static int rs6000_adjust_priority PARAMS ((rtx, int)); static int rs6000_issue_rate PARAMS ((void)); @@ -11091,8 +11094,8 @@ rs6000_elf_unique_section (decl, reloc) the function descriptor name. This saves a lot of overriding code to read the prefixes. */ -void -rs6000_encode_section_info (decl, first) +static void +rs6000_elf_encode_section_info (decl, first) tree decl; int first; { @@ -11684,6 +11687,12 @@ rs6000_xcoff_unique_section (decl, reloc) } } +/* Select section for constant in constant pool. + + On RS/6000, all constants are in the private read-only data area. + However, if this is being placed in the TOC it must be output as a + toc entry. */ + static void rs6000_xcoff_select_rtx_section (mode, x, align) enum machine_mode mode; @@ -11696,3 +11705,16 @@ rs6000_xcoff_select_rtx_section (mode, x, align) read_only_private_data_section (); } #endif /* OBJECT_FORMAT_COFF */ + +/* Note that this is also used for ELF64. */ + +static void +rs6000_xcoff_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (TREE_CODE (decl) == FUNCTION_DECL + && (TREE_ASM_WRITTEN (decl) || ! TREE_PUBLIC (decl)) + && ! DECL_WEAK (decl)) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 41bce4c5efc..0c601d05a44 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -776,17 +776,8 @@ extern int fixuplabelno; /* Historically we have also supported stabs debugging. */ #define DBX_DEBUGGING_INFO -/* If we are referencing a function that is static or is known to be - in this file, make the SYMBOL_REF special. We can use this to indicate - that we can branch to this function without emitting a no-op after the - call. For real AIX calling sequences, we also replace the - function name with the real name (1 or 2 leading .'s), rather than - the function descriptor name. This saves a lot of overriding code - to read the prefixes. */ - -#undef ENCODE_SECTION_INFO -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - rs6000_encode_section_info (DECL, FIRST) +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info /* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index 2c089bdf69d..211e1fc4c6f 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -161,24 +161,8 @@ toc_section () \ || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ && ! TARGET_NO_FP_IN_TOC))))) -/* Select section for constant in constant pool. - - On RS/6000, all constants are in the private read-only data area. - However, if this is being placed in the TOC it must be output as a - toc entry. */ - #define TARGET_ASM_SELECT_RTX_SECTION rs6000_xcoff_select_rtx_section - -/* If we are referencing a function that is static or is known to be - in this file, make the SYMBOL_REF special. We can use this to indicate - that we can branch to this function without emitting a no-op after the - call. Do not set this flag if the function is weakly defined. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - if (TREE_CODE (DECL) == FUNCTION_DECL \ - && !TREE_PUBLIC (DECL) \ - && !DECL_WEAK (DECL)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; +#define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info /* FP save and restore routines. */ #define SAVE_FP_PREFIX "._savef" diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 51fe26d3c77..54bb588d06b 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -52,6 +52,7 @@ static int s390_adjust_cost PARAMS ((rtx, rtx, rtx, int)); static int s390_adjust_priority PARAMS ((rtx, 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)); #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.word\t" @@ -81,6 +82,9 @@ static void s390_select_rtx_section PARAMS ((enum machine_mode, rtx, #undef TARGET_SCHED_ADJUST_PRIORITY #define TARGET_SCHED_ADJUST_PRIORITY s390_adjust_priority +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO s390_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; extern int reload_completed; @@ -3933,3 +3937,25 @@ s390_select_rtx_section (mode, x, align) else function_section (current_function_decl); } + +/* If using PIC, mark a SYMBOL_REF for a non-global symbol so that we + may access it directly in the GOT. */ + +static void +s390_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (flag_pic) + { + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + ? TREE_CST_RTL (decl) : DECL_RTL (decl)); + + if (GET_CODE (rtl) == MEM) + { + SYMBOL_REF_FLAG (XEXP (rtl, 0)) + = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + || ! TREE_PUBLIC (decl)); + } + } +} diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index b50951a9a41..0c6eb5ef86c 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -391,32 +391,6 @@ do \ #define CLASS_CANNOT_CHANGE_MODE_P(FROM,TO) \ (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO)) -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or - function named by the symbol (such as what section it is in). - - On s390, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it directly in the GOT. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - \ - if (GET_CODE (rtl) == MEM) \ - { \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ - = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || ! TREE_PUBLIC (DECL)); \ - } \ - } \ - } \ -while (0) - - /* This is an array of structures. Each structure initializes one pair of eliminable registers. The "from" register number is given first, followed by "to". Eliminations of the same "from" register are listed diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 07bf6cf3fa6..b84f6220a9e 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -201,8 +201,9 @@ static int sh_use_dfa_interface PARAMS ((void)); static int sh_issue_rate PARAMS ((void)); static bool sh_cannot_modify_jumps_p PARAMS ((void)); - static bool sh_ms_bitfield_layout_p PARAMS ((tree)); + +static void sh_encode_section_info PARAMS ((tree, int)); /* Initialize the GCC target structure. */ #undef TARGET_ATTRIBUTE_TABLE @@ -6787,3 +6788,35 @@ sh_ms_bitfield_layout_p (record_type) { return TARGET_SH5; } + +/* If using PIC, mark a SYMBOL_REF for a non-global symbol so that we + may access it using GOTOFF instead of GOT. */ + +static void +sh_encode_section_info (decl, first) + tree decl; + int first; +{ + rtx rtl, symbol; + + if (DECL_P (decl)) + rtl = DECL_RTL (decl); + else + rtl = TREE_CST_RTL (decl); + if (GET_CODE (rtl) != MEM) + return; + symbol = XEXP (rtl, 0); + if (GET_CODE (symbol) != SYMBOL_REF) + return; + + if (flag_pic) + { + SYMBOL_REF_FLAG (symbol) = + (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd' + || MODULE_LOCAL_P (decl) + || ! TREE_PUBLIC (decl)); + } + + if (TARGET_SH5 && first && TREE_CODE (decl) != FUNCTION_DECL) + XEXP (rtl, 0) = gen_datalabel_ref (symbol); +} diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 28ea02b946d..084287424de 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2666,42 +2666,6 @@ while (0) /* Position Independent Code. */ -/* Define this macro if references to a symbol must be treated - differently depending on something about the variable or function - named by the symbol (such as what section it is in). - - On SH, if using PIC, mark a SYMBOL_REF for a non-global symbol - so that we may access it using GOTOFF instead of GOT. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ -do \ - { \ - if (!(FIRST)) \ - break; \ - if (flag_pic) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ - \ - SYMBOL_REF_FLAG (XEXP (rtl, 0)) = \ - (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - || MODULE_LOCAL_P (DECL) \ - || ! TREE_PUBLIC (DECL)); \ - } \ - if (TARGET_SH5) \ - { \ - rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ - ? TREE_CST_RTL (DECL) \ - : TREE_CODE (DECL) != VAR_DECL \ - ? NULL_RTX \ - : DECL_RTL (DECL)); \ - \ - if (rtl && GET_CODE (rtl) == MEM \ - && GET_CODE (XEXP (rtl, 0)) == SYMBOL_REF) \ - XEXP (rtl, 0) = gen_datalabel_ref (XEXP (rtl, 0)); \ - } \ - } \ -while (0) /* The prefix used to mark SYMBOL_REFs that refer to data symbols. */ #define SH_DATALABEL_ENCODING "#" diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 3444ffc0598..fd1cd65d424 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -175,6 +175,8 @@ static void emit_soft_tfmode_binop PARAMS ((enum rtx_code, rtx *)); static void emit_soft_tfmode_unop PARAMS ((enum rtx_code, rtx *)); static void emit_soft_tfmode_cvt PARAMS ((enum rtx_code, rtx *)); static void emit_hard_tfmode_operation PARAMS ((enum rtx_code, rtx *)); + +static void sparc_encode_section_info PARAMS ((tree, int)); /* Option handling. */ @@ -235,6 +237,9 @@ enum processor_type sparc_cpu; #undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD #define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD sparc_use_sched_lookahead +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO sparc_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Validate and override various options, and do some machine dependent @@ -8456,3 +8461,16 @@ sparc_rtx_costs (x, code, outer_code) abort(); }; } + +/* If we are referencing a function make the SYMBOL_REF special. In + the Embedded Medium/Anywhere code model, %g4 points to the data + segment so we must not add it to function addresses. */ + +static void +sparc_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (TARGET_CM_EMBMEDANY && TREE_CODE (decl) == FUNCTION_DECL) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index ad19d6ba082..8af36e3551c 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2405,16 +2405,6 @@ do { \ On the SPARC this is never true. */ #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL) - -/* If we are referencing a function make the SYMBOL_REF special. - In the Embedded Medium/Anywhere code model, %g4 points to the data segment - so we must not add it to function addresses. */ - -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - do { \ - if (TARGET_CM_EMBMEDANY && TREE_CODE (DECL) == FUNCTION_DECL) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - } while (0) /* Specify the machine mode that this machine uses for the index in the tablejump instruction. */ diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h index fdae8a466a9..a181a36e255 100644 --- a/gcc/config/stormy16/stormy16-protos.h +++ b/gcc/config/stormy16/stormy16-protos.h @@ -38,7 +38,6 @@ extern CUMULATIVE_ARGS xstormy16_function_arg_advance extern void xstormy16_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS, int, tree, int *)); extern tree xstormy16_build_va_list PARAMS ((void)); -extern void xstormy16_encode_section_info PARAMS ((tree, int)); #endif #if defined (TREE_CODE) && defined (RTX_CODE) diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index db809d67c3f..35977e7f2ac 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -49,6 +49,7 @@ Boston, MA 02111-1307, USA. */ static rtx emit_addhi3_postreload PARAMS ((rtx, rtx, rtx)); static void xstormy16_asm_out_constructor PARAMS ((rtx, int)); static void xstormy16_asm_out_destructor PARAMS ((rtx, int)); +static void xstormy16_encode_section_info PARAMS ((tree, int)); /* Define the information needed to generate branch and scc insns. This is stored from the compare operation. */ @@ -1394,7 +1395,7 @@ xstormy16_asm_output_mi_thunk (file, thunk_fndecl, delta, function) /* Mark functions with SYMBOL_REF_FLAG. */ -void +static void xstormy16_encode_section_info (decl, first) tree decl; int first ATTRIBUTE_UNUSED; @@ -2021,5 +2022,7 @@ xstormy16_handle_interrupt_attribute (node, name, args, flags, no_add_attrs) #define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" #undef TARGET_ASM_ALIGNED_SI_OP #define TARGET_ASM_ALIGNED_SI_OP "\t.word\t" +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO xstormy16_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index 880638b50ac..7ae92ee5413 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -2058,59 +2058,7 @@ typedef int CUMULATIVE_ARGS; /* A C compound statement with a conditional `goto LABEL;' executed if X (an RTX) is a legitimate memory address on the target machine for a memory - operand of mode MODE. - - It usually pays to define several simpler macros to serve as subroutines for - this one. Otherwise it may be too complicated to understand. - - This macro must exist in two variants: a strict variant and a non-strict - one. The strict variant is used in the reload pass. It must be defined so - that any pseudo-register that has not been allocated a hard register is - considered a memory reference. In contexts where some kind of register is - required, a pseudo-register with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be defined to - accept all pseudo-registers in every context where some kind of register is - required. - - Compiler source files that want to use the strict variant of this macro - define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' - conditional to define the strict variant in that case and the non-strict - variant otherwise. - - Subroutines to check for acceptable registers for various purposes (one for - base registers, one for index registers, and so on) are typically among the - subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these - subroutine macros need have two variants; the higher levels of macros may be - the same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' and an - integer are stored inside a `const' RTX to mark them as constant. - Therefore, there is no need to recognize such sums specifically as - legitimate addresses. Normally you would simply recognize any `const' as - legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that - are not marked with `const'. It assumes that a naked `plus' indicates - indexing. If so, then you *must* reject such naked constant sums as - illegitimate addresses, so that none of them will be given to - `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate depends on the - section that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. When you see a `const', you will have to look - inside it to find the `symbol_ref' in order to determine the section. - - The best way to modify the name string is by adding text to the beginning, - with suitable punctuation to prevent any ambiguity. Allocate the new name - in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to - remove and decode the added text and output the name accordingly, and define - `STRIP_NAME_ENCODING' to access the original name string. - - You can check the information stored here into the `symbol_ref' in the - definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and - `PRINT_OPERAND_ADDRESS'. */ + operand of mode MODE. */ #ifdef REG_OK_STRICT #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ do { \ @@ -2542,23 +2490,8 @@ do { \ This macro is irrelevant if there is no separate readonly data section. */ #define JUMP_TABLES_IN_TEXT_SECTION 1 -/* Define this macro if references to a symbol must be treated differently - depending on something about the variable or function named by the symbol - (such as what section it is in). - - The macro definition, if any, is executed immediately after the rtl for DECL - has been created and stored in `DECL_RTL (DECL)'. The value of the rtl will - be a `mem' whose address is a `symbol_ref'. - - The usual thing for this macro to do is to record a flag in the `symbol_ref' - (such as `SYMBOL_REF_FLAG') or to store a modified name string in the - `symbol_ref' (if one bit is not enough information). */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - xstormy16_encode_section_info(DECL, FIRST) - /* Decode SYM_NAME and store the real name part in VAR, sans the characters - that encode section info. Define this macro if `ENCODE_SECTION_INFO' alters - the symbol's name string. */ + that encode section info. */ /* #define STRIP_NAME_ENCODING(VAR, SYM_NAME) */ /* Position Independent Code. */ @@ -3318,14 +3251,7 @@ do { \ /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory reference whose address is X. X - is an RTL expression. - - On some machines, the syntax for a symbolic address depends on the section - that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. - - This declaration must be present. */ + is an RTL expression. */ #define PRINT_OPERAND_ADDRESS(STREAM, X) xstormy16_print_operand_address (STREAM, X) /* A C statement, to be executed after all slot-filler instructions have been diff --git a/gcc/config/v850/v850-protos.h b/gcc/config/v850/v850-protos.h index a6fb8b92694..05b740adfd0 100644 --- a/gcc/config/v850/v850-protos.h +++ b/gcc/config/v850/v850-protos.h @@ -72,7 +72,6 @@ extern rtx v850_va_arg PARAMS ((tree, tree)); #endif /* TREE_CODE */ #ifdef TREE_CODE -extern void v850_encode_data_area PARAMS ((tree)); extern int v850_interrupt_function_p PARAMS ((tree)); extern void v850_output_aligned_bss PARAMS ((FILE *, tree, const char *, int, int)); extern void v850_output_common PARAMS ((FILE *, tree, const char *, int, int)); diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 72129d3868d..df4d0031765 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -59,6 +59,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)); /* True if the current function has anonymous arguments. */ int current_function_anonymous_args; @@ -100,6 +102,9 @@ static int v850_interrupt_p = FALSE; #undef TARGET_ASM_SELECT_SECTION #define TARGET_ASM_SELECT_SECTION v850_select_section +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO v850_encode_section_info + struct gcc_target targetm = TARGET_INITIALIZER; /* Sometimes certain combinations of command options do not make @@ -2142,7 +2147,7 @@ v850_interrupt_function_p (func) } -void +static void v850_encode_data_area (decl) tree decl; { @@ -2203,6 +2208,16 @@ v850_encode_data_area (decl) XSTR (XEXP (DECL_RTL (decl), 0), 0) = ggc_alloc_string (newstr, len + 2); } +static void +v850_encode_section_info (decl, first) + tree decl; + int first; +{ + if (first && TREE_CODE (decl) == VAR_DECL + && (TREE_STATIC (decl) || DECL_EXTERNAL (decl))) + v850_encode_data_area (decl); +} + /* Return true if the given RTX is a register which can be restored by a function epilogue. */ int diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index e20e05659f8..54a1bec6324 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -1414,15 +1414,6 @@ extern union tree_node * GHS_current_section_names [(int) COUNT_OF_GHS_SECTION_K #define EP_REGNUM 30 /* ep register number */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - do \ - { \ - if ((FIRST) && TREE_CODE (DECL) == VAR_DECL \ - && (TREE_STATIC (DECL) || DECL_EXTERNAL (DECL))) \ - v850_encode_data_area (DECL); \ - } \ - while (0) - #define ZDA_NAME_FLAG_CHAR '@' #define TDA_NAME_FLAG_CHAR '%' #define SDA_NAME_FLAG_CHAR '&' diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index fc1d9fa5b10..721e9fe2da3 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA. */ #include "tree.h" #include "recog.h" #include "expr.h" +#include "flags.h" #include "tm_p.h" #include "target.h" #include "target-def.h" @@ -43,6 +44,7 @@ static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void vms_asm_out_constructor PARAMS ((rtx, int)); static void vms_asm_out_destructor PARAMS ((rtx, int)); static void vms_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)); +static void vms_encode_section_info PARAMS ((tree, int)); #endif /* Initialize the GCC target structure. */ @@ -55,6 +57,8 @@ static void vms_select_section PARAMS ((tree, int, unsigned HOST_WIDE_INT)); #if VMS_TARGET #undef TARGET_ASM_SELECT_SECTION #define TARGET_ASM_SELECT_SECTION vms_select_section +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO vms_encode_section_info #endif struct gcc_target targetm = TARGET_INITIALIZER; @@ -879,7 +883,7 @@ vms_asm_out_destructor (symbol, priority) } static void -vax_select_section (exp, reloc, align) +vms_select_section (exp, reloc, align) tree exp; int reloc ATTRIBUTE_UNUSED; unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; @@ -907,6 +911,18 @@ vax_select_section (exp, reloc, align) text_section (); } } + +/* Make sure that external variables are correctly addressed. Under VMS + there is some brain damage in the linker that requires us to do this. */ + +static void +vms_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} #endif /* VMS_TARGET */ /* Additional support code for VMS host. */ diff --git a/gcc/config/vax/vms.h b/gcc/config/vax/vms.h index 1703e9bf304..15716a687bc 100644 --- a/gcc/config/vax/vms.h +++ b/gcc/config/vax/vms.h @@ -84,15 +84,6 @@ Boston, MA 02111-1307, USA. */ /* This macro definition sets up a default value for `main' to return. */ #define DEFAULT_MAIN_RETURN c_expand_return (integer_one_node) -/* This makes use of a hook in varasm.c to mark all external variables - for us. We use this to make sure that external variables are correctly - addressed. Under VMS there is some brain damage in the linker that requires - us to do this. */ - -#define ENCODE_SECTION_INFO(decl, FIRST) \ - if (DECL_EXTERNAL (decl) && TREE_PUBLIC (decl)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; - /* This is how to output a command to make the user-level label named NAME defined for reference from other files. */ diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 4ce5f31e57b..1fc5302b83c 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -198,6 +198,7 @@ static void xtensa_free_machine_status PARAMS ((struct function *p)); static void printx PARAMS ((FILE *, signed int)); static void xtensa_select_rtx_section PARAMS ((enum machine_mode, rtx, unsigned HOST_WIDE_INT)); +static void xtensa_encode_section_info PARAMS ((tree, int)); static rtx frame_size_const; static int current_function_arg_words; @@ -231,6 +232,8 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] = #undef TARGET_ASM_SELECT_RTX_SECTION #define TARGET_ASM_SELECT_RTX_SECTION xtensa_select_rtx_section +#undef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO xtensa_encode_section_info struct gcc_target targetm = TARGET_INITIALIZER; @@ -2003,12 +2006,7 @@ print_operand (file, op, letter) /* A C compound statement to output to stdio stream STREAM the assembler syntax for an instruction operand that is a memory - reference whose address is ADDR. ADDR is an RTL expression. - - On some machines, the syntax for a symbolic address depends on - the section that the address refers to. On these machines, - define the macro 'ENCODE_SECTION_INFO' to store the information - into the 'symbol_ref', and then check for it here. */ + reference whose address is ADDR. ADDR is an RTL expression. */ void print_operand_address (file, addr) @@ -2749,3 +2747,15 @@ xtensa_select_rtx_section (mode, x, align) { function_section (current_function_decl); } + +/* If we are referencing a function that is static, make the SYMBOL_REF + special so that we can generate direct calls to it even with -fpic. */ + +static void +xtensa_encode_section_info (decl, first) + tree decl; + int first ATTRIBUTE_UNUSED; +{ + if (TREE_CODE (decl) == FUNCTION_DECL && ! TREE_PUBLIC (decl)) + SYMBOL_REF_FLAG (XEXP (DECL_RTL (decl), 0)) = 1; +} diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 35350d4c2c9..3ec7b3f8e66 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -1257,14 +1257,6 @@ typedef struct xtensa_args { goto LABEL; \ } while (0) -/* If we are referencing a function that is static, make the SYMBOL_REF - special so that we can generate direct calls to it even with -fpic. */ -#define ENCODE_SECTION_INFO(DECL, FIRST) \ - do { \ - if (TREE_CODE (DECL) == FUNCTION_DECL && ! TREE_PUBLIC (DECL)) \ - SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1; \ - } while (0) - /* Specify the machine mode that this machine uses for the index in the tablejump instruction. */ #define CASE_VECTOR_MODE (SImode) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f1baa212d77..69515b8033b 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4767,11 +4767,11 @@ sums that are not marked with @code{const}. It assumes that a naked naked constant sums as illegitimate addresses, so that none of them will be given to @code{PRINT_OPERAND_ADDRESS}. -@cindex @code{ENCODE_SECTION_INFO} and address validation +@cindex @code{TARGET_ENCODE_SECTION_INFO} and address validation On some machines, whether a symbolic address is legitimate depends on the section that the address refers to. On these machines, define the -macro @code{ENCODE_SECTION_INFO} to store the information into the -@code{symbol_ref}, and then check for it here. When you see a +target hook @code{TARGET_ENCODE_SECTION_INFO} to store the information +into the @code{symbol_ref}, and then check for it here. When you see a @code{const}, you will have to look inside it to find the @code{symbol_ref} in order to determine the section. @xref{Assembler Format}. @@ -5766,38 +5766,11 @@ readonly data section is used. This macro is irrelevant if there is no separate readonly data section. -@findex ENCODE_SECTION_INFO -@item ENCODE_SECTION_INFO (@var{decl}, @var{new_decl_p}) -Define this macro 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 macro definition, if any, 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 @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 -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 @code{ENCODE_SECTION_INFO} examines -@code{DECL_ATTRIBUTES}. - -@cindex @code{SYMBOL_REF_FLAG}, in @code{ENCODE_SECTION_INFO} -The usual thing for this macro 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). - @findex STRIP_NAME_ENCODING @item STRIP_NAME_ENCODING (@var{var}, @var{sym_name}) Decode @var{sym_name} and store the real name part in @var{var}, sans the characters that encode section info. Define this macro if -@code{ENCODE_SECTION_INFO} alters the symbol's name string. +@code{TARGET_ENCODE_SECTION_INFO} alters the symbol's name string. @end table @deftypefn {Target Hook} void TARGET_ASM_SELECT_SECTION (tree @var{exp}, int @var{reloc}, unsigned HOST_WIDE_INT @var{align}) @@ -5839,6 +5812,32 @@ 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}) +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 @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 +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}. + +@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). +@end deftypefn + @node PIC @section Position Independent Code @cindex position independent code @@ -6517,7 +6516,7 @@ A C statement (sans semicolon) to output a reference to @code{SYMBOL_REF} @var{sym}. If not defined, @code{assemble_name} will be used to output the name of the symbol. This macro may be used to modify the way a symbol is referenced depending on information -encoded by @code{ENCODE_SECTION_INFO}. +encoded by @code{TARGET_ENCODE_SECTION_INFO}. @findex ASM_OUTPUT_LABEL_REF @item ASM_OUTPUT_LABEL_REF (@var{stream}, @var{buf}) @@ -7073,10 +7072,10 @@ A C compound statement to output to stdio stream @var{stream} the assembler syntax for an instruction operand that is a memory reference whose address is @var{x}. @var{x} is an RTL expression. -@cindex @code{ENCODE_SECTION_INFO} usage +@cindex @code{TARGET_ENCODE_SECTION_INFO} usage On some machines, the syntax for a symbolic address depends on the -section that the address refers to. On these machines, define the macro -@code{ENCODE_SECTION_INFO} to store the information into the +section that the address refers to. On these machines, define the hook +@code{TARGET_ENCODE_SECTION_INFO} to store the information into the @code{symbol_ref}, and then check for it here. @xref{Assembler Format}. @findex DBR_OUTPUT_SEQEND diff --git a/gcc/hooks.c b/gcc/hooks.c index c5371e915e6..1ceeef6e737 100644 --- a/gcc/hooks.c +++ b/gcc/hooks.c @@ -40,3 +40,11 @@ hook_tree_bool_false (a) { return false; } + +/* Generic hook that takes (tree, int) and does nothing. */ +void +hook_tree_int_void (a, b) + tree a ATTRIBUTE_UNUSED; + int b ATTRIBUTE_UNUSED; +{ +} diff --git a/gcc/hooks.h b/gcc/hooks.h index 0358ae934eb..f8f57bca8a7 100644 --- a/gcc/hooks.h +++ b/gcc/hooks.h @@ -21,3 +21,4 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. bool hook_void_bool_false PARAMS ((void)); bool hook_tree_bool_false PARAMS ((tree)); +void hook_tree_int_void PARAMS ((tree, int)); diff --git a/gcc/optabs.c b/gcc/optabs.c index d1610978a57..49771df1e98 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -4843,7 +4843,8 @@ rtx init_one_libfunc (name) const char *name; { - /* Create a FUNCTION_DECL that can be passed to ENCODE_SECTION_INFO. */ + /* Create a FUNCTION_DECL that can be passed to + targetm.encode_section_info. */ /* ??? We don't have any type information except for this is a function. Pretend this is "int foo()". */ tree decl = build_decl (FUNCTION_DECL, get_identifier (name), diff --git a/gcc/system.h b/gcc/system.h index aa9d5ac39f9..d26515bc60f 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -595,7 +595,8 @@ typedef char _Bool; MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \ MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR \ ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE \ - WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION + WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION \ + ENCODE_SECTION_INFO /* And other obsolete target macros, or macros that used to be in target headers and were not used, and may be obsolete or may never have diff --git a/gcc/target-def.h b/gcc/target-def.h index c7f2e24233a..557081652ac 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -209,6 +209,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TARGET_CANNOT_MODIFY_JUMPS_P hook_void_bool_false #define TARGET_IN_SMALL_DATA_P hook_tree_bool_false +#ifndef TARGET_ENCODE_SECTION_INFO +#define TARGET_ENCODE_SECTION_INFO hook_tree_int_void +#endif + /* The whole shebang. */ #define TARGET_INITIALIZER \ { \ @@ -228,7 +232,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TARGET_HAVE_NAMED_SECTIONS, \ TARGET_HAVE_CTORS_DTORS, \ TARGET_CANNOT_MODIFY_JUMPS_P, \ - TARGET_IN_SMALL_DATA_P \ + TARGET_IN_SMALL_DATA_P, \ + TARGET_ENCODE_SECTION_INFO \ } #include "hooks.h" diff --git a/gcc/target.h b/gcc/target.h index 9b64875fd94..97dd6d52bae 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -243,6 +243,10 @@ struct gcc_target /* True if EXP should be placed in a "small data" section. */ bool (* in_small_data_p) PARAMS ((tree)); + + /* Do something target-specific to record properties of the DECL into + the associated SYMBOL_REF. */ + void (* encode_section_info) PARAMS ((tree, int)); }; extern struct gcc_target targetm; diff --git a/gcc/varasm.c b/gcc/varasm.c index a5fef332260..eb570815253 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -838,9 +838,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. */ -#ifdef ENCODE_SECTION_INFO - ENCODE_SECTION_INFO (decl, false); -#endif + (* targetm.encode_section_info) (decl, false); return; } @@ -964,9 +962,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. */ -#ifdef ENCODE_SECTION_INFO - ENCODE_SECTION_INFO (decl, true); -#endif + (* targetm.encode_section_info) (decl, true); } /* Make the rtl for variable VAR be volatile. @@ -1501,7 +1497,8 @@ assemble_variable (decl, top_level, at_end, dont_output_data) if (TREE_ASM_WRITTEN (decl)) return; - /* Make sure ENCODE_SECTION_INFO is invoked before we set ASM_WRITTEN. */ + /* Make sure targetm.encode_section_info is invoked before we set + ASM_WRITTEN. */ decl_rtl = DECL_RTL (decl); TREE_ASM_WRITTEN (decl) = 1; @@ -3082,20 +3079,18 @@ output_constant_def (exp, defer) /* Optionally set flags or add text to the name to record information 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. */ -#ifdef ENCODE_SECTION_INFO /* A previously-processed constant would already have section info encoded in it. */ if (! found) { - /* Take care not to invoke ENCODE_SECTION_INFO for constants - which don't have a TREE_CST_RTL. */ + /* 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) - ENCODE_SECTION_INFO (exp, true); + (*targetm.encode_section_info) (exp, true); desc->rtl = rtl; desc->label = XSTR (XEXP (desc->rtl, 0), 0); } -#endif #ifdef CONSTANT_AFTER_FUNCTION_P if (current_function_decl != 0 -- 2.11.4.GIT