From 464186fb60d6479e5561ddcab0d0337a5d222bff Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 17 Mar 2001 10:37:25 -0800 Subject: [PATCH] integrate.h (struct inline_remap): Add local_return_label. * integrate.h (struct inline_remap): Add local_return_label. * integrate.c (expand_inline_function): Initialize it and emit it after copy_insn_notes. (copy_insn_list): Don't store local_return_label here. (copy_insn_notes): New function split out from copy_insn_list. From-SVN: r40581 --- gcc/ChangeLog | 8 ++++++++ gcc/integrate.c | 34 ++++++++++++++++++++++++---------- gcc/integrate.h | 3 +++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fadf0f202e6..cfc0e941852 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-03-17 Richard Henderson + + * integrate.h (struct inline_remap): Add local_return_label. + * integrate.c (expand_inline_function): Initialize it and emit + it after copy_insn_notes. + (copy_insn_list): Don't store local_return_label here. + (copy_insn_notes): New function split out from copy_insn_list. + 2001-03-17 Richard Henderson * dwarf2out.c (lookup_filename): Emit .file if the assembler diff --git a/gcc/integrate.c b/gcc/integrate.c index 8ce84909653..f26a4461312 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -87,6 +87,7 @@ static void mark_stores PARAMS ((rtx, rtx, void *)); static void save_parm_insns PARAMS ((rtx, rtx)); static void copy_insn_list PARAMS ((rtx, struct inline_remap *, rtx)); +static void copy_insn_notes PARAMS ((rtx, struct inline_remap *)); static int compare_blocks PARAMS ((const PTR, const PTR)); static int find_block PARAMS ((const PTR, const PTR)); @@ -778,6 +779,7 @@ expand_inline_function (fndecl, parms, target, ignore, type, real_label_map = (rtx *) xmalloc ((max_labelno) * sizeof (rtx)); map->label_map = real_label_map; + map->local_return_label = NULL_RTX; inl_max_uid = (inl_f->emit->x_cur_insn_uid + 1); map->insn_map = (rtx *) xcalloc (inl_max_uid, sizeof (rtx)); @@ -1142,6 +1144,13 @@ expand_inline_function (fndecl, parms, target, ignore, type, /* Now copy the insns one by one. */ copy_insn_list (insns, map, static_chain_value); + /* Now copy the REG_NOTES for those insns. */ + copy_insn_notes (insns, map); + + /* If the insn sequence required one, emit the return label. */ + if (map->local_return_label) + emit_label (map->local_return_label); + /* Restore the stack pointer if we saved it above. */ if (inl_f->calls_alloca) emit_stack_restore (SAVE_BLOCK, stack_save, NULL_RTX); @@ -1226,7 +1235,6 @@ copy_insn_list (insns, map, static_chain_value) register int i; rtx insn; rtx temp; - rtx local_return_label = NULL_RTX; #ifdef HAVE_cc0 rtx cc0_insn = 0; #endif @@ -1391,9 +1399,9 @@ copy_insn_list (insns, map, static_chain_value) || (GET_CODE (PATTERN (insn)) == PARALLEL && GET_CODE (XVECEXP (PATTERN (insn), 0, 0)) == RETURN)) { - if (local_return_label == 0) - local_return_label = gen_label_rtx (); - pattern = gen_jump (local_return_label); + if (map->local_return_label == 0) + map->local_return_label = gen_label_rtx (); + pattern = gen_jump (map->local_return_label); } else pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0); @@ -1578,10 +1586,19 @@ copy_insn_list (insns, map, static_chain_value) map->insn_map[INSN_UID (insn)] = copy; } +} + +/* Copy the REG_NOTES. Increment const_age, so that only constants + from parameters can be substituted in. These are the only ones + that are valid across the entire function. */ + +static void +copy_insn_notes (insns, map) + rtx insns; + struct inline_remap *map; +{ + rtx insn; - /* Now copy the REG_NOTES. Increment const_age, so that only constants - from parameters can be substituted in. These are the only ones that - are valid across the entire function. */ map->const_age++; for (insn = insns; insn; insn = NEXT_INSN (insn)) if (INSN_P (insn) @@ -1604,9 +1621,6 @@ copy_insn_list (insns, map, static_chain_value) remove_note (map->insn_map[INSN_UID (insn)], note); } } - - if (local_return_label) - emit_label (local_return_label); } /* Given a chain of PARM_DECLs, ARGS, copy each decl into a VAR_DECL, diff --git a/gcc/integrate.h b/gcc/integrate.h index 51fced4d87e..14606a6c1b6 100644 --- a/gcc/integrate.h +++ b/gcc/integrate.h @@ -93,6 +93,9 @@ struct inline_remap /* Likewise, this is the copied constraints vector. */ rtvec copy_asm_constraints_vector; + /* Target of a return insn, if needed and inlining. */ + rtx local_return_label; + /* Indications for regs being pointers and their alignment. */ unsigned char *regno_pointer_align; rtx *x_regno_reg_rtx; -- 2.30.2