From ae46c4e08a8cbb8359203a90e172a78e3263174b Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 17 May 2002 00:43:41 -0700 Subject: hooks.c (hook_tree_bool_false): New. * hooks.c (hook_tree_bool_false): New. * hooks.h: Declare it. * target-def.h (TARGET_ASM_SELECT_SECTION): New. (TARGET_ASM_UNIQUE_SECTION, TARGET_IN_SMALL_DATA_P): New. * target.h (select_section, unique_section): New. (in_small_data_p): New. * varasm.c (resolve_unique_section): Use hooks instead of macros. (variable_section, output_constant_def_contents): Likewise. (default_select_section, default_unique_section): New. (categorize_decl_for_section, default_elf_select_section): New. * output.h: Declare them. * config/darwin.h (ALIAS_SECTION, try_section_alias): Remove. (TARGET_ASM_SELECT_SECTION): New. (SELECT_SECTION): Move ... * config/darwin.c (machopic_select_section): ... here. * config/darwin-protos.h: Update. * config/nextstep.h (TARGET_ASM_SELECT_SECTION): New. (SELECT_SECTION): Move ... * config/nextstep.c (nextstep_select_section): ... here. * config/nextstep-protos.h: Update. * config/elfos.h (UNIQUE_SECTION, SELECT_SECTION): Remove. (TARGET_ASM_SELECT_SECTION): New. * config/svr3.h (SELECT_SECTION): Remove. * config/alpha/alpha.c (unicosmk_unique_section): Make static. (TARGET_ASM_UNIQUE_SECTION) [UNICOS]: New. (TARGET_IN_SMALL_DATA_P, alpha_in_small_data_p): New. (alpha_encode_section_info): Use it. * config/alpha/alpha-protos.h: Update. * config/alpha/elf.h (DO_SELECT_SECTION): Remove. (SELECT_SECTION, UNIQUE_SECTION): Remove. (TARGET_ASM_SELECT_SECTION): New. * config/alpha/unicosmk.h (UNIQUE_SECTION): Remove. * config/arm/pe.h (UNIQUE_SECTION): Remove. (TARGET_ASM_UNIQUE_SECTION): New. * config/avr/avr.c (TARGET_ASM_UNIQUE_SECTION): New. (avr_unique_section): Rename from unique_section; make static. * config/avr/avr-protos.h: Update. * config/avr/avr.h (UNIQUE_SECTION): Remove. * config/c4x/c4x.h (SELECT_SECTION): Remove. * config/i386/cygwin.h (UNIQUE_SECTION): Remove. (TARGET_ASM_UNIQUE_SECTION): New. * config/i386/i386-interix.h: Likewise. * config/i386/win32.h: Likewise. * config/i386/djgpp.h (UNIQUE_SECTION): Remove. * config/i386/i386.c (ix86_asm_file_end): Use target hook not macro. * config/i386/sco5.h (SELECT_SECTION): Remove. (TARGET_ASM_SELECT_SECTION): New. * config/i386/svr3gas.h (SELECT_SECTION): Remove. * config/i860/paragon.h: Undef TARGET_ASM_SELECT_SECTION instead of SELECT_SECTION. * config/m68k/dpx2.h: Likewise. * config/rs6000/lynx.h: Likewise. * config/ia64/aix.h (SELECT_SECTION, UNIQUE_SECTION): Remove. (TARGET_ASM_SELECT_SECTION, TARGET_ASM_UNIQUE_SECTION): New. * config/ia64/ia64.c (TARGET_IN_SMALL_DATA_P): New. (ia64_in_small_data_p): New. (ia64_encode_section_info): Use it. Reorganize overlarge conditional. (ia64_aix_select_section, ia64_aix_unique_section): New. * config/ia64/sysv4.h (DO_SELECT_SECTION): Remove. (SELECT_SECTION, UNIQUE_SECTION): Remove. * config/m32r/m32r.h (SELECT_SECTION): Remove. (TARGET_ASM_SELECT_SECTION): New. * config/m32r/m32r.c (m32r_select_section): Take align argument. * config/m32r/m32r-protos.h: Update. * config/m88k/m88k.h (TARGET_ASM_SELECT_SECTION): New. (SELECT_SECTION): Move ... * config/m88k/m88k.c (m88k_select_section): ... here. * config/mcore/mcore-pe.h (SELECT_SECTION): Remove. * config/mcore/mcore.h (UNIQUE_SECTION): Remove. * config/mcore/mcore.c (TARGET_ASM_UNIQUE_SECTION): New. (mcore_unique_section): Make static. * config/mcore/mcore-protos.h: Update. * config/mips/elf.h (UNIQUE_SECTION): Remove. (TARGET_ASM_UNIQUE_SECTION): New. * config/mips/elf64.h: Likewise. * config/mips/iris6gld.h: Likewise. * config/mips/linux.h: Likewise. * config/mips/mips-protos.h: Update. * config/mips/mips.c (mips_select_section): Add align argument. * config/mips/mips.h (SELECT_SECTION): Remove. (TARGET_ASM_SELECT_SECTION): New. * config/mmix/mmix.h (SELECT_SECTION, UNIQUE_SECTION): Remove. * config/mmix/mmix.c (mmix_select_section): Remove. (mmix_unique_section): Remove. * config/mmix/mmix-protos.h: Update. * config/pa/pa.h (TARGET_ASM_SELECT_SECTION): New. (SELECT_SECTION): Move ... * config/pa/pa.c (pa_select_section): ... here. * config/pa/pa64-hpux.h (UNIQUE_SECTION): Remove. * config/rs6000/rs6000.c (rs6000_elf_select_section): Rename from rs6000_select_section and make static. (rs6000_elf_unique_section): Similarly. (rs6000_xcoff_select_section): From xcoff.h. (rs6000_xcoff_unique_section): Likewise. * config/rs6000/rs6000-protos.h: Update. * config/rs6000/sysv4.h (SELECT_SECTION, UNIQUE_SECTION): Remove. (TARGET_ASM_SELECT_SECTION, TARGET_ASM_UNIQUE_SECTION): New. * config/rs6000/xcoff.h: Likewise. * config/sparc/aout.h (TARGET_ASM_SELECT_SECTION): New. (SELECT_SECTION): Move ... * config/sparc/sparc.c (sparc_aout_select_section): ... here. * config/v850/v850.h (SELECT_SECTION): Move ... * config/v850/v850.c (v850_select_section): ... here. (TARGET_ASM_SELECT_SECTION): New. * config/vax/vms.h (SELECT_SECTION): Move ... * config/vax/vax.c (vms_select_section): ... here. (TARGET_ASM_SELECT_SECTION): New. * doc/tm.texi: Update SELECT_SECTION and UNIQUE_SECTION docs for the target hooks. From-SVN: r53550 --- gcc/config/darwin.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 1 deletion(-) (limited to 'gcc/config/darwin.c') diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index f5e9db0..8a3a2da 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -1,5 +1,5 @@ /* Functions for generic Darwin as target machine for GNU C compiler. - Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001 + Copyright (C) 1989, 1990, 1991, 1992, 1993, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Apple Computer Inc. @@ -1110,6 +1110,134 @@ update_stubs (name) } void +machopic_select_section (exp, reloc, align) + tree exp; + int reloc; + unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; +{ + if (TREE_CODE (exp) == STRING_CST) + { + if (flag_writable_strings) + data_section (); + else if (TREE_STRING_LENGTH (exp) != + strlen (TREE_STRING_POINTER (exp)) + 1) + readonly_data_section (); + else + cstring_section (); + } + else if (TREE_CODE (exp) == INTEGER_CST + || TREE_CODE (exp) == REAL_CST) + { + tree size = TYPE_SIZE (TREE_TYPE (exp)); + + if (TREE_CODE (size) == INTEGER_CST && + TREE_INT_CST_LOW (size) == 4 && + TREE_INT_CST_HIGH (size) == 0) + literal4_section (); + else if (TREE_CODE (size) == INTEGER_CST && + TREE_INT_CST_LOW (size) == 8 && + TREE_INT_CST_HIGH (size) == 0) + literal8_section (); + else + readonly_data_section (); + } + else if (TREE_CODE (exp) == CONSTRUCTOR + && TREE_TYPE (exp) + && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE + && TYPE_NAME (TREE_TYPE (exp))) + { + tree name = TYPE_NAME (TREE_TYPE (exp)); + if (TREE_CODE (name) == TYPE_DECL) + name = DECL_NAME (name); + if (!strcmp (IDENTIFIER_POINTER (name), "NSConstantString")) + objc_constant_string_object_section (); + else if (!strcmp (IDENTIFIER_POINTER (name), "NXConstantString")) + objc_string_object_section (); + else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) + { + if (TREE_SIDE_EFFECTS (exp) || flag_pic && reloc) + const_data_section (); + else + readonly_data_section (); + } + else + data_section (); + } + else if (TREE_CODE (exp) == VAR_DECL && + DECL_NAME (exp) && + TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE && + IDENTIFIER_POINTER (DECL_NAME (exp)) && + !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)) + { + const char *name = IDENTIFIER_POINTER (DECL_NAME (exp)); + + if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20)) + objc_cls_meth_section (); + else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23)) + objc_inst_meth_section (); + else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20)) + objc_cat_cls_meth_section (); + else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23)) + objc_cat_inst_meth_section (); + else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22)) + objc_class_vars_section (); + else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25)) + objc_instance_vars_section (); + else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22)) + objc_cat_cls_meth_section (); + else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17)) + objc_class_names_section (); + else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20)) + objc_meth_var_names_section (); + else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20)) + objc_meth_var_types_section (); + else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22)) + objc_cls_refs_section (); + else if (!strncmp (name, "_OBJC_CLASS_", 12)) + objc_class_section (); + else if (!strncmp (name, "_OBJC_METACLASS_", 16)) + objc_meta_class_section (); + else if (!strncmp (name, "_OBJC_CATEGORY_", 15)) + objc_category_section (); + else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25)) + objc_selector_refs_section (); + else if (!strncmp (name, "_OBJC_SELECTOR_FIXUP", 20)) + objc_selector_fixup_section (); + else if (!strncmp (name, "_OBJC_SYMBOLS", 13)) + objc_symbols_section (); + else if (!strncmp (name, "_OBJC_MODULES", 13)) + objc_module_info_section (); + else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32)) + objc_cat_inst_meth_section (); + else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29)) + objc_cat_cls_meth_section (); + else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20)) + objc_cat_cls_meth_section (); + else if (!strncmp (name, "_OBJC_PROTOCOL_", 15)) + objc_protocol_section (); + else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) + && !TREE_SIDE_EFFECTS (exp)) + { + if (flag_pic && reloc) + const_data_section (); + else + readonly_data_section (); + } + else + data_section (); + } + else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) + { + if (TREE_SIDE_EFFECTS (exp) || flag_pic && reloc) + const_data_section (); + else + readonly_data_section (); + } + else + data_section (); +} + +void machopic_asm_out_constructor (symbol, priority) rtx symbol; int priority ATTRIBUTE_UNUSED; -- cgit v1.1