This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Remove filename and lineno from expand_function_end
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Zack Weinberg <zack at codesourcery dot com>
- Date: Thu, 19 Jun 2003 10:06:44 +0100
- Subject: Re: [PATCH]: Remove filename and lineno from expand_function_end
- Organization: Codesourcery LLC
- References: <3EEEDCEA.5080106@codesourcery.com>
Nathan Sidwell wrote:
Hi,
this patch removes the filename and lineno parameters from
expand_function_end. In all but two cases input_filename and input_lineno
were passed. The two exceptions were in java, where zero was passed as
the linenumber. Those two places I changed to set the input_location
before calling. This looks safe, as both places are called at the
end of file compilation.
Zack pointed out that the end_bindings parameter was also always zero,
so this patch removes that too, and is more defensive about clobbering
input_location in java.
booted & tested on i686-pc-linux-gnu, ok?
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2003-06-17 Nathan Sidwell <nathan@codesourcery.com>
* tree.h (expand_function_end): Remove all parameters.
* function.c (expand_function_end): Remove all parameters.
Use input_location. Never expand_end_bindings.
* c-decl.c (c_expand_body_1): Adjust expand_function_end call.
* coverage.c (create_coverage): Likewise.
* ada/utils.c (end_subprog_body): Adjust expand_function_end
call.
* cp/semantics.c (genrtl_finish_function): Adjust
expand_function_end call.
* f/com.c (finish_function): Adjust expand_function_end call.
* java/class.c (push_class): Use a location_t to save place.
(emit_register_classes): Set input_location. Adjust
expand_function_end call.
* java/resource.c (write_resource_constructor): Likewise.
* java/decl.c (end_java_method): Adjust expand_function_end call.
* java/parse.y (source_end_java_method): Likewise.
* treelang/treetree.c (tree_code_create_function_wrapup): Adjust
expand_function_end call.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.394
diff -c -3 -p -r1.394 c-decl.c
*** c-decl.c 14 Jun 2003 17:33:23 -0000 1.394
--- c-decl.c 18 Jun 2003 19:55:36 -0000
*************** c_expand_body_1 (fndecl, nested_p)
*** 6467,6473 ****
(*lang_expand_function_end) ();
/* Generate rtl for function exit. */
! expand_function_end (input_filename, input_line, 0);
/* If this is a nested function, protect the local variables in the stack
above us from being collected while we're compiling this function. */
--- 6467,6473 ----
(*lang_expand_function_end) ();
/* Generate rtl for function exit. */
! expand_function_end ();
/* If this is a nested function, protect the local variables in the stack
above us from being collected while we're compiling this function. */
Index: coverage.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/coverage.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 coverage.c
*** coverage.c 14 Jun 2003 17:33:23 -0000 1.11
--- coverage.c 18 Jun 2003 19:55:38 -0000
*************** create_coverage ()
*** 866,872 ****
emit_library_call (gcov_init_libfunc, LCT_NORMAL, VOIDmode, 1,
gcov_info_address, Pmode);
! expand_function_end (input_filename, input_line, 0);
(*lang_hooks.decls.poplevel) (1, 0, 1);
rest_of_compilation (ctor);
--- 866,872 ----
emit_library_call (gcov_init_libfunc, LCT_NORMAL, VOIDmode, 1,
gcov_info_address, Pmode);
! expand_function_end ();
(*lang_hooks.decls.poplevel) (1, 0, 1);
rest_of_compilation (ctor);
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.437
diff -c -3 -p -r1.437 function.c
*** function.c 16 Jun 2003 21:41:04 -0000 1.437
--- function.c 18 Jun 2003 19:55:55 -0000
*************** use_return_register ()
*** 6963,6979 ****
static GTY(()) rtx initial_trampoline;
! /* Generate RTL for the end of the current function.
! FILENAME and LINE are the current position in the source file.
!
! It is up to language-specific callers to do cleanups for parameters--
! or else, supply 1 for END_BINDINGS and we will call expand_end_bindings. */
void
! expand_function_end (filename, line, end_bindings)
! const char *filename;
! int line;
! int end_bindings;
{
tree link;
rtx clobber_after;
--- 6963,6972 ----
static GTY(()) rtx initial_trampoline;
! /* Generate RTL for the end of the current function. */
void
! expand_function_end ()
{
tree link;
rtx clobber_after;
*************** expand_function_end (filename, line, end
*** 7099,7105 ****
/* Output a linenumber for the end of the function.
SDB depends on this. */
! emit_line_note_force (filename, line);
/* Before the return label (if any), clobber the return
registers so that they are not propagated live to the rest of
--- 7092,7098 ----
/* Output a linenumber for the end of the function.
SDB depends on this. */
! emit_line_note_force (input_filename, input_line);
/* Before the return label (if any), clobber the return
registers so that they are not propagated live to the rest of
*************** expand_function_end (filename, line, end
*** 7118,7127 ****
structure returning. */
if (return_label)
emit_label (return_label);
-
- /* C++ uses this. */
- if (end_bindings)
- expand_end_bindings (0, 0, 0);
if (current_function_instrument_entry_exit)
{
--- 7111,7116 ----
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.413
diff -c -3 -p -r1.413 tree.h
*** tree.h 16 Jun 2003 18:56:09 -0000 1.413
--- tree.h 18 Jun 2003 19:56:03 -0000
*************** extern void type_hash_add PARAMS ((unsi
*** 2810,2816 ****
extern unsigned int type_hash_list PARAMS ((tree));
extern int simple_cst_list_equal PARAMS ((tree, tree));
extern void dump_tree_statistics PARAMS ((void));
! extern void expand_function_end PARAMS ((const char *, int, int));
extern void expand_function_start PARAMS ((tree, int));
extern void expand_pending_sizes PARAMS ((tree));
--- 2810,2816 ----
extern unsigned int type_hash_list PARAMS ((tree));
extern int simple_cst_list_equal PARAMS ((tree, tree));
extern void dump_tree_statistics PARAMS ((void));
! extern void expand_function_end PARAMS ((void));
extern void expand_function_start PARAMS ((tree, int));
extern void expand_pending_sizes PARAMS ((tree));
Index: ada/utils.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/utils.c,v
retrieving revision 1.30
diff -c -3 -p -r1.30 utils.c
*** ada/utils.c 14 Jun 2003 17:33:29 -0000 1.30
--- ada/utils.c 18 Jun 2003 19:56:15 -0000
*************** end_subprog_body ()
*** 1801,1807 ****
/* Mark the RESULT_DECL as being in this subprogram. */
DECL_CONTEXT (DECL_RESULT (current_function_decl)) = current_function_decl;
! expand_function_end (input_filename, input_line, 0);
/* If this is a nested function, push a new GC context. That will keep
local variables on the stack from being collected while we're doing
--- 1801,1807 ----
/* Mark the RESULT_DECL as being in this subprogram. */
DECL_CONTEXT (DECL_RESULT (current_function_decl)) = current_function_decl;
! expand_function_end ();
/* If this is a nested function, push a new GC context. That will keep
local variables on the stack from being collected while we're doing
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.310
diff -c -3 -p -r1.310 semantics.c
*** cp/semantics.c 14 Jun 2003 17:33:28 -0000 1.310
--- cp/semantics.c 18 Jun 2003 19:56:50 -0000
*************** genrtl_finish_function (fn)
*** 2638,2644 ****
immediate_size_expand = 1;
/* Generate rtl for function exit. */
! expand_function_end (input_filename, input_line, 0);
/* If this is a nested function (like a template instantiation that
we're compiling in the midst of compiling something else), push a
--- 2638,2644 ----
immediate_size_expand = 1;
/* Generate rtl for function exit. */
! expand_function_end ();
/* If this is a nested function (like a template instantiation that
we're compiling in the midst of compiling something else), push a
Index: f/com.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/com.c,v
retrieving revision 1.205
diff -c -3 -p -r1.205 com.c
*** f/com.c 14 Jun 2003 17:33:30 -0000 1.205
--- f/com.c 18 Jun 2003 19:57:27 -0000
*************** finish_function (int nested)
*** 13604,13610 ****
/* Obey `register' declarations if `setjmp' is called in this fn. */
/* Generate rtl for function exit. */
! expand_function_end (input_filename, input_line, 0);
/* If this is a nested function, protect the local variables in the stack
above us from being collected while we're compiling this function. */
--- 13604,13610 ----
/* Obey `register' declarations if `setjmp' is called in this fn. */
/* Generate rtl for function exit. */
! expand_function_end ();
/* If this is a nested function, protect the local variables in the stack
above us from being collected while we're compiling this function. */
Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.158
diff -c -3 -p -r1.158 class.c
*** java/class.c 14 Jun 2003 17:33:32 -0000 1.158
--- java/class.c 18 Jun 2003 19:57:34 -0000
*************** tree
*** 308,315 ****
push_class (tree class_type, tree class_name)
{
tree decl, signature;
! const char *save_input_filename = input_filename;
! int save_lineno = input_line;
tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
CLASS_P (class_type) = 1;
input_filename = IDENTIFIER_POINTER (source_name);
--- 308,314 ----
push_class (tree class_type, tree class_name)
{
tree decl, signature;
! location_t saved_loc = input_location;
tree source_name = identifier_subst (class_name, "", '.', '/', ".java");
CLASS_P (class_type) = 1;
input_filename = IDENTIFIER_POINTER (source_name);
*************** push_class (tree class_type, tree class_
*** 319,326 ****
/* dbxout needs a DECL_SIZE if in gstabs mode */
DECL_SIZE (decl) = integer_zero_node;
! input_filename = save_input_filename;
! input_line = save_lineno;
signature = identifier_subst (class_name, "L", '.', '/', ";");
IDENTIFIER_SIGNATURE_TYPE (signature) = build_pointer_type (class_type);
--- 318,324 ----
/* dbxout needs a DECL_SIZE if in gstabs mode */
DECL_SIZE (decl) = integer_zero_node;
! input_location = saved_loc;
signature = identifier_subst (class_name, "L", '.', '/', ";");
IDENTIFIER_SIGNATURE_TYPE (signature) = build_pointer_type (class_type);
*************** emit_register_classes (void)
*** 2000,2005 ****
--- 1998,2004 ----
tree init_type = build_function_type (void_type_node, end_params_node);
tree init_decl;
tree t;
+ location_t saved_loc = input_location;
init_decl = build_decl (FUNCTION_DECL, init_name, init_type);
SET_DECL_ASSEMBLER_NAME (init_decl, init_name);
*************** emit_register_classes (void)
*** 2028,2035 ****
for ( t = registered_class; t; t = TREE_CHAIN (t))
emit_library_call (registerClass_libfunc, 0, VOIDmode, 1,
XEXP (DECL_RTL (t), 0), Pmode);
!
! expand_function_end (input_filename, 0, 0);
poplevel (1, 0, 1);
rest_of_compilation (init_decl);
current_function_decl = NULL_TREE;
--- 2027,2034 ----
for ( t = registered_class; t; t = TREE_CHAIN (t))
emit_library_call (registerClass_libfunc, 0, VOIDmode, 1,
XEXP (DECL_RTL (t), 0), Pmode);
! input_location = DECL_SOURCE_LOCATION (init_decl);
! expand_function_end ();
poplevel (1, 0, 1);
rest_of_compilation (init_decl);
current_function_decl = NULL_TREE;
*************** emit_register_classes (void)
*** 2037,2042 ****
--- 2036,2042 ----
if (targetm.have_ctors_dtors)
(* targetm.asm_out.constructor) (XEXP (DECL_RTL (init_decl), 0),
DEFAULT_INIT_PRIORITY);
+ input_location = saved_loc;
}
}
Index: java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.154
diff -c -3 -p -r1.154 decl.c
*** java/decl.c 14 Jun 2003 17:33:32 -0000 1.154
--- java/decl.c 18 Jun 2003 19:57:37 -0000
*************** end_java_method (void)
*** 1810,1816 ****
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
/* Generate rtl for function exit. */
! expand_function_end (input_filename, input_line, 0);
/* Run the optimizers and output assembler code for this function. */
rest_of_compilation (fndecl);
--- 1810,1816 ----
BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
/* Generate rtl for function exit. */
! expand_function_end ();
/* Run the optimizers and output assembler code for this function. */
rest_of_compilation (fndecl);
Index: java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.435
diff -c -3 -p -r1.435 parse.y
*** java/parse.y 9 Jun 2003 12:57:15 -0000 1.435
--- java/parse.y 18 Jun 2003 19:58:12 -0000
*************** source_end_java_method (void)
*** 7386,7392 ****
if (! flag_emit_class_files && ! flag_emit_xref)
{
input_line = DECL_FUNCTION_LAST_LINE (fndecl);
! expand_function_end (input_filename, input_line, 0);
/* Run the optimizers and output assembler code for this function. */
rest_of_compilation (fndecl);
--- 7386,7392 ----
if (! flag_emit_class_files && ! flag_emit_xref)
{
input_line = DECL_FUNCTION_LAST_LINE (fndecl);
! expand_function_end ();
/* Run the optimizers and output assembler code for this function. */
rest_of_compilation (fndecl);
Index: java/resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/resource.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 resource.c
*** java/resource.c 14 Jun 2003 17:33:32 -0000 1.5
--- java/resource.c 18 Jun 2003 19:58:12 -0000
*************** write_resource_constructor (void)
*** 104,109 ****
--- 104,110 ----
{
tree init_name, init_type, init_decl;
tree iter;
+ location_t saved_loc = input_location;
/* Only do work if required. */
if (resources == NULL_TREE)
*************** write_resource_constructor (void)
*** 139,145 ****
Pmode);
}
! expand_function_end (input_filename, 0, 0);
poplevel (1, 0, 1);
{
/* Force generation, even with -O3 or deeper. Gross hack.
--- 140,147 ----
Pmode);
}
! input_location = DECL_SOURCE_LOCATION (init_decl);
! expand_function_end ();
poplevel (1, 0, 1);
{
/* Force generation, even with -O3 or deeper. Gross hack.
*************** write_resource_constructor (void)
*** 152,157 ****
--- 154,160 ----
current_function_decl = NULL_TREE;
(* targetm.asm_out.constructor) (XEXP (DECL_RTL (init_decl), 0),
DEFAULT_INIT_PRIORITY);
+ input_location = saved_loc;
}
/* Generate a byte array representing the contents of FILENAME. The
Index: treelang/treetree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/treelang/treetree.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 treetree.c
*** treelang/treetree.c 18 Jun 2003 14:20:45 -0000 1.29
--- treelang/treetree.c 18 Jun 2003 19:58:44 -0000
*************** tree_code_create_function_wrapup (locati
*** 452,458 ****
/* Emit rtl for end of function. */
! expand_function_end (loc.file, loc.line, 0);
/* Pop the level. */
--- 452,458 ----
/* Emit rtl for end of function. */
! expand_function_end ();
/* Pop the level. */