diff options
author | echristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-06 23:16:23 +0000 |
---|---|---|
committer | echristo <echristo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-06 23:16:23 +0000 |
commit | b215c058e8d54661a425789ce08b8658e89b0282 (patch) | |
tree | 40c29d6ebecee3ad150d3ed86b8de4eacf4f5d3b /gcc | |
parent | 1d31417daaa42eef5c82d33702e16ce7d0257311 (diff) | |
download | gcc-b215c058e8d54661a425789ce08b8658e89b0282.tar.gz |
2006-01-06 Eric Christopher <echristo@apple.com>
* doc/tm.texi (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): Document.
(TARGET_UNWIND_EMIT): Fix spelling.
* target.h (gcc_target): Add except_table_label.
* except.c (output_function_exception_table): Use.
* varasm.c (default_emit_except_table_label): New.
* target-def.h (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): New default
define.
(asm_out): Add here.
* output.h (default_emit_except_table_label): Prototype.
* config/darwin-protos.h (darwin_emit_except_table_label): Ditto.
* config/darwin.c (darwin_emit_except_table_label): Define.
* config/darwin.h (TARGET_ASM_EMIT_EXCEPT_TABLE): Ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/config/darwin-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/darwin.c | 87 | ||||
-rw-r--r-- | gcc/config/darwin.h | 9 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 46 | ||||
-rw-r--r-- | gcc/except.c | 56 | ||||
-rw-r--r-- | gcc/output.h | 1 | ||||
-rw-r--r-- | gcc/target-def.h | 5 | ||||
-rw-r--r-- | gcc/target.h | 14 | ||||
-rw-r--r-- | gcc/varasm.c | 76 |
10 files changed, 184 insertions, 127 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7834cb640a..98373329a69 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2006-01-06 Eric Christopher <echristo@apple.com> + + * doc/tm.texi (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): Document. + (TARGET_UNWIND_EMIT): Fix spelling. + * target.h (gcc_target): Add except_table_label. + * except.c (output_function_exception_table): Use. + * varasm.c (default_emit_except_table_label): New. + * target-def.h (TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL): New default + define. + (asm_out): Add here. + * output.h (default_emit_except_table_label): Prototype. + * config/darwin-protos.h (darwin_emit_except_table_label): Ditto. + * config/darwin.c (darwin_emit_except_table_label): Define. + * config/darwin.h (TARGET_ASM_EMIT_EXCEPT_TABLE): Ditto. + 2005-01-06 Zdenek Dvorak <dvorakz@suse.cz> PR tree-optimization/18527 @@ -379,4 +394,3 @@ * config/rs6000/sync.md (sync_compare_and_swap{hi,qi}): New. (sync_compare_and_swapqhi_internal): New. * config/rs6000/rs6000-protos.h: Declare. - diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h index ad9ce78419f..a22e76f8d79 100644 --- a/gcc/config/darwin-protos.h +++ b/gcc/config/darwin-protos.h @@ -60,6 +60,7 @@ extern void darwin_asm_named_section (const char *, unsigned int, tree); extern void darwin_non_lazy_pcrel (FILE *, rtx); extern void darwin_emit_unwind_label (FILE *, tree, int, int); +extern void darwin_emit_except_table_label (FILE *); extern void darwin_pragma_ignore (struct cpp_reader *); extern void darwin_pragma_options (struct cpp_reader *); diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c index 6525bddba10..920c4784452 100644 --- a/gcc/config/darwin.c +++ b/gcc/config/darwin.c @@ -66,7 +66,7 @@ Boston, MA 02110-1301, USA. */ allows all uses of the old name to forward to the replacement, including existing function pointers and virtual methods. See rs6000_emit_prologue for the code that handles the nop insertions. - + The added indirection allows gdb to redirect accesses to static symbols from the newly loaded translation unit to the existing symbol, if any. @code{static} symbols are special and are handled by @@ -89,7 +89,7 @@ output_objc_section_asm_op (const void *directive) if (! been_here) { - static const enum darwin_section_enum tomark[] = + static const enum darwin_section_enum tomark[] = { /* written, cold -> hot */ objc_cat_cls_meth_section, @@ -115,7 +115,7 @@ output_objc_section_asm_op (const void *directive) objc_symbols_section }; size_t i; - + been_here = true; for (i = 0; i < ARRAY_SIZE (tomark); i++) switch_to_section (darwin_sections[tomark[i]]); @@ -190,10 +190,10 @@ machopic_classify_symbol (rtx sym_ref) flags = SYMBOL_REF_FLAGS (sym_ref); function_p = SYMBOL_REF_FUNCTION_P (sym_ref); if (machopic_symbol_defined_p (sym_ref)) - return (function_p + return (function_p ? MACHOPIC_DEFINED_FUNCTION : MACHOPIC_DEFINED_DATA); else - return (function_p + return (function_p ? MACHOPIC_UNDEFINED_FUNCTION : MACHOPIC_UNDEFINED_DATA); } @@ -256,7 +256,7 @@ void machopic_define_symbol (rtx mem) { rtx sym_ref; - + gcc_assert (GET_CODE (mem) == MEM); sym_ref = XEXP (mem, 0); SYMBOL_REF_FLAGS (sym_ref) |= MACHO_SYMBOL_FLAG_DEFINED; @@ -287,7 +287,7 @@ machopic_function_base_sym (void) rtx sym_ref; sym_ref = gen_rtx_SYMBOL_REF (Pmode, machopic_function_base_name ()); - SYMBOL_REF_FLAGS (sym_ref) + SYMBOL_REF_FLAGS (sym_ref) |= (MACHO_SYMBOL_FLAG_VARIABLE | MACHO_SYMBOL_FLAG_DEFINED); return sym_ref; } @@ -344,7 +344,7 @@ typedef struct machopic_indirection GTY (()) /* A table mapping stub names and non-lazy pointer names to SYMBOL_REFs for the stubbed-to and pointed-to entities. */ -static GTY ((param_is (struct machopic_indirection))) htab_t +static GTY ((param_is (struct machopic_indirection))) htab_t machopic_indirections; /* Return a hash value for a SLOT in the indirections hash table. */ @@ -396,7 +396,7 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) namelen = strlen (name); } } - + if (name[0] == '*') { saw_star = true; @@ -427,11 +427,11 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) sprintf (buffer, "&%sL%s%s%s%s", quote, prefix, name, suffix, quote); if (!machopic_indirections) - machopic_indirections = htab_create_ggc (37, + machopic_indirections = htab_create_ggc (37, machopic_indirection_hash, machopic_indirection_eq, /*htab_del=*/NULL); - + slot = htab_find_slot_with_hash (machopic_indirections, buffer, htab_hash_string (buffer), INSERT); if (*slot) @@ -447,7 +447,7 @@ machopic_indirection_name (rtx sym_ref, bool stub_p) p->used = false; *slot = p; } - + return p->ptr_name; } @@ -469,15 +469,15 @@ void machopic_validate_stub_or_non_lazy_ptr (const char *name) { machopic_indirection *p; - - p = ((machopic_indirection *) + + p = ((machopic_indirection *) (htab_find_with_hash (machopic_indirections, name, htab_hash_string (name)))); if (p && ! p->used) { const char *real_name; tree id; - + p->used = true; /* Do what output_addr_const will do when we actually call it. */ @@ -485,7 +485,7 @@ machopic_validate_stub_or_non_lazy_ptr (const char *name) mark_decl_referenced (SYMBOL_REF_DECL (p->symbol)); real_name = targetm.strip_name_encoding (XSTR (p->symbol, 0)); - + id = maybe_get_identifier (real_name); if (id) mark_referenced (id); @@ -556,7 +556,7 @@ machopic_indirect_data_reference (rtx orig, rtx reg) } ptr_ref = (gen_rtx_SYMBOL_REF - (Pmode, + (Pmode, machopic_indirection_name (orig, /*stub_p=*/false))); SYMBOL_REF_DECL (ptr_ref) = SYMBOL_REF_DECL (orig); @@ -633,17 +633,17 @@ machopic_indirect_call_target (rtx target) if (GET_CODE (target) != MEM) return target; - if (MACHOPIC_INDIRECT + if (MACHOPIC_INDIRECT && GET_CODE (XEXP (target, 0)) == SYMBOL_REF && !(SYMBOL_REF_FLAGS (XEXP (target, 0)) & MACHO_SYMBOL_FLAG_DEFINED)) { rtx sym_ref = XEXP (target, 0); - const char *stub_name = machopic_indirection_name (sym_ref, + const char *stub_name = machopic_indirection_name (sym_ref, /*stub_p=*/true); enum machine_mode mode = GET_MODE (sym_ref); tree decl = SYMBOL_REF_DECL (sym_ref); - + XEXP (target, 0) = gen_rtx_SYMBOL_REF (mode, stub_name); SYMBOL_REF_DECL (XEXP (target, 0)) = decl; MEM_READONLY_P (target) = 1; @@ -727,7 +727,7 @@ machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) rtx mem; rtx insn; rtx sum; - + sum = gen_rtx_HIGH (Pmode, offset); if (! MACHO_DYNAMIC_NO_PIC_P) sum = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, sum); @@ -735,21 +735,21 @@ machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) emit_insn (gen_rtx_SET (Pmode, hi_sum_reg, sum)); mem = gen_const_mem (GET_MODE (orig), - gen_rtx_LO_SUM (Pmode, + gen_rtx_LO_SUM (Pmode, hi_sum_reg, offset)); insn = emit_insn (gen_rtx_SET (VOIDmode, reg, mem)); - REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, pic_ref, + REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, pic_ref, REG_NOTES (insn)); pic_ref = reg; #else emit_insn (gen_rtx_USE (VOIDmode, - gen_rtx_REG (Pmode, + gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM))); emit_insn (gen_rtx_SET (VOIDmode, reg, gen_rtx_HIGH (Pmode, - gen_rtx_CONST (Pmode, + gen_rtx_CONST (Pmode, offset)))); emit_insn (gen_rtx_SET (VOIDmode, reg, gen_rtx_LO_SUM (Pmode, reg, @@ -769,7 +769,7 @@ machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) } #if 0 emit_insn (gen_rtx_USE (VOIDmode, - gen_rtx_REG (Pmode, + gen_rtx_REG (Pmode, PIC_OFFSET_TABLE_REGNUM))); #endif @@ -807,7 +807,7 @@ machopic_legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) ? gen_rtx_HIGH (Pmode, offset) : gen_rtx_PLUS (Pmode, pic_offset_table_rtx, - gen_rtx_HIGH (Pmode, + gen_rtx_HIGH (Pmode, offset)))); emit_insn (gen_rtx_SET (VOIDmode, reg, gen_rtx_LO_SUM (Pmode, @@ -929,14 +929,14 @@ machopic_output_indirection (void **slot, void *data) rtx symbol; const char *sym_name; const char *ptr_name; - + if (!p->used) return 1; symbol = p->symbol; sym_name = XSTR (symbol, 0); ptr_name = p->ptr_name; - + if (p->stub_p) { char *sym; @@ -988,11 +988,11 @@ machopic_output_indirection (void **slot, void *data) switch_to_section (darwin_sections[machopic_nl_symbol_ptr_section]); assemble_name (asm_out_file, ptr_name); fprintf (asm_out_file, ":\n"); - + fprintf (asm_out_file, "\t.indirect_symbol "); assemble_name (asm_out_file, sym_name); fprintf (asm_out_file, "\n"); - + /* Variables that are marked with MACHO_SYMBOL_STATIC need to have their symbol name instead of 0 in the second entry of the non-lazy symbol pointer data structure when they are @@ -1007,7 +1007,7 @@ machopic_output_indirection (void **slot, void *data) assemble_integer (init, GET_MODE_SIZE (Pmode), GET_MODE_ALIGNMENT (Pmode), 1); } - + return 1; } @@ -1273,14 +1273,14 @@ darwin_globalize_label (FILE *stream, const char *name) } void -darwin_asm_named_section (const char *name, +darwin_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED, tree decl ATTRIBUTE_UNUSED) { fprintf (asm_out_file, "\t.section %s\n", name); } -void +void darwin_unique_section (tree decl ATTRIBUTE_UNUSED, int reloc ATTRIBUTE_UNUSED) { /* Darwin does not use unique sections. */ @@ -1313,12 +1313,12 @@ no_dead_strip (FILE *file, const char *lab) fprintf (file, ".no_dead_strip %s\n", lab); } -/* Emit a label for an FDE, making it global and/or weak if appropriate. +/* Emit a label for an FDE, making it global and/or weak if appropriate. The third parameter is nonzero if this is for exception handling. The fourth parameter is nonzero if this is just a placeholder for an FDE that we are omitting. */ -void +void darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty) { tree id = DECL_ASSEMBLER_NAME (decl) @@ -1377,7 +1377,18 @@ darwin_emit_unwind_label (FILE *file, tree decl, int for_eh, int empty) free (lab); } -/* Generate a PC-relative reference to a Mach-O non-lazy-symbol. */ +static GTY(()) unsigned long except_table_label_num; + +void +darwin_emit_except_table_label (FILE *file) +{ + char section_start_label[30]; + + ASM_GENERATE_INTERNAL_LABEL (section_start_label, "GCC_except_table", + except_table_label_num++); + ASM_OUTPUT_LABEL (file, section_start_label); +} +/* Generate a PC-relative reference to a Mach-O non-lazy-symbol. */ void darwin_non_lazy_pcrel (FILE *file, rtx addr) @@ -1398,7 +1409,7 @@ darwin_non_lazy_pcrel (FILE *file, rtx addr) extern". There is no MACH-O equivalent of ELF's VISIBILITY_INTERNAL or VISIBILITY_PROTECTED. */ -void +void darwin_assemble_visibility (tree decl, int vis) { if (vis == VISIBILITY_DEFAULT) diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index ad1d051084b..70481bbea4c 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -303,8 +303,8 @@ Boston, MA 02110-1301, USA. */ be in a new format, or the fallback routine might be changed; if you want to explicitly link against the static version of those routines, because you know you don't need to unwind through system - libraries, you need to explicitly say -static-libgcc. - + libraries, you need to explicitly say -static-libgcc. + If it is linked against, it has to be before -lgcc, because it may need symbols from -lgcc. */ #undef REAL_LIBGCC_SPEC @@ -317,7 +317,7 @@ Boston, MA 02110-1301, USA. */ :%:version-compare(>< 10.3.9 10.5 mmacosx-version-min= -lgcc_s.10.4) \ %:version-compare(>= 10.5 mmacosx-version-min= -lgcc_s.10.5) \ -lgcc}" - + /* We specify crt0.o as -lcrt0.o so that ld will search the library path. */ #undef STARTFILE_SPEC @@ -436,6 +436,9 @@ Boston, MA 02110-1301, USA. */ emit a label for an empty FDE. */ #define TARGET_ASM_EMIT_UNWIND_LABEL darwin_emit_unwind_label +/* Emit a label to separate the exception table. */ +#define TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL darwin_emit_except_table_label + /* Our profiling scheme doesn't LP labels and counter words. */ #define NO_PROFILE_COUNTERS 1 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index c9e657375fe..61b22e42ccf 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1530,7 +1530,7 @@ default is @code{LONG_DOUBLE_TYPE_SIZE}. @end defmac @defmac LIBGCC2_HAS_DF_MODE -Define this macro if neither @code{LIBGCC2_DOUBLE_TYPE_SIZE} nor +Define this macro if neither @code{LIBGCC2_DOUBLE_TYPE_SIZE} nor @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is @code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a} anyway. If you don't define this and either @code{LIBGCC2_DOUBLE_TYPE_SIZE} @@ -1539,14 +1539,14 @@ otherwise it is 0. @end defmac @defmac LIBGCC2_HAS_XF_MODE -Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not +Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not @code{XFmode} but you want @code{XFmode} routines in @file{libgcc2.a} anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 80 then the default is 1, otherwise it is 0. @end defmac @defmac LIBGCC2_HAS_TF_MODE -Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not +Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not @code{TFmode} but you want @code{TFmode} routines in @file{libgcc2.a} anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 128 then the default is 1, otherwise it is 0. @@ -2504,7 +2504,7 @@ forwarding logic, you can set @code{sri->extra_cost} to a negative amount. @defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) @defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) @defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x}) -These macros are obsolete, new ports should use the target hook +These macros are obsolete, new ports should use the target hook @code{TARGET_SECONDARY_RELOAD} instead. These are obsolete macros, replaced by the @code{TARGET_SECONDARY_RELOAD} @@ -2901,10 +2901,10 @@ machines. See @file{function.c} for details. @defmac INITIAL_FRAME_ADDRESS_RTX A C expression whose value is RTL representing the address of the initial -stack frame. This address is passed to @code{RETURN_ADDR_RTX} and +stack frame. This address is passed to @code{RETURN_ADDR_RTX} and @code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable default value will be used. Define this macro in order to make frame pointer -elimination work in the presence of @code{__builtin_frame_address (count)} and +elimination work in the presence of @code{__builtin_frame_address (count)} and @code{__builtin_return_address (count)} for @code{count} not equal to zero. @end defmac @@ -3034,7 +3034,7 @@ The final value should conincide with that calculated by @code{INCOMING_FRAME_SP_OFFSET}. Normally the CFA is calculated as an offset from the argument pointer, -via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is +via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is variable due to the ABI, this may not be possible. If this macro is defined, it implies that the virtual register instantiation should be based on the frame pointer instead of the argument pointer. Only one @@ -4487,7 +4487,7 @@ may vary greatly between different architectures. @deftypefn {Target Hook} tree TARGET_STACK_PROTECT_GUARD (void) This hook returns a @code{DECL} node for the external variable to use -for the stack protection guard. This variable is initialized by the +for the stack protection guard. This variable is initialized by the runtime to some random value and is used to initialize the guard value that is placed at the top of the local stack frame. The type of this variable must be @code{ptr_type_node}. @@ -4502,7 +4502,7 @@ stack protect guard variable has been modified. This expression should involve a call to a @code{noreturn} function. The default version of this hook invokes a function called -@samp{__stack_chk_fail}, taking no arguments. This function is +@samp{__stack_chk_fail}, taking no arguments. This function is normally defined in @file{libgcc2.c}. @end deftypefn @@ -5201,7 +5201,7 @@ of TLS symbols for various targets. @deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD (void) This hook should return the DECL of a function @var{f} that given an address @var{addr} as an argument returns a mask @var{m} that can be -used to extract from two vectors the relevant data that resides in +used to extract from two vectors the relevant data that resides in @var{addr} in case @var{addr} is not properly aligned. The autovectrizer, when vectorizing a load operation from an address @@ -5212,15 +5212,15 @@ two loaded vectors. The first two arguments to @code{REALIGN_LOAD}, @var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and the third argument, @var{OFF}, defines how the data will be extracted from these two vectors: if @var{OFF} is 0, then the returned vector is -@var{v2}; otherwise, the returned vector is composed from the last -@var{VS}-@var{OFF} elements of @var{v1} concatenated to the first +@var{v2}; otherwise, the returned vector is composed from the last +@var{VS}-@var{OFF} elements of @var{v1} concatenated to the first @var{OFF} elements of @var{v2}. If this hook is defined, the autovectorizer will generate a call to @var{f} (using the DECL tree that this hook returns) and will use the return value of @var{f} as the argument @var{OFF} to @code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f} -should comply with the semantics expected by @code{REALIGN_LOAD} +should comply with the semantics expected by @code{REALIGN_LOAD} described above. If this hook is not defined, then @var{addr} will be used as the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low @@ -6031,7 +6031,7 @@ part of the @code{.init_array} (or equivalent) section. If not defined, GCC will assume such a section does not exist. Do not define both this macro and @code{INIT_SECTION_ASM_OP}. @end defmac - + @defmac FINI_ARRAY_SECTION_ASM_OP If defined, a C expression whose value is a string, including spacing, containing the assembler operation to identify the following data as @@ -7687,7 +7687,15 @@ true if this is a placeholder label for an omitted FDE@. The default is that FDEs are not given nonlocal labels. @end deftypefn -@deftypefn {Taget Hook} void TARGET_UNWIND_EMIT (FILE * @var{stream}, rtx @var{insn}) +@deftypefn {Target Hook} void TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL (@var{stream}) +This target hook emits a label at the beginning of the exception table. +It should be defined on targets where it is desirable for the table +to be broken up according to function. + +The default is that no label is emitted. +@end deftypefn + +@deftypefn {Target Hook} void TARGET_UNWIND_EMIT (FILE * @var{stream}, rtx @var{insn}) This target hook emits and assembly directives required to unwind the given instruction. This is only used when TARGET_UNWIND_INFO is set. @end deftypefn @@ -9480,9 +9488,9 @@ low-overhead loop, otherwise return a string why doloop could not be applied. Many targets use special registers for low-overhead looping. For any instruction that clobbers these this function should return a string indicating -the reason why the doloop could not be applied. +the reason why the doloop could not be applied. By default, the RTL loop optimizer does not use a present doloop pattern for -loops containing function calls or branch on table instructions. +loops containing function calls or branch on table instructions. @end deftypefn @defmac MD_CAN_REDIRECT_BRANCH (@var{branch1}, @var{branch2}) @@ -9661,8 +9669,8 @@ and ia64. The default is @code{false}. @end deftypefn @deftypefn {Target Hook} const char *TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN (tree @var{typelist}, tree @var{funcdecl}, tree @var{val}) -If defined, this macro returns the diagnostic message when it is -illegal to pass argument @var{val} to function @var{funcdecl} +If defined, this macro returns the diagnostic message when it is +illegal to pass argument @var{val} to function @var{funcdecl} with prototype @var{typelist}. @end deftypefn diff --git a/gcc/except.c b/gcc/except.c index 39a35a16cf8..19aeac8ee7f 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -134,7 +134,7 @@ struct eh_region GTY(()) /* Each region does exactly one thing. */ enum eh_region_type - { + { ERT_UNKNOWN = 0, ERT_CLEANUP, ERT_TRY, @@ -251,7 +251,6 @@ struct eh_status GTY(()) htab_t GTY((param_is (struct throw_stmt_node))) throw_stmt_table; }; - static int t2r_eq (const void *, const void *); static hashval_t t2r_hash (const void *); @@ -442,7 +441,7 @@ init_eh_for_function (void) cfun->eh = ggc_alloc_cleared (sizeof (struct eh_status)); } -/* Routines to generate the exception tree somewhat directly. +/* Routines to generate the exception tree somewhat directly. These are used from tree-eh.c when processing exception related nodes during tree optimization. */ @@ -738,7 +737,7 @@ remove_unreachable_regions (rtx insns) default: break; } - + if (kill_it) remove_eh_handler (r); } @@ -864,11 +863,11 @@ duplicate_eh_region_1 (struct eh_region *o) struct eh_region *n = ggc_alloc_cleared (sizeof (struct eh_region)); *n = *o; - + n->region_number = o->region_number + cfun->eh->last_region_number; VEC_replace (eh_region, cfun->eh->region_array, n->region_number, n); gcc_assert (!o->aka); - + return n; } @@ -877,7 +876,7 @@ duplicate_eh_region_2 (struct eh_region *o, struct eh_region **n_array, struct eh_region *prev_try) { struct eh_region *n = n_array[o->region_number]; - + switch (n->type) { case ERT_TRY: @@ -886,7 +885,7 @@ duplicate_eh_region_2 (struct eh_region *o, struct eh_region **n_array, if (o->u.try.last_catch) n->u.try.last_catch = n_array[o->u.try.last_catch->region_number]; break; - + case ERT_CATCH: if (o->u.catch.next_catch) n->u.catch.next_catch = n_array[o->u.catch.next_catch->region_number]; @@ -900,11 +899,11 @@ duplicate_eh_region_2 (struct eh_region *o, struct eh_region **n_array, else n->u.cleanup.prev_try = prev_try; break; - + default: break; } - + if (o->outer) n->outer = n_array[o->outer->region_number]; if (o->inner) @@ -922,10 +921,10 @@ duplicate_eh_regions (struct function *ifun, duplicate_eh_regions_map map, int ifun_last_region_number = ifun->eh->last_region_number; struct eh_region **n_array, *root, *cur, *prev_try; int i; - + if (ifun_last_region_number == 0 || !ifun->eh->region_tree) return 0; - + n_array = xcalloc (ifun_last_region_number + 1, sizeof (*n_array)); VEC_safe_grow (eh_region, gc, cfun->eh->region_array, cfun->eh->last_region_number + 1 + ifun_last_region_number); @@ -936,7 +935,7 @@ duplicate_eh_regions (struct function *ifun, duplicate_eh_regions_map map, for (i = cfun->eh->last_region_number + 1; i < cfun->eh->last_region_number + 1 + ifun_last_region_number; i++) VEC_replace (eh_region, cfun->eh->region_array, i, 0); - + /* Search for the containing ERT_TRY region to fix up the prev_try short-cuts for ERT_CLEANUP regions. */ prev_try = NULL; @@ -967,7 +966,7 @@ duplicate_eh_regions (struct function *ifun, duplicate_eh_regions_map map, continue; duplicate_eh_region_2 (cur, n_array, prev_try); } - + root = n_array[ifun->eh->region_tree->region_number]; gcc_assert (root->outer == NULL); if (outer_region > 0) @@ -1000,12 +999,12 @@ duplicate_eh_regions (struct function *ifun, duplicate_eh_regions_map map, else cfun->eh->region_tree = root; } - + free (n_array); - + i = cfun->eh->last_region_number; cfun->eh->last_region_number = i + ifun_last_region_number; - + return i; } @@ -1268,7 +1267,7 @@ emit_to_new_bb_before (rtx seq, rtx insn) edge_iterator ei; /* If there happens to be a fallthru edge (possibly created by cleanup_cfg - call), we don't want it to go into newly created landing pad or other EH + call), we don't want it to go into newly created landing pad or other EH construct. */ for (ei = ei_start (BLOCK_FOR_INSN (insn)->preds); (e = ei_safe_edge (ei)); ) if (e->flags & EDGE_FALLTHRU) @@ -1339,7 +1338,7 @@ build_post_landing_pads (void) emit_cmp_and_jump_insns (cfun->eh->filter, GEN_INT (tree_low_cst (TREE_VALUE (flt_node), 0)), - EQ, NULL_RTX, + EQ, NULL_RTX, targetm.eh_return_filter_mode (), 0, c->label); tp_node = TREE_CHAIN (tp_node); @@ -1372,7 +1371,7 @@ build_post_landing_pads (void) emit_cmp_and_jump_insns (cfun->eh->filter, GEN_INT (region->u.allowed.filter), - EQ, NULL_RTX, + EQ, NULL_RTX, targetm.eh_return_filter_mode (), 0, region->label); /* We delay the generation of the _Unwind_Resume until we generate @@ -1552,7 +1551,7 @@ dw2_build_landing_pads (void) emit_move_insn (cfun->eh->exc_ptr, gen_rtx_REG (ptr_mode, EH_RETURN_DATA_REGNO (0))); emit_move_insn (cfun->eh->filter, - gen_rtx_REG (targetm.eh_return_filter_mode (), + gen_rtx_REG (targetm.eh_return_filter_mode (), EH_RETURN_DATA_REGNO (1))); seq = get_insns (); @@ -2451,7 +2450,7 @@ reachable_next_level (struct eh_region *region, tree type_thrown, /* Here we end our search, since no exceptions may propagate. If we've touched down at some landing pad previous, then the explicit function call we generated may be used. Otherwise - the call is made by the runtime. + the call is made by the runtime. Before inlining, do not perform this optimization. We may inline a subroutine that contains handlers, and that will @@ -3095,7 +3094,7 @@ collect_one_action_chain (htab_t ar_hash, struct eh_region *region) Add a cleanup action to the chain to catch these. */ else if (next <= 0) next = add_action_record (ar_hash, 0, 0); - + return add_action_record (ar_hash, region->u.allowed.filter, next); case ERT_MUST_NOT_THROW: @@ -3539,6 +3538,9 @@ output_function_exception_table (void) switch_to_exception_section (); #endif + /* If the target wants a label to begin the table, emit it here. */ + targetm.asm_out.except_table_label (asm_out_file); + have_tt_data = (VEC_length (tree, cfun->eh->ttype_data) > 0 || VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) > 0); @@ -3706,7 +3708,7 @@ get_eh_throw_stmt_table (struct function *fun) } /* Dump EH information to OUT. */ -void +void dump_eh_tree (FILE *out, struct function *fun) { struct eh_region *i; @@ -3752,7 +3754,7 @@ dump_eh_tree (FILE *out, struct function *fun) /* Verify some basic invariants on EH datastructures. Could be extended to catch more. */ -void +void verify_eh_tree (struct function *fun) { struct eh_region *i, *outer = NULL; @@ -3868,8 +3870,8 @@ rest_of_handle_eh (void) struct tree_opt_pass pass_rtl_eh = { "eh", /* name */ - gate_handle_eh, /* gate */ - rest_of_handle_eh, /* execute */ + gate_handle_eh, /* gate */ + rest_of_handle_eh, /* execute */ NULL, /* sub */ NULL, /* next */ 0, /* static_pass_number */ diff --git a/gcc/output.h b/gcc/output.h index 39b24bf3228..d4fad194bb5 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -550,6 +550,7 @@ extern bool default_binds_local_p (tree); extern bool default_binds_local_p_1 (tree, int); extern void default_globalize_label (FILE *, const char *); extern void default_emit_unwind_label (FILE *, tree, int, int); +extern void default_emit_except_table_label (FILE *); extern void default_internal_label (FILE *, const char *, unsigned long); extern void default_file_start (void); extern void file_end_indicate_exec_stack (void); diff --git a/gcc/target-def.h b/gcc/target-def.h index 5848868f818..204be4e6030 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -62,6 +62,10 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define TARGET_ASM_EMIT_UNWIND_LABEL default_emit_unwind_label #endif +#ifndef TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL +#define TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL default_emit_except_table_label +#endif + #ifndef TARGET_UNWIND_EMIT #define TARGET_UNWIND_EMIT default_unwind_emit #endif @@ -221,6 +225,7 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. TARGET_ASM_INTEGER, \ TARGET_ASM_GLOBALIZE_LABEL, \ TARGET_ASM_EMIT_UNWIND_LABEL, \ + TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL, \ TARGET_UNWIND_EMIT, \ TARGET_ASM_INTERNAL_LABEL, \ TARGET_ASM_TTYPE, \ diff --git a/gcc/target.h b/gcc/target.h index 6a494631d91..8c61bfe9692 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -102,6 +102,10 @@ struct gcc_target this is only a placeholder for an omitted FDE. */ void (* unwind_label) (FILE *, tree, int, int); + /* Output code that will emit a label to divide up the exception + table. */ + void (* except_table_label) (FILE *); + /* Emit any directives required to unwind this instruction. */ void (* unwind_emit) (FILE *, rtx); @@ -373,7 +377,7 @@ struct gcc_target /* Fold a target-specific builtin. */ tree (* fold_builtin) (tree fndecl, tree arglist, bool ignore); - + /* For a vendor-specific fundamental TYPE, return a pointer to a statically-allocated string containing the C++ mangling for TYPE. In all other cases, return NULL. */ @@ -569,7 +573,7 @@ struct gcc_target specified. Use this hook if the target needs to add extra validation checks to handle_dll_attribute (). */ bool (* valid_dllimport_attribute_p) (tree decl); - + /* Functions relating to calls - argument passing, returns, etc. */ struct calls { bool (*promote_function_args) (tree fntype); @@ -620,7 +624,7 @@ struct gcc_target /* Return the diagnostic message string if function without a prototype is not allowed for this 'val' argument; NULL otherwise. */ - const char *(*invalid_arg_for_unprototyped_fn) (tree typelist, + const char *(*invalid_arg_for_unprototyped_fn) (tree typelist, tree funcdecl, tree val); /* Return an rtx for the return value location of the function @@ -677,7 +681,7 @@ struct gcc_target visibility has been explicitly specified. If the target needs to specify a visibility other than that of the containing class, use this hook to set DECL_VISIBILITY and - DECL_VISIBILITY_SPECIFIED. */ + DECL_VISIBILITY_SPECIFIED. */ void (*determine_class_data_visibility) (tree decl); /* Returns true (the default) if virtual tables and other similar implicit class data objects are always COMDAT if they @@ -691,7 +695,7 @@ struct gcc_target /* TYPE is a C++ class (i.e., RECORD_TYPE or UNION_TYPE) that has just been defined. Use this hook to make adjustments to the class (eg, tweak visibility or perform any other required - target modifications). */ + target modifications). */ void (*adjust_class_at_definition) (tree type); } cxx; diff --git a/gcc/varasm.c b/gcc/varasm.c index 5f58bf4cef6..05bfabf288d 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -435,10 +435,10 @@ section * function_section (tree decl) { int reloc = 0; - + if (first_function_block_is_cold) reloc = 1; - + #ifdef USE_SELECT_SECTION_FOR_FUNCTIONS return targetm.asm_out.select_section (decl, reloc, DECL_ALIGN (decl)); #else @@ -473,7 +473,7 @@ default_function_rodata_section (tree decl) { size_t len = strlen (name) + 3; char* rname = alloca (len); - + strcpy (rname, ".rodata"); strcat (rname, name + 5); return get_section (rname, SECTION_LINKONCE, decl); @@ -720,7 +720,7 @@ make_decl_rtl (tree decl) || TREE_PUBLIC (decl) || DECL_EXTERNAL (decl) || DECL_REGISTER (decl)); - + /* And that we were not given a type or a label. */ gcc_assert (TREE_CODE (decl) != TYPE_DECL && TREE_CODE (decl) != LABEL_DECL); @@ -755,11 +755,11 @@ make_decl_rtl (tree decl) } name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); - + if (name[0] != '*' && TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)) { - error ("register name not specified for %q+D", decl); + error ("register name not specified for %q+D", decl); } else if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl)) { @@ -1051,7 +1051,7 @@ assemble_start_function (tree decl, const char *fnname) bool hot_label_written = false; cfun->unlikely_text_section_name = NULL; - + first_function_block_is_cold = false; if (flag_reorder_blocks_and_partition) { @@ -1115,7 +1115,7 @@ assemble_start_function (tree decl, const char *fnname) initialize_cold_section_name (); - if (cfun->unlikely_text_section_name + if (cfun->unlikely_text_section_name && strcmp (TREE_STRING_POINTER (DECL_SECTION_NAME (decl)), cfun->unlikely_text_section_name) == 0) first_function_block_is_cold = true; @@ -1126,7 +1126,7 @@ assemble_start_function (tree decl, const char *fnname) /* Switch to the correct text section for the start of the function. */ switch_to_section (function_section (decl)); - if (flag_reorder_blocks_and_partition + if (flag_reorder_blocks_and_partition && !hot_label_written) ASM_OUTPUT_LABEL (asm_out_file, cfun->hot_section_label); @@ -2087,7 +2087,7 @@ assemble_integer (rtx x, unsigned int size, unsigned int align, int force) } gcc_assert (!force); - + return false; } @@ -2266,13 +2266,13 @@ const_hash_1 (const tree exp) { unsigned HOST_WIDE_INT idx; tree value; - + hi = 5 + int_size_in_bytes (TREE_TYPE (exp)); - + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (exp), idx, value) if (value) hi = hi * 603 + const_hash_1 (value); - + return hi; } @@ -2384,7 +2384,7 @@ compare_constant (const tree t1, const tree t2) { VEC(constructor_elt, gc) *v1, *v2; unsigned HOST_WIDE_INT idx; - + typecode = TREE_CODE (TREE_TYPE (t1)); if (typecode != TREE_CODE (TREE_TYPE (t2))) return 0; @@ -2432,7 +2432,7 @@ compare_constant (const tree t1, const tree t2) return 0; } } - + return 1; } @@ -2520,7 +2520,7 @@ copy_constant (tree exp) VEC(constructor_elt, gc) *v; unsigned HOST_WIDE_INT idx; tree purpose, value; - + v = VEC_alloc(constructor_elt, gc, VEC_length(constructor_elt, CONSTRUCTOR_ELTS (exp))); FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (exp), idx, purpose, value) @@ -2536,7 +2536,7 @@ copy_constant (tree exp) default: { tree t = lang_hooks.expand_constant (exp); - + gcc_assert (t == exp); return copy_constant (t); } @@ -2952,7 +2952,7 @@ force_const_mem (enum machine_mode mode, rtx x) hash = const_rtx_hash (x); slot = htab_find_slot_with_hash (pool->const_rtx_htab, &tmp, hash, INSERT); desc = *slot; - + /* If the constant was already present, return its memory. */ if (desc) return copy_rtx (desc->mem); @@ -3087,13 +3087,13 @@ output_constant_pool_2 (enum machine_mode mode, rtx x, unsigned int align) case MODE_DECIMAL_FLOAT: { REAL_VALUE_TYPE r; - + gcc_assert (GET_CODE (x) == CONST_DOUBLE); REAL_VALUE_FROM_CONST_DOUBLE (r, x); assemble_real (r, mode, align); break; } - + case MODE_INT: case MODE_PARTIAL_INT: assemble_integer (x, GET_MODE_SIZE (mode), align, 1); @@ -3226,7 +3226,7 @@ mark_constant (rtx *current_rtx, void *data) } return -1; -} +} /* Look through appropriate parts of INSN, marking all entries in the constant pool which are actually being used. Entries that are only @@ -3493,7 +3493,7 @@ initializer_constant_valid_p (tree value, tree endtype) return null_pointer_node; /* Taking the address of a nested function involves a trampoline. */ if (TREE_CODE (value) == FUNCTION_DECL - && ((decl_function_context (value) + && ((decl_function_context (value) && !DECL_NO_STATIC_CHAIN (value)) || DECL_DLLIMPORT_P (value))) return NULL_TREE; @@ -3828,12 +3828,12 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) tree link; unsigned int nalign; enum machine_mode inner; - + inner = TYPE_MODE (TREE_TYPE (TREE_TYPE (exp))); nalign = MIN (align, GET_MODE_ALIGNMENT (inner)); - + elt_size = GET_MODE_SIZE (inner); - + link = TREE_VECTOR_CST_ELTS (exp); output_constant (TREE_VALUE (link), elt_size, align); while ((link = TREE_CHAIN (link)) != NULL) @@ -3961,8 +3961,8 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size, #ifdef ASM_COMMENT_START if (field && flag_verbose_asm) fprintf (asm_out_file, "%s %s:\n", - ASM_COMMENT_START, - DECL_NAME (field) + ASM_COMMENT_START, + DECL_NAME (field) ? IDENTIFIER_POINTER (DECL_NAME (field)) : "<anonymous>"); #endif @@ -4543,7 +4543,7 @@ find_decl_and_mark_needed (tree decl, tree target) cgraph_varpool_mark_needed_node (vnode); return vnode->decl; } - else + else return NULL_TREE; } @@ -4938,10 +4938,10 @@ default_section_type_flags_1 (tree decl, const char *name, int reloc, && cfun->unlikely_text_section_name && strcmp (name, cfun->unlikely_text_section_name) == 0) flags = SECTION_CODE; - else if (!decl + else if (!decl && (!current_function_decl || !cfun) && strcmp (name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME) == 0) - flags = SECTION_CODE; + flags = SECTION_CODE; else flags = SECTION_WRITE; @@ -5055,7 +5055,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags, if (flags & SECTION_ENTSIZE) fprintf (asm_out_file, ",%d", flags & SECTION_ENTSIZE); if (HAVE_COMDAT_GROUP && (flags & SECTION_LINKONCE)) - fprintf (asm_out_file, ",%s,comdat", + fprintf (asm_out_file, ",%s,comdat", lang_hooks.decls.comdat_group (decl)); } @@ -5063,7 +5063,7 @@ default_elf_asm_named_section (const char *name, unsigned int flags, } void -default_coff_asm_named_section (const char *name, unsigned int flags, +default_coff_asm_named_section (const char *name, unsigned int flags, tree decl ATTRIBUTE_UNUSED) { char flagchars[8], *f = flagchars; @@ -5491,7 +5491,7 @@ default_binds_local_p_1 (tree exp, int shlib) local_p = true; /* A variable is local if the user has said explicitly that it will be. */ - else if (DECL_VISIBILITY_SPECIFIED (exp) + else if (DECL_VISIBILITY_SPECIFIED (exp) && DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT) local_p = true; /* Variables defined outside this object might not be local. */ @@ -5552,7 +5552,15 @@ default_emit_unwind_label (FILE * stream ATTRIBUTE_UNUSED, tree decl ATTRIBUTE_UNUSED, int for_eh ATTRIBUTE_UNUSED, int empty ATTRIBUTE_UNUSED) -{ +{ +} + +/* Default function to output a label to divide up the exception table. + The default is to do nothing. A target that needs/wants to divide + up the table must provide it's own function to do this. */ +void +default_emit_except_table_label (FILE * stream ATTRIBUTE_UNUSED) +{ } /* This is how to output an internal numbered label where PREFIX is |