From 8e383849646654485307714640f89699bc6538ee Mon Sep 17 00:00:00 2001 From: Joern Rennecke Date: Sat, 20 Oct 2012 11:37:27 +0000 Subject: [PATCH] emit-rtl.c (copy_delay_slot_insn): New function. 2012-10-20 Joern Rennecke Richard Sandiford * emit-rtl.c (copy_delay_slot_insn): New function. * emit-rtl.h (copy_delay_slot_insn): Declare. * reorg.c: Include "emit-rtl.h". (steal_delay_list_from_target): Use copy_delay_slot_insn. (fill_slots_from_thread, fill_simple_delay_slots): Likewise. Co-Authored-By: Richard Sandiford From-SVN: r192633 --- gcc/ChangeLog | 9 +++++++++ gcc/emit-rtl.c | 17 +++++++++++++---- gcc/emit-rtl.h | 3 ++- gcc/reorg.c | 12 +++++++----- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ddffd5e543..44141a1c736 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-10-20 Joern Rennecke + Richard Sandiford + + * emit-rtl.c (copy_delay_slot_insn): New function. + * emit-rtl.h (copy_delay_slot_insn): Declare. + * reorg.c: Include "emit-rtl.h". + (steal_delay_list_from_target): Use copy_delay_slot_insn. + (fill_slots_from_thread, fill_simple_delay_slots): Likewise. + 2012-10-19 Jan Hubicka * builtins.def (BUILT_IN_UNREACHABLE): Make ATTR_CONST_NORETURN_NOTHROW_LEAF_LIST. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index ee6ae226e23..7d7b1dfb0a1 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1,8 +1,5 @@ /* Emit RTL for the GCC expander. - Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 1987, 1988, 1992-2012 Free Software Foundation, Inc. This file is part of GCC. @@ -5378,6 +5375,18 @@ copy_insn (rtx insn) return copy_insn_1 (insn); } +/* Return a copy of INSN that can be used in a SEQUENCE delay slot, + on that assumption that INSN itself remains in its original place. */ + +rtx +copy_delay_slot_insn (rtx insn) +{ + /* Copy INSN with its rtx_code, all its notes, location etc. */ + insn = copy_rtx (insn); + INSN_UID (insn) = cur_insn_uid++; + return insn; +} + /* Initialize data structures and variables in this file before generating rtl for each function. */ diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index 715d4dd6984..cd0cbd0049b 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -1,5 +1,5 @@ /* Exported functions from emit-rtl.c - Copyright (C) 2004, 2007, 2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2008, 2010, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -61,6 +61,7 @@ extern rtx gen_blockage (void); extern rtvec gen_rtvec (int, ...); extern rtx copy_insn_1 (rtx); extern rtx copy_insn (rtx); +extern rtx copy_delay_slot_insn (rtx); extern rtx gen_int_mode (HOST_WIDE_INT, enum machine_mode); extern rtx emit_copy_of_insn_after (rtx, rtx); extern void set_reg_attrs_from_value (rtx, rtx); diff --git a/gcc/reorg.c b/gcc/reorg.c index 89442e395aa..e07b8341ed4 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -1,6 +1,6 @@ /* Perform instruction reorganizations for delay slot filling. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu). Hacked by Michael Tiemann (tiemann@cygnus.com). @@ -134,6 +134,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "target.h" #include "tree-pass.h" +#include "emit-rtl.h" #ifdef DELAY_SLOTS @@ -1297,7 +1298,7 @@ steal_delay_list_from_target (rtx insn, rtx condition, rtx seq, { if (must_annul) used_annul = 1; - temp = copy_rtx (trial); + temp = copy_delay_slot_insn (trial); INSN_FROM_TARGET_P (temp) = 1; new_delay_list = add_to_delay_list (temp, new_delay_list); total_slots_filled++; @@ -2369,7 +2370,8 @@ fill_simple_delay_slots (int non_jumps_p) if (new_label) { delay_list - = add_to_delay_list (copy_rtx (next_trial), delay_list); + = add_to_delay_list (copy_delay_slot_insn (next_trial), + delay_list); slots_filled++; reorg_redirect_jump (trial, new_label); @@ -2793,7 +2795,7 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread, else new_thread = next_active_insn (trial); - temp = own_thread ? trial : copy_rtx (trial); + temp = own_thread ? trial : copy_delay_slot_insn (trial); if (thread_if_true) INSN_FROM_TARGET_P (temp) = 1; @@ -2974,7 +2976,7 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread, else new_thread = next_active_insn (trial); - ninsn = own_thread ? trial : copy_rtx (trial); + ninsn = own_thread ? trial : copy_delay_slot_insn (trial); if (thread_if_true) INSN_FROM_TARGET_P (ninsn) = 1;