comparison gcc/reorg.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents b7f97abdc517
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 /* Perform instruction reorganizations for delay slot filling. 1 /* Perform instruction reorganizations for delay slot filling.
2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu). 5 Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu).
6 Hacked by Michael Tiemann (tiemann@cygnus.com). 6 Hacked by Michael Tiemann (tiemann@cygnus.com).
7 7
8 This file is part of GCC. 8 This file is part of GCC.
113 113
114 #include "config.h" 114 #include "config.h"
115 #include "system.h" 115 #include "system.h"
116 #include "coretypes.h" 116 #include "coretypes.h"
117 #include "tm.h" 117 #include "tm.h"
118 #include "toplev.h" 118 #include "diagnostic-core.h"
119 #include "rtl.h" 119 #include "rtl.h"
120 #include "tm_p.h" 120 #include "tm_p.h"
121 #include "expr.h" 121 #include "expr.h"
122 #include "function.h" 122 #include "function.h"
123 #include "insn-config.h" 123 #include "insn-config.h"
3456 /* Delete the RETURN and just execute the delay list insns. 3456 /* Delete the RETURN and just execute the delay list insns.
3457 3457
3458 We do this by deleting the INSN containing the SEQUENCE, then 3458 We do this by deleting the INSN containing the SEQUENCE, then
3459 re-emitting the insns separately, and then deleting the RETURN. 3459 re-emitting the insns separately, and then deleting the RETURN.
3460 This allows the count of the jump target to be properly 3460 This allows the count of the jump target to be properly
3461 decremented. */ 3461 decremented.
3462 3462
3463 /* Clear the from target bit, since these insns are no longer 3463 Note that we need to change the INSN_UID of the re-emitted insns
3464 since it is used to hash the insns for mark_target_live_regs and
3465 the re-emitted insns will no longer be wrapped up in a SEQUENCE.
3466
3467 Clear the from target bit, since these insns are no longer
3464 in delay slots. */ 3468 in delay slots. */
3465 for (i = 0; i < XVECLEN (pat, 0); i++) 3469 for (i = 0; i < XVECLEN (pat, 0); i++)
3466 INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)) = 0; 3470 INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)) = 0;
3467 3471
3468 trial = PREV_INSN (insn); 3472 trial = PREV_INSN (insn);
3469 delete_related_insns (insn); 3473 delete_related_insns (insn);
3470 gcc_assert (GET_CODE (pat) == SEQUENCE); 3474 gcc_assert (GET_CODE (pat) == SEQUENCE);
3471 after = trial; 3475 add_insn_after (delay_insn, trial, NULL);
3472 for (i = 0; i < XVECLEN (pat, 0); i++) 3476 after = delay_insn;
3473 { 3477 for (i = 1; i < XVECLEN (pat, 0); i++)
3474 rtx this_insn = XVECEXP (pat, 0, i); 3478 after = emit_copy_of_insn_after (XVECEXP (pat, 0, i), after);
3475 add_insn_after (this_insn, after, NULL);
3476 after = this_insn;
3477 }
3478 delete_scheduled_jump (delay_insn); 3479 delete_scheduled_jump (delay_insn);
3479 continue; 3480 continue;
3480 } 3481 }
3481 3482
3482 /* Now look only at the cases where we have a filled JUMP_INSN. */ 3483 /* Now look only at the cases where we have a filled JUMP_INSN. */
3577 list insns. 3578 list insns.
3578 3579
3579 We do this by deleting the INSN containing the SEQUENCE, then 3580 We do this by deleting the INSN containing the SEQUENCE, then
3580 re-emitting the insns separately, and then deleting the jump. 3581 re-emitting the insns separately, and then deleting the jump.
3581 This allows the count of the jump target to be properly 3582 This allows the count of the jump target to be properly
3582 decremented. */ 3583 decremented.
3583 3584
3584 /* Clear the from target bit, since these insns are no longer 3585 Note that we need to change the INSN_UID of the re-emitted insns
3586 since it is used to hash the insns for mark_target_live_regs and
3587 the re-emitted insns will no longer be wrapped up in a SEQUENCE.
3588
3589 Clear the from target bit, since these insns are no longer
3585 in delay slots. */ 3590 in delay slots. */
3586 for (i = 0; i < XVECLEN (pat, 0); i++) 3591 for (i = 0; i < XVECLEN (pat, 0); i++)
3587 INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)) = 0; 3592 INSN_FROM_TARGET_P (XVECEXP (pat, 0, i)) = 0;
3588 3593
3589 trial = PREV_INSN (insn); 3594 trial = PREV_INSN (insn);
3590 delete_related_insns (insn); 3595 delete_related_insns (insn);
3591 gcc_assert (GET_CODE (pat) == SEQUENCE); 3596 gcc_assert (GET_CODE (pat) == SEQUENCE);
3592 after = trial; 3597 add_insn_after (delay_insn, trial, NULL);
3593 for (i = 0; i < XVECLEN (pat, 0); i++) 3598 after = delay_insn;
3594 { 3599 for (i = 1; i < XVECLEN (pat, 0); i++)
3595 rtx this_insn = XVECEXP (pat, 0, i); 3600 after = emit_copy_of_insn_after (XVECEXP (pat, 0, i), after);
3596 add_insn_after (this_insn, after, NULL);
3597 after = this_insn;
3598 }
3599 delete_scheduled_jump (delay_insn); 3601 delete_scheduled_jump (delay_insn);
3600 continue; 3602 continue;
3601 } 3603 }
3602 3604
3603 /* See if this is an unconditional jump around a single insn which is 3605 /* See if this is an unconditional jump around a single insn which is