Commit e86a9946 by Richard Sandiford Committed by Richard Sandiford

defaults.h (HAVE_epilogue, [...]): Delete.

gcc/
	* defaults.h (HAVE_epilogue, gen_epilogue): Delete.
	* target-insns.def (epilogue, prologue, sibcall_prologue): New
	targetm instruction patterns.
	* alias.c (init_alias_analysis): Use them instead of HAVE_*/gen_*
	interface.
	* calls.c (expand_call): Likewise.
	* cfgrtl.c (cfg_layout_finalize): Likewise.
	* df-scan.c (df_get_entry_block_def_set): Likewise.
	(df_get_exit_block_use_set): Likewise.
	* dwarf2cfi.c (pass_dwarf2_frame::gate): Likewise.
	* final.c (final_start_function): Likewise.
	* function.c (thread_prologue_and_epilogue_insns): Likewise.
	(reposition_prologue_and_epilogue_notes): Likewise.
	* reorg.c (find_end_label): Likewise.
	* toplev.c (process_options): Likewise.

From-SVN: r225208
parent ec5d0088
2015-06-30 Richard Sandiford <richard.sandiford@arm.com>
* defaults.h (HAVE_epilogue, gen_epilogue): Delete.
* target-insns.def (epilogue, prologue, sibcall_prologue): New
targetm instruction patterns.
* alias.c (init_alias_analysis): Use them instead of HAVE_*/gen_*
interface.
* calls.c (expand_call): Likewise.
* cfgrtl.c (cfg_layout_finalize): Likewise.
* df-scan.c (df_get_entry_block_def_set): Likewise.
(df_get_exit_block_use_set): Likewise.
* dwarf2cfi.c (pass_dwarf2_frame::gate): Likewise.
* final.c (final_start_function): Likewise.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
(reposition_prologue_and_epilogue_notes): Likewise.
* reorg.c (find_end_label): Likewise.
* toplev.c (process_options): Likewise.
2015-06-30 David Malcolm <dmalcolm@redhat.com> 2015-06-30 David Malcolm <dmalcolm@redhat.com>
* typed-splay-tree.h: New file. * typed-splay-tree.h: New file.
......
...@@ -3038,6 +3038,14 @@ init_alias_analysis (void) ...@@ -3038,6 +3038,14 @@ init_alias_analysis (void)
rpo = XNEWVEC (int, n_basic_blocks_for_fn (cfun)); rpo = XNEWVEC (int, n_basic_blocks_for_fn (cfun));
rpo_cnt = pre_and_rev_post_order_compute (NULL, rpo, false); rpo_cnt = pre_and_rev_post_order_compute (NULL, rpo, false);
/* The prologue/epilogue insns are not threaded onto the
insn chain until after reload has completed. Thus,
there is no sense wasting time checking if INSN is in
the prologue/epilogue until after reload has completed. */
bool could_be_prologue_epilogue = ((targetm.have_prologue ()
|| targetm.have_epilogue ())
&& reload_completed);
pass = 0; pass = 0;
do do
{ {
...@@ -3076,17 +3084,7 @@ init_alias_analysis (void) ...@@ -3076,17 +3084,7 @@ init_alias_analysis (void)
{ {
rtx note, set; rtx note, set;
#if defined (HAVE_prologue) if (could_be_prologue_epilogue
static const bool prologue = true;
#else
static const bool prologue = false;
#endif
/* The prologue/epilogue insns are not threaded onto the
insn chain until after reload has completed. Thus,
there is no sense wasting time checking if INSN is in
the prologue/epilogue until after reload has completed. */
if ((prologue || HAVE_epilogue) && reload_completed
&& prologue_epilogue_contains (insn)) && prologue_epilogue_contains (insn))
continue; continue;
......
...@@ -2783,13 +2783,8 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2783,13 +2783,8 @@ expand_call (tree exp, rtx target, int ignore)
try_tail_call = 0; try_tail_call = 0;
/* Rest of purposes for tail call optimizations to fail. */ /* Rest of purposes for tail call optimizations to fail. */
if ( if (!try_tail_call
#ifdef HAVE_sibcall_epilogue || !targetm.have_sibcall_epilogue ()
!HAVE_sibcall_epilogue
#else
1
#endif
|| !try_tail_call
/* Doing sibling call optimization needs some work, since /* Doing sibling call optimization needs some work, since
structure_value_addr can be allocated on the stack. structure_value_addr can be allocated on the stack.
It does not seem worth the effort since few optimizable It does not seem worth the effort since few optimizable
......
...@@ -4324,7 +4324,7 @@ cfg_layout_finalize (void) ...@@ -4324,7 +4324,7 @@ cfg_layout_finalize (void)
#endif #endif
force_one_exit_fallthru (); force_one_exit_fallthru ();
rtl_register_cfg_hooks (); rtl_register_cfg_hooks ();
if (reload_completed && !HAVE_epilogue) if (reload_completed && !targetm.have_epilogue ())
fixup_fallthru_exit_predecessor (); fixup_fallthru_exit_predecessor ();
fixup_reorder_chain (); fixup_reorder_chain ();
......
...@@ -1426,16 +1426,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -1426,16 +1426,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_VTABLE_USES_DESCRIPTORS 0 #define TARGET_VTABLE_USES_DESCRIPTORS 0
#endif #endif
#ifndef HAVE_epilogue
#define HAVE_epilogue 0
static inline rtx
gen_epilogue ()
{
gcc_unreachable ();
return NULL;
}
#endif
#ifndef HAVE_mem_thread_fence #ifndef HAVE_mem_thread_fence
#define HAVE_mem_thread_fence 0 #define HAVE_mem_thread_fence 0
static inline rtx static inline rtx
......
...@@ -52,13 +52,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -52,13 +52,6 @@ along with GCC; see the file COPYING3. If not see
typedef struct df_mw_hardreg *df_mw_hardreg_ptr; typedef struct df_mw_hardreg *df_mw_hardreg_ptr;
#ifndef HAVE_prologue
#define HAVE_prologue 0
#endif
#ifndef HAVE_sibcall_epilogue
#define HAVE_sibcall_epilogue 0
#endif
/* The set of hard registers in eliminables[i].from. */ /* The set of hard registers in eliminables[i].from. */
static HARD_REG_SET elim_reg_set; static HARD_REG_SET elim_reg_set;
...@@ -3523,7 +3516,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs) ...@@ -3523,7 +3516,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
/* Once the prologue has been generated, all of these registers /* Once the prologue has been generated, all of these registers
should just show up in the first regular block. */ should just show up in the first regular block. */
if (HAVE_prologue && epilogue_completed) if (targetm.have_prologue () && epilogue_completed)
{ {
/* Defs for the callee saved registers are inserted so that the /* Defs for the callee saved registers are inserted so that the
pushes have some defining location. */ pushes have some defining location. */
...@@ -3701,7 +3694,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses) ...@@ -3701,7 +3694,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
if (global_regs[i] || EPILOGUE_USES (i)) if (global_regs[i] || EPILOGUE_USES (i))
bitmap_set_bit (exit_block_uses, i); bitmap_set_bit (exit_block_uses, i);
if (HAVE_epilogue && epilogue_completed) if (targetm.have_epilogue () && epilogue_completed)
{ {
/* Mark all call-saved registers that we actually used. */ /* Mark all call-saved registers that we actually used. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
...@@ -3721,7 +3714,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses) ...@@ -3721,7 +3714,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
} }
#ifdef EH_RETURN_STACKADJ_RTX #ifdef EH_RETURN_STACKADJ_RTX
if ((!HAVE_epilogue || ! epilogue_completed) if ((!targetm.have_epilogue () || ! epilogue_completed)
&& crtl->calls_eh_return) && crtl->calls_eh_return)
{ {
rtx tmp = EH_RETURN_STACKADJ_RTX; rtx tmp = EH_RETURN_STACKADJ_RTX;
...@@ -3731,7 +3724,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses) ...@@ -3731,7 +3724,7 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
#endif #endif
#ifdef EH_RETURN_HANDLER_RTX #ifdef EH_RETURN_HANDLER_RTX
if ((!HAVE_epilogue || ! epilogue_completed) if ((!targetm.have_epilogue () || ! epilogue_completed)
&& crtl->calls_eh_return) && crtl->calls_eh_return)
{ {
rtx tmp = EH_RETURN_HANDLER_RTX; rtx tmp = EH_RETURN_HANDLER_RTX;
......
...@@ -3476,11 +3476,10 @@ public: ...@@ -3476,11 +3476,10 @@ public:
bool bool
pass_dwarf2_frame::gate (function *) pass_dwarf2_frame::gate (function *)
{ {
#ifndef HAVE_prologue
/* Targets which still implement the prologue in assembler text /* Targets which still implement the prologue in assembler text
cannot use the generic dwarf2 unwinding. */ cannot use the generic dwarf2 unwinding. */
return false; if (!targetm.have_prologue ())
#endif return false;
/* ??? What to do for UI_TARGET unwinding? They might be able to benefit /* ??? What to do for UI_TARGET unwinding? They might be able to benefit
from the optimized shrink-wrapping annotations that we will compute. from the optimized shrink-wrapping annotations that we will compute.
......
...@@ -1803,12 +1803,8 @@ final_start_function (rtx_insn *first, FILE *file, ...@@ -1803,12 +1803,8 @@ final_start_function (rtx_insn *first, FILE *file,
if the profiling code comes after the prologue. */ if the profiling code comes after the prologue. */
if (targetm.profile_before_prologue () && crtl->profile) if (targetm.profile_before_prologue () && crtl->profile)
{ {
if (targetm.asm_out.function_prologue if (targetm.asm_out.function_prologue == default_function_pro_epilogue
== default_function_pro_epilogue && targetm.have_prologue ())
#ifdef HAVE_prologue
&& HAVE_prologue
#endif
)
{ {
rtx_insn *insn; rtx_insn *insn;
for (insn = first; insn; insn = NEXT_INSN (insn)) for (insn = first; insn; insn = NEXT_INSN (insn))
...@@ -1864,9 +1860,7 @@ final_start_function (rtx_insn *first, FILE *file, ...@@ -1864,9 +1860,7 @@ final_start_function (rtx_insn *first, FILE *file,
/* If the machine represents the prologue as RTL, the profiling code must /* If the machine represents the prologue as RTL, the profiling code must
be emitted when NOTE_INSN_PROLOGUE_END is scanned. */ be emitted when NOTE_INSN_PROLOGUE_END is scanned. */
#ifdef HAVE_prologue if (! targetm.have_prologue ())
if (! HAVE_prologue)
#endif
profile_after_prologue (file); profile_after_prologue (file);
} }
......
...@@ -5864,11 +5864,10 @@ thread_prologue_and_epilogue_insns (void) ...@@ -5864,11 +5864,10 @@ thread_prologue_and_epilogue_insns (void)
} }
prologue_seq = NULL; prologue_seq = NULL;
#ifdef HAVE_prologue if (targetm.have_prologue ())
if (HAVE_prologue)
{ {
start_sequence (); start_sequence ();
rtx_insn *seq = safe_as_a <rtx_insn *> (gen_prologue ()); rtx_insn *seq = targetm.gen_prologue ();
emit_insn (seq); emit_insn (seq);
/* Insert an explicit USE for the frame pointer /* Insert an explicit USE for the frame pointer
...@@ -5890,7 +5889,6 @@ thread_prologue_and_epilogue_insns (void) ...@@ -5890,7 +5889,6 @@ thread_prologue_and_epilogue_insns (void)
end_sequence (); end_sequence ();
set_insn_locations (prologue_seq, prologue_location); set_insn_locations (prologue_seq, prologue_location);
} }
#endif
bitmap_initialize (&bb_flags, &bitmap_default_obstack); bitmap_initialize (&bb_flags, &bitmap_default_obstack);
...@@ -5995,11 +5993,11 @@ thread_prologue_and_epilogue_insns (void) ...@@ -5995,11 +5993,11 @@ thread_prologue_and_epilogue_insns (void)
if (exit_fallthru_edge == NULL) if (exit_fallthru_edge == NULL)
goto epilogue_done; goto epilogue_done;
if (HAVE_epilogue) if (targetm.have_epilogue ())
{ {
start_sequence (); start_sequence ();
epilogue_end = emit_note (NOTE_INSN_EPILOGUE_BEG); epilogue_end = emit_note (NOTE_INSN_EPILOGUE_BEG);
rtx_insn *seq = as_a <rtx_insn *> (gen_epilogue ()); rtx_insn *seq = targetm.gen_epilogue ();
if (seq) if (seq)
emit_jump_insn (seq); emit_jump_insn (seq);
...@@ -6070,7 +6068,6 @@ epilogue_done: ...@@ -6070,7 +6068,6 @@ epilogue_done:
convert_to_simple_return (entry_edge, orig_entry_edge, bb_flags, convert_to_simple_return (entry_edge, orig_entry_edge, bb_flags,
returnjump, unconverted_simple_returns); returnjump, unconverted_simple_returns);
#ifdef HAVE_sibcall_epilogue
/* Emit sibling epilogues before any sibling call sites. */ /* Emit sibling epilogues before any sibling call sites. */
for (ei = ei_start (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds); (e = for (ei = ei_start (EXIT_BLOCK_PTR_FOR_FN (cfun)->preds); (e =
ei_safe_edge (ei)); ei_safe_edge (ei));
...@@ -6078,7 +6075,6 @@ epilogue_done: ...@@ -6078,7 +6075,6 @@ epilogue_done:
{ {
basic_block bb = e->src; basic_block bb = e->src;
rtx_insn *insn = BB_END (bb); rtx_insn *insn = BB_END (bb);
rtx ep_seq;
if (!CALL_P (insn) if (!CALL_P (insn)
|| ! SIBLING_CALL_P (insn) || ! SIBLING_CALL_P (insn)
...@@ -6090,8 +6086,7 @@ epilogue_done: ...@@ -6090,8 +6086,7 @@ epilogue_done:
continue; continue;
} }
ep_seq = gen_sibcall_epilogue (); if (rtx_insn *ep_seq = targetm.gen_sibcall_epilogue ())
if (ep_seq)
{ {
start_sequence (); start_sequence ();
emit_note (NOTE_INSN_EPILOGUE_BEG); emit_note (NOTE_INSN_EPILOGUE_BEG);
...@@ -6109,7 +6104,6 @@ epilogue_done: ...@@ -6109,7 +6104,6 @@ epilogue_done:
} }
ei_next (&ei); ei_next (&ei);
} }
#endif
if (epilogue_end) if (epilogue_end)
{ {
...@@ -6143,10 +6137,10 @@ epilogue_done: ...@@ -6143,10 +6137,10 @@ epilogue_done:
void void
reposition_prologue_and_epilogue_notes (void) reposition_prologue_and_epilogue_notes (void)
{ {
#if ! defined (HAVE_prologue) && ! defined (HAVE_sibcall_epilogue) if (!targetm.have_prologue ()
if (!HAVE_epilogue) && !targetm.have_epilogue ()
&& !targetm.have_sibcall_epilogue ())
return; return;
#endif
/* Since the hash table is created on demand, the fact that it is /* Since the hash table is created on demand, the fact that it is
non-null is a signal that it is non-empty. */ non-null is a signal that it is non-empty. */
......
...@@ -473,7 +473,7 @@ find_end_label (rtx kind) ...@@ -473,7 +473,7 @@ find_end_label (rtx kind)
} }
else else
{ {
if (HAVE_epilogue && ! targetm.have_return ()) if (targetm.have_epilogue () && ! targetm.have_return ())
/* The RETURN insn has its delay slot filled so we cannot /* The RETURN insn has its delay slot filled so we cannot
emit the label just before it. Since we already have emit the label just before it. Since we already have
an epilogue and cannot emit a new RETURN, we cannot an epilogue and cannot emit a new RETURN, we cannot
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
Patterns that take no operands should have a prototype "(void)". Patterns that take no operands should have a prototype "(void)".
Instructions should be documented in md.texi rather than here. */ Instructions should be documented in md.texi rather than here. */
DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1))
DEF_TARGET_INSN (epilogue, (void))
DEF_TARGET_INSN (prologue, (void))
DEF_TARGET_INSN (return, (void)) DEF_TARGET_INSN (return, (void))
DEF_TARGET_INSN (sibcall_epilogue, (void))
DEF_TARGET_INSN (simple_return, (void)) DEF_TARGET_INSN (simple_return, (void))
DEF_TARGET_INSN (canonicalize_funcptr_for_compare, (rtx x0, rtx x1))
...@@ -112,10 +112,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -112,10 +112,6 @@ along with GCC; see the file COPYING3. If not see
declarations for e.g. AIX 4.x. */ declarations for e.g. AIX 4.x. */
#endif #endif
#ifndef HAVE_prologue
#define HAVE_prologue 0
#endif
#include <new> #include <new>
static void general_init (const char *, bool); static void general_init (const char *, bool);
...@@ -1660,7 +1656,7 @@ process_options (void) ...@@ -1660,7 +1656,7 @@ process_options (void)
/* Do not use IPA optimizations for register allocation if profiler is active /* Do not use IPA optimizations for register allocation if profiler is active
or port does not emit prologue and epilogue as RTL. */ or port does not emit prologue and epilogue as RTL. */
if (profile_flag || !HAVE_prologue || !HAVE_epilogue) if (profile_flag || !targetm.have_prologue () || !targetm.have_epilogue ())
flag_ipa_ra = 0; flag_ipa_ra = 0;
/* Enable -Werror=coverage-mismatch when -Werror and -Wno-error /* Enable -Werror=coverage-mismatch when -Werror and -Wno-error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment