aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-04-15 18:43:32 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-04-15 18:43:32 +0000
commit5283d1ecc4ed755bca87e31afd0deaf8af17591a (patch)
tree4cffd5a80e733e7a6761c0ee546bd4e5bf937ede /gcc/function.c
parent3a1351b9daff403b268b4e08313bcbafe476be33 (diff)
downloadgcc-5283d1ecc4ed755bca87e31afd0deaf8af17591a.zip
gcc-5283d1ecc4ed755bca87e31afd0deaf8af17591a.tar.gz
gcc-5283d1ecc4ed755bca87e31afd0deaf8af17591a.tar.bz2
Fix fdump-passes
2015-04-15 Tom de Vries <tom@codesourcery.com> PR other/65487 * function.c (push_dummy_function): New function. (init_dummy_function_start): Use push_dummy_function. (pop_dummy_function): New function. Factored out of ... (expand_dummy_function_end): ... here. * function.h (push_dummy_function, pop_dummy_function): Declare. * passes.c (pass_manager::dump_passes): Use push_dummy_function and pop_dummy_function. * tree-chkp.c (chkp_gate): Handle cgraph_node::get (cfun->decl) == NULL. From-SVN: r222129
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/gcc/function.c b/gcc/function.c
index cb974bf..7d4df92 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4862,6 +4862,29 @@ prepare_function_start (void)
frame_pointer_needed = 0;
}
+void
+push_dummy_function (bool with_decl)
+{
+ tree fn_decl, fn_type, fn_result_decl;
+
+ gcc_assert (!in_dummy_function);
+ in_dummy_function = true;
+
+ if (with_decl)
+ {
+ fn_type = build_function_type_list (void_type_node, NULL_TREE);
+ fn_decl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, NULL_TREE,
+ fn_type);
+ fn_result_decl = build_decl (UNKNOWN_LOCATION, RESULT_DECL,
+ NULL_TREE, void_type_node);
+ DECL_RESULT (fn_decl) = fn_result_decl;
+ }
+ else
+ fn_decl = NULL_TREE;
+
+ push_struct_function (fn_decl);
+}
+
/* Initialize the rtl expansion mechanism so that we can do simple things
like generate sequences. This is used to provide a context during global
initialization of some passes. You must call expand_dummy_function_end
@@ -4870,9 +4893,7 @@ prepare_function_start (void)
void
init_dummy_function_start (void)
{
- gcc_assert (!in_dummy_function);
- in_dummy_function = true;
- push_struct_function (NULL_TREE);
+ push_dummy_function (false);
prepare_function_start ();
}
@@ -5144,6 +5165,13 @@ expand_function_start (tree subr)
stack_check_probe_note = emit_note (NOTE_INSN_DELETED);
}
+void
+pop_dummy_function (void)
+{
+ pop_cfun ();
+ in_dummy_function = false;
+}
+
/* Undo the effects of init_dummy_function_start. */
void
expand_dummy_function_end (void)
@@ -5159,8 +5187,7 @@ expand_dummy_function_end (void)
free_after_parsing (cfun);
free_after_compilation (cfun);
- pop_cfun ();
- in_dummy_function = false;
+ pop_dummy_function ();
}
/* Helper for diddle_return_value. */