summaryrefslogtreecommitdiff
path: root/gcc/stack-ptr-mod.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-22 12:56:47 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-22 12:56:47 +0000
commit030087e31b1253fb9ed6835a82e93a61ccc02493 (patch)
treee2bc6c7177a42d1b832555b60d0a854bcb834bd0 /gcc/stack-ptr-mod.c
parentb4f314ea97f04620d290f3ae25d831f46692864f (diff)
parentac875fa40bf5429aff0612943d8c5705c4e11bb5 (diff)
downloadgcc-030087e31b1253fb9ed6835a82e93a61ccc02493.tar.gz
Merge from trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@209623 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stack-ptr-mod.c')
-rw-r--r--gcc/stack-ptr-mod.c74
1 files changed, 34 insertions, 40 deletions
diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index 6b78085f1d4..75bec2fbdcd 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -48,48 +48,10 @@ notice_stack_pointer_modification_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED,
crtl->sp_is_unchanging = 0;
}
-static void
-notice_stack_pointer_modification (void)
-{
- basic_block bb;
- rtx insn;
-
- /* Assume that the stack pointer is unchanging if alloca hasn't
- been used. */
- crtl->sp_is_unchanging = !cfun->calls_alloca;
- if (crtl->sp_is_unchanging)
- FOR_EACH_BB_FN (bb, cfun)
- FOR_BB_INSNS (bb, insn)
- {
- if (INSN_P (insn))
- {
- /* Check if insn modifies the stack pointer. */
- note_stores (PATTERN (insn),
- notice_stack_pointer_modification_1,
- NULL);
- if (! crtl->sp_is_unchanging)
- return;
- }
- }
-
- /* The value coming into this pass was 0, and the exit block uses
- are based on this. If the value is now 1, we need to redo the
- exit block uses. */
- if (df && crtl->sp_is_unchanging)
- df_update_exit_block_uses ();
-}
-
/* Some targets can emit simpler epilogues if they know that sp was
not ever modified during the function. After reload, of course,
we've already emitted the epilogue so there's no sense searching. */
-static unsigned int
-rest_of_handle_stack_ptr_mod (void)
-{
- notice_stack_pointer_modification ();
- return 0;
-}
-
namespace {
const pass_data pass_data_stack_ptr_mod =
@@ -97,7 +59,6 @@ const pass_data pass_data_stack_ptr_mod =
RTL_PASS, /* type */
"*stack_ptr_mod", /* name */
OPTGROUP_NONE, /* optinfo_flags */
- false, /* has_gate */
true, /* has_execute */
TV_NONE, /* tv_id */
0, /* properties_required */
@@ -115,10 +76,43 @@ public:
{}
/* opt_pass methods: */
- unsigned int execute () { return rest_of_handle_stack_ptr_mod (); }
+ virtual unsigned int execute (function *);
}; // class pass_stack_ptr_mod
+unsigned int
+pass_stack_ptr_mod::execute (function *fun)
+{
+ basic_block bb;
+ rtx insn;
+
+ /* Assume that the stack pointer is unchanging if alloca hasn't
+ been used. */
+ crtl->sp_is_unchanging = !fun->calls_alloca;
+ if (crtl->sp_is_unchanging)
+ FOR_EACH_BB_FN (bb, fun)
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (INSN_P (insn))
+ {
+ /* Check if insn modifies the stack pointer. */
+ note_stores (PATTERN (insn),
+ notice_stack_pointer_modification_1,
+ NULL);
+ if (! crtl->sp_is_unchanging)
+ return 0;
+ }
+ }
+
+ /* The value coming into this pass was 0, and the exit block uses
+ are based on this. If the value is now 1, we need to redo the
+ exit block uses. */
+ if (df && crtl->sp_is_unchanging)
+ df_update_exit_block_uses ();
+
+ return 0;
+}
+
} // anon namespace
rtl_opt_pass *