This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: INSN_P candidates
- To: RDBrown at mira dot net, RodneyBrown at pmsc dot com
- Subject: Re: INSN_P candidates
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Tue, 16 May 2000 16:52:06 -0700
- CC: gcc-patches at gcc dot gnu dot org
Hi Rodney,
Here is a patch for the M32R port to use INSN_P. I also took this
opportunity to replace several pieces of duplicated code with one
function call. I will check the patch in shortly.
Cheers
Nick
2000-05-16 Nick Clifton <nickc@cygnus.com>
* config/m32r/m32r.c (small_insn_p): Use INSN_P() to replace
GET_RTX_CLASS (GET_CODE ()) == 'i'.
(large_insn_p): Ditto.
(m32r_is_insn): New function: Return true if the insn contains
an executable instruction.
(m32r_adjust_insn): Use m32r_is_insn.
(m32r_sched_reorder): Use m32r_is_insn.
(m32r_sched_variable_issue): Use m32r_is_insn.
Index: gcc/config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/m32r/m32r.c,v
retrieving revision 1.21
diff -p -r1.21 m32r.c
*** m32r.c 2000/03/07 20:39:08 1.21
--- m32r.c 2000/05/16 23:45:34
*************** small_insn_p (op, mode)
*** 961,967 ****
if (GET_CODE (op) == CONST_INT && INTVAL (op) == 0)
return 1;
! if (GET_RTX_CLASS (GET_CODE (op)) != 'i')
return 0;
return get_attr_length (op) == 2;
--- 961,967 ----
if (GET_CODE (op) == CONST_INT && INTVAL (op) == 0)
return 1;
! if (! INSN_P (op))
return 0;
return get_attr_length (op) == 2;
*************** large_insn_p (op, mode)
*** 974,980 ****
rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
{
! if (GET_RTX_CLASS (GET_CODE (op)) != 'i')
return 0;
return get_attr_length (op) != 2;
--- 974,980 ----
rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
{
! if (! INSN_P (op))
return 0;
return get_attr_length (op) != 2;
*************** m32r_adjust_cost (insn, link, dep_insn,
*** 1484,1510 ****
}
! /* A C statement (sans semicolon) to update the integer scheduling
! priority `INSN_PRIORITY(INSN)'. Reduce the priority to execute
! the INSN earlier, increase the priority to execute INSN later.
! Do not define this macro if you do not need to adjust the
! scheduling priorities of insns.
! On the m32r, increase the priority of long instructions so that
! the short instructions are scheduled ahead of the long ones. */
int
m32r_adjust_priority (insn, priority)
rtx insn;
int priority;
{
! if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
! {
! enum rtx_code code = GET_CODE (PATTERN (insn));
! if (code != USE && code != CLOBBER && code != ADDR_VEC
! && get_attr_insn_size (insn) != INSN_SIZE_SHORT)
! priority <<= 3;
! }
return priority;
}
--- 1484,1512 ----
}
! /* Return true if INSN is real instruction bearing insn. */
! static int
! m32r_is_insn (insn)
! rtx insn;
! {
! return (INSN_P (insn)
! && GET_CODE (PATTERN (insn)) != USE
! && GET_CODE (PATTERN (insn)) != CLOBBER
! && GET_CODE (PATTERN (insn)) != ADDR_VEC);
! }
!
! /* Increase the priority of long instructions so that the
! short instructions are scheduled ahead of the long ones. */
int
m32r_adjust_priority (insn, priority)
rtx insn;
int priority;
{
! if (m32r_is_insn (insn)
! && get_attr_insn_size (insn) != INSN_SIZE_SHORT)
! priority <<= 3;
return priority;
}
*************** m32r_sched_reorder (stream, verbose, rea
*** 1560,1570 ****
rtx insn = ready[i];
enum rtx_code code;
! if (GET_RTX_CLASS (GET_CODE (insn)) != 'i'
! || (code = GET_CODE (PATTERN (insn))) == USE
! || code == CLOBBER || code == ADDR_VEC)
{
! /* Dump all current short/long insns just in case */
while (long_head != long_tail)
*new_tail-- = *long_head++;
--- 1562,1570 ----
rtx insn = ready[i];
enum rtx_code code;
! if (! m32r_is_insn (insn))
{
! /* Dump all current short/long insns just in case. */
while (long_head != long_tail)
*new_tail-- = *long_head++;
*************** m32r_sched_reorder (stream, verbose, rea
*** 1619,1627 ****
enum rtx_code code;
fprintf (stream, " %d", INSN_UID (ready[i]));
! if (GET_RTX_CLASS (GET_CODE (insn)) != 'i'
! || (code = GET_CODE (PATTERN (insn))) == USE
! || code == CLOBBER || code == ADDR_VEC)
fputs ("(?)", stream);
else if (get_attr_insn_size (insn) != INSN_SIZE_SHORT)
--- 1619,1626 ----
enum rtx_code code;
fprintf (stream, " %d", INSN_UID (ready[i]));
!
! if (! m32r_is_insn (insn))
fputs ("(?)", stream);
else if (get_attr_insn_size (insn) != INSN_SIZE_SHORT)
*************** m32r_sched_variable_issue (stream, verbo
*** 1654,1665 ****
how_many--;
if (how_many > 0 && !TARGET_DEBUG)
{
! if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
! how_many++;
!
! else if (GET_CODE (PATTERN (insn)) == USE
! || GET_CODE (PATTERN (insn)) == CLOBBER
! || GET_CODE (PATTERN (insn)) == ADDR_VEC)
how_many++;
else if (get_attr_insn_size (insn) != INSN_SIZE_SHORT)
--- 1653,1659 ----
how_many--;
if (how_many > 0 && !TARGET_DEBUG)
{
! if (! m32r_is_insn (insn))
how_many++;
else if (get_attr_insn_size (insn) != INSN_SIZE_SHORT)