From 932f084749dd624f549cddd5e07eb38727c59faf Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 8 Jun 2001 21:52:06 +0200 Subject: [PATCH] function.c (diddle_return_value): Kill code to determine return value before expand_function_end. * function.c (diddle_return_value): Kill code to determine return value before expand_function_end. (expand_function_end): Delay call to clobber_return_register after fucntion return value is computed. Re-install temporary reverted patch: * toplev.c (rest_of_compilation): Call split_all_insns before reg-stack and shorten-branches. Do shorten-branches after reg-stack. * final.c (shorten_branches): Remove insn splitting code. From-SVN: r43044 --- gcc/ChangeLog | 13 +++++++++++ gcc/final.c | 20 ----------------- gcc/function.c | 59 ++++++++++++++++++-------------------------------- gcc/toplev.c | 27 +++++++++++++---------- 4 files changed, 49 insertions(+), 70 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 08fe5e032a4..653ecc3156d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +Fri Jun 8 21:34:54 CEST 2001 Jan Hubicka + + * function.c (diddle_return_value): Kill code to determine + return value before expand_function_end. + (expand_function_end): Delay call to clobber_return_register + after fucntion return value is computed. + + Re-install temporary reverted patch: + * toplev.c (rest_of_compilation): Call split_all_insns + before reg-stack and shorten-branches. Do shorten-branches + after reg-stack. + * final.c (shorten_branches): Remove insn splitting code. + 2001-06-08 Joseph S. Myers * doc/gcc.texi, doc/invoke.texi: Add index of command line diff --git a/gcc/final.c b/gcc/final.c index 7b36b1b4102..a3fe70d61cb 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -960,26 +960,6 @@ shorten_branches (first) int uid; rtx align_tab[MAX_CODE_ALIGN]; - /* In order to make sure that all instructions have valid length info, - we must split them before we compute the address/length info. */ - - for (insn = NEXT_INSN (first); insn; insn = NEXT_INSN (insn)) - if (INSN_P (insn)) - { - rtx old = insn; - /* Don't split the insn if it has been deleted. */ - if (! INSN_DELETED_P (old)) - insn = try_split (PATTERN (old), old, 1); - /* When not optimizing, the old insn will be still left around - with only the 'deleted' bit set. Transform it into a note - to avoid confusion of subsequent processing. */ - if (INSN_DELETED_P (old)) - { - PUT_CODE (old, NOTE); - NOTE_LINE_NUMBER (old) = NOTE_INSN_DELETED; - NOTE_SOURCE_FILE (old) = 0; - } - } #endif /* We must do some computations even when not actually shortening, in diff --git a/gcc/function.c b/gcc/function.c index cef669770a1..cdfe697b784 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6542,37 +6542,10 @@ diddle_return_value (doit, arg) void *arg; { rtx outgoing = current_function_return_rtx; - int pcc; if (! outgoing) return; - pcc = (current_function_returns_struct - || current_function_returns_pcc_struct); - - if ((GET_CODE (outgoing) == REG - && REGNO (outgoing) >= FIRST_PSEUDO_REGISTER) - || pcc) - { - tree type = TREE_TYPE (DECL_RESULT (current_function_decl)); - - /* A PCC-style return returns a pointer to the memory in which - the structure is stored. */ - if (pcc) - type = build_pointer_type (type); - -#ifdef FUNCTION_OUTGOING_VALUE - outgoing = FUNCTION_OUTGOING_VALUE (type, current_function_decl); -#else - outgoing = FUNCTION_VALUE (type, current_function_decl); -#endif - /* If this is a BLKmode structure being returned in registers, then use - the mode computed in expand_return. */ - if (GET_MODE (outgoing) == BLKmode) - PUT_MODE (outgoing, GET_MODE (current_function_return_rtx)); - REG_FUNCTION_VALUE_P (outgoing) = 1; - } - if (GET_CODE (outgoing) == REG) (*doit) (outgoing, arg); else if (GET_CODE (outgoing) == PARALLEL) @@ -6641,6 +6614,7 @@ expand_function_end (filename, line, end_bindings) int end_bindings; { tree link; + rtx clobber_after; #ifdef TRAMPOLINE_TEMPLATE static rtx initial_trampoline; @@ -6787,17 +6761,11 @@ expand_function_end (filename, line, end_bindings) registers so that they are not propogated live to the rest of the function. This can only happen with functions that drop through; if there had been a return statement, there would - have either been a return rtx, or a jump to the return label. */ - { - rtx before, after; - - before = get_last_insn (); - clobber_return_register (); - after = get_last_insn (); - - if (before != after) - cfun->x_clobber_return_insn = after; - } + have either been a return rtx, or a jump to the return label. + + We delay actual code generation after the current_function_value_rtx + is computed. */ + clobber_after = get_last_insn (); /* Output the label for the actual return from the function, if one is expected. This happens either because a function epilogue @@ -6946,6 +6914,21 @@ expand_function_end (filename, line, end_bindings) communicate between __builtin_eh_return and the epilogue. */ expand_eh_return (); + /* Emit the actual code to clobber return register. */ + { + rtx seq, after; + + start_sequence (); + clobber_return_register (); + seq = gen_sequence (); + end_sequence (); + + after = emit_insn_after (seq, clobber_after); + + if (clobber_after != after) + cfun->x_clobber_return_insn = after; + } + /* ??? This should no longer be necessary since stupid is no longer with us, but there are some parts of the compiler (eg reload_combine, and sh mach_dep_reorg) that still try and compute their own lifetime info diff --git a/gcc/toplev.c b/gcc/toplev.c index ba0864109b6..0e197cc2581 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3685,18 +3685,16 @@ rest_of_compilation (decl) } #endif -#ifndef STACK_REGS - /* ??? Do this before shorten branches so that we aren't creating - insns too late and fail sanity checks in final. */ - convert_to_eh_region_ranges (); -#endif - - /* Shorten branches. - - Note this must run before reg-stack because of death note (ab)use - in the ia32 backend. */ timevar_push (TV_SHORTEN_BRANCH); - shorten_branches (get_insns ()); + if (0 +#ifdef HAVE_ATTR_length + || 1 +#endif +#ifdef STACK_REGS + || 1 +#endif + ) + split_all_insns (0); timevar_pop (TV_SHORTEN_BRANCH); #ifdef STACK_REGS @@ -3709,9 +3707,14 @@ rest_of_compilation (decl) timevar_pop (TV_REG_STACK); ggc_collect (); +#endif convert_to_eh_region_ranges (); -#endif + + /* Shorten branches. */ + timevar_push (TV_SHORTEN_BRANCH); + shorten_branches (get_insns ()); + timevar_pop (TV_SHORTEN_BRANCH); current_function_nothrow = nothrow_function_p (); if (current_function_nothrow)