This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove more remnants of deleted RTL passes
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 15 Jun 2004 09:21:27 +0200
- Subject: [PATCH] Remove more remnants of deleted RTL passes
The first remnant is cfun->current_inline. This field is only read by
the C++ front-end, not even by the middle-end. Other front-ends only
write to it. Objective-C does so while setting DECL_INLINE and
DECL_UNINLINABLE. Java does not do anything else in
emit_register_classes, and disables flag_inline_functions around the
call to rest_of_compilation in write_resource_constructor (useless since
rest_of_compilation does not look at it!).
What happens in C++ is:
- start_objects or start_static_storage_duration_function set it
- it is copied to struct language_function in save_function_data, and at
the same time DECL_INLINE is reset to 0.
- it is restored in cxx_push_function_context.
- nobody then uses it.
So it is easier to reset DECL_INLINE (and since I was at it, set
DECL_UNINLINABLE) right in start_objects and
start_static_storage_duration_function. I fixed Java to do the same
where it used to set cfun->current_inline.
The second is that in rest_of_compilation, extra effort is done if
"-fsyntax-only -Wreturn-type" is active, but now that warning was moved
to the tree level, so this is useless.
The third is that rest_of_compilation now will definitely output the
function, so it is possible to reset DECL_DEFER_OUTPUT there, and
simplify a couple of conditionals based on that.
Bootstrapped/regtested i686-pc-linux-gnu, ok for mainline?
Paolo
gcc/ChangeLog:
2004-06-13 Paolo Bonzini <bonzini@gnu.org>
* function.h (struct function): Remove cannot_inline field.
(current_function_cannot_inline): Remove.
* passes.c (rest_of_compilation): Reset DECL_DEFER_OUTPUT.
Simplify conditionals to ignore warn_return_type.
* tree-optimize.c (tree_rest_of_compilation): Do not reset
DECL_DEFER_OUTPUT.
gcc/cp/ChangeLog:
2004-06-13 Paolo Bonzini <bonzini@gnu.org>
* cp/cp-tree.h (struct language_function): Remove cannot_inline.
* cp/decl.c (save_function_data): cannot_inline is no more.
(cxx_push_function_context): Likewise.
* cp/decl2.c (start_objects, start_static_storage_duration_function):
Reset DECL_INLINE, set DECL_UNINLINABLE.
gcc/java/ChangeLog:
2004-06-13 Paolo Bonzini <bonzini@gnu.org>
* java/class.c (emit_register_classes): Make the function uninlinable,
do not set current_function_cannot_inline.
* java/resource.c (write_resource_constructor): Do not reset
flag_inline_functions around rest_of_compilation.
gcc/objc/ChangeLog:
2004-06-13 Paolo Bonzini <bonzini@gnu.org>
* objc/objc-act.c (build_module_descriptor, finish_method_def):
Do not set current_function_cannot_inline.
Index: passes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/passes.c,v
retrieving revision 2.17
diff -u -r2.17 passes.c
--- passes.c 30 May 2004 18:32:27 -0000 2.17
+++ passes.c 14 Jun 2004 10:23:18 -0000
@@ -1353,6 +1437,10 @@
rtx insns;
timevar_push (TV_REST_OF_COMPILATION);
+
+ /* There's no need to defer outputting this function any more; we
+ know we want to output it. */
+ DECL_DEFER_OUTPUT (current_function_decl) = 0;
/* Register rtl specific functions for cfg. */
rtl_register_cfg_hooks ();
@@ -1425,8 +1513,7 @@
/* Initialize some variables used by the optimizers. */
init_function_for_compilation ();
- if (! DECL_DEFER_OUTPUT (decl))
- TREE_ASM_WRITTEN (decl) = 1;
+ TREE_ASM_WRITTEN (decl) = 1;
/* Now that integrate will no longer see our rtl, we need not
distinguish between the return value of this function and the
@@ -1438,10 +1525,8 @@
purge_hard_subreg_sets (get_insns ());
/* Early return if there were errors. We can run afoul of our
- consistency checks, and there's not really much point in fixing them.
- Don't return yet if -Wreturn-type; we need to do cleanup_cfg. */
- if (((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
- || errorcount || sorrycount)
+ consistency checks, and there's not really much point in fixing them. */
+ if (rtl_dump_and_exit || flag_syntax_only || errorcount || sorrycount)
goto exit_rest_of_compilation;
timevar_push (TV_JUMP);
@@ -1534,15 +1619,8 @@
purge_line_number_notes (insns);
- timevar_pop (TV_JUMP);
close_dump_file (DFI_jump, print_rtl, insns);
- /* Now is when we stop if -fsyntax-only and -Wreturn-type. */
- if (rtl_dump_and_exit || flag_syntax_only || DECL_DEFER_OUTPUT (decl))
- goto exit_rest_of_compilation;
-
- timevar_push (TV_JUMP);
-
if (optimize)
cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_PRE_LOOP);
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.16
diff -u -r2.16 tree-optimize.c
--- tree-optimize.c 15 May 2004 23:07:52 -0000 2.16
+++ tree-optimize.c 14 Jun 2004 10:23:18 -0000
@@ -522,12 +514,8 @@
if (nested_p)
ggc_push_context ();
- /* There's no need to defer outputting this function any more; we
- know we want to output it. */
- DECL_DEFER_OUTPUT (fndecl) = 0;
-
/* Run the optimizers and output the assembler code for this function. */
rest_of_compilation (fndecl);
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.116
diff -u -r1.116 function.h
--- function.h 3 Jun 2004 12:07:41 -0000 1.116
+++ function.h 14 Jun 2004 10:23:19 -0000
@@ -232,10 +232,6 @@
/* The arg pointer hard register, or the pseudo into which it was copied. */
rtx internal_arg_pointer;
- /* Language-specific reason why the current function cannot be made
- inline. */
- const char *cannot_inline;
-
/* Opaque pointer used by get_hard_reg_initial_val and
has_hard_reg_initial_val (see integrate.[hc]). */
struct initial_value_struct *hard_reg_initial_vals;
@@ -542,7 +538,6 @@
#define current_function_limit_stack (cfun->limit_stack)
#define current_function_uses_pic_offset_table (cfun->uses_pic_offset_table)
#define current_function_uses_const_pool (cfun->uses_const_pool)
-#define current_function_cannot_inline (cfun->cannot_inline)
#define current_function_epilogue_delay_list (cfun->epilogue_delay_list)
#define current_function_has_nonlocal_label (cfun->has_nonlocal_label)
#define current_function_has_nonlocal_goto (cfun->has_nonlocal_goto)
Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.184
diff -u -r1.184 class.c
--- java/class.c 13 May 2004 06:40:34 -0000 1.184
+++ java/class.c 14 Jun 2004 10:23:19 -0000
@@ -2293,6 +2293,8 @@
DECL_SOURCE_LINE (init_decl) = 0;
TREE_STATIC (init_decl) = 1;
current_function_decl = init_decl;
+ DECL_INLINE (init_decl) = 0;
+ DECL_UNINLINABLE (init_decl) = 1;
DECL_RESULT (init_decl) = build_decl (RESULT_DECL, NULL_TREE,
void_type_node);
@@ -2308,17 +2310,13 @@
init_function_start (init_decl);
expand_function_start (init_decl, 0);
- /* Do not allow the function to be deferred. */
- current_function_cannot_inline
- = "static constructors and destructors cannot be inlined";
-
for ( t = registered_class; t; t = TREE_CHAIN (t))
emit_library_call (registerClass_libfunc, 0, VOIDmode, 1,
XEXP (DECL_RTL (t), 0), Pmode);
Index: java/resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/resource.c,v
retrieving revision 1.11
diff -u -r1.11 resource.c
--- java/resource.c 13 May 2004 06:40:37 -0000 1.11
+++ java/resource.c 14 Jun 2004 10:23:19 -0000
@@ -151,14 +151,10 @@
input_location = DECL_SOURCE_LOCATION (init_decl);
expand_function_end ();
poplevel (1, 0, 1);
- {
- /* Force generation, even with -O3 or deeper. Gross hack.
- FIXME. */
- int saved_flag = flag_inline_functions;
- flag_inline_functions = 0;
- rest_of_compilation (init_decl);
- flag_inline_functions = saved_flag;
- }
+
+ /* rest_of_compilation forces generation even if -finline-functions. */
+ rest_of_compilation (init_decl);
+
current_function_decl = NULL_TREE;
if (targetm.have_ctors_dtors)
targetm.asm_out.constructor (XEXP (DECL_RTL (init_decl), 0),
Index: objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.217
diff -u -r1.217 objc-act.c
--- objc/objc-act.c 13 Jun 2004 17:14:09 -0000 1.217
+++ objc/objc-act.c 14 Jun 2004 10:23:22 -0000
@@ -1910,8 +1910,6 @@
/* Don't let this one be deferred. */
DECL_INLINE (init_function_decl) = 0;
DECL_UNINLINABLE (init_function_decl) = 1;
- current_function_cannot_inline
- = "static constructors and destructors cannot be inlined";
parms
= build_tree_list (NULL_TREE,
@@ -7981,7 +7979,6 @@
dispatched, so suppress all thoughts of doing so. */
DECL_INLINE (current_function_decl) = 0;
DECL_UNINLINABLE (current_function_decl) = 1;
- current_function_cannot_inline = "methods cannot be inlined";
finish_function ();
lang_expand_function_end = NULL;
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.974
diff -u -r1.974 cp/cp-tree.h
--- cp/cp-tree.h 7 Jun 2004 02:10:55 -0000 1.974
+++ cp/cp-tree.h 14 Jun 2004 11:09:40 -0000
@@ -773,8 +773,6 @@
struct named_label_list *x_named_labels;
struct cp_binding_level *bindings;
varray_type x_local_names;
-
- const char *cannot_inline;
};
/* The current C++-specific per-function global variables. */
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1214
diff -u -r1.1214 cp/decl.c
--- cp/decl.c 13 Jun 2004 21:41:45 -0000 1.1214
+++ cp/decl.c 14 Jun 2004 11:09:43 -0000
@@ -10490,15 +10490,6 @@
f->x_named_label_uses = NULL;
f->bindings = NULL;
f->x_local_names = NULL;
-
- /* If we've already decided that we cannot inline this function, we
- must remember that fact when we actually go to expand the
- function. */
- if (current_function_cannot_inline)
- {
- f->cannot_inline = current_function_cannot_inline;
- DECL_INLINE (decl) = 0;
- }
}
/* Add a note to mark the beginning of the main body of the constructor.
@@ -11155,11 +11146,6 @@
now, restore saved state. */
*cp_function_chain = *DECL_SAVED_FUNCTION_DATA (fn);
- /* If we decided that we didn't want to inline this function,
- make sure the back-end knows that. */
- if (!current_function_cannot_inline)
- current_function_cannot_inline = cp_function_chain->cannot_inline;
-
/* We don't need the saved data anymore. Unless this is an inline
function; we need the named return value info for
cp_copy_res_decl_for_inlining. */
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.713
diff -u -r1.713 cp/decl2.c
--- cp/decl2.c 3 Jun 2004 23:15:01 -0000 1.713
+++ cp/decl2.c 14 Jun 2004 11:09:43 -0000
@@ -1976,8 +1976,8 @@
have external linkage. And, there's no point in deferring
compilation of thes functions; they're all going to have to be
out anyhow. */
- current_function_cannot_inline
- = "static constructors and destructors cannot be inlined";
+ DECL_INLINE (current_function_decl) = 0;
+ DECL_UNINLINABLE (current_function_decl) = 1;
return body;
}
@@ -2131,8 +2131,8 @@
/* This function must not be deferred because we are depending on
its compilation to tell us what is TREE_SYMBOL_REFERENCED. */
- current_function_cannot_inline
- = "static storage duration functions cannot be inlined";
+ DECL_INLINE (ssdf_decl) = 0;
+ DECL_UNINLINABLE (ssdf_decl) = 1;
return body;
}