[new-regalloc] pre-reload bugfix
Denis Chertykov
denisc@overta.ru
Thu Jul 18 13:31:00 GMT 2002
Fri Jul 19 00:10:55 2002 Denis Chertykov <denisc@overta.ru>
* pre-reload.c : Substitute all emit_insns to emit_insn.
Substitute all emit_insns_before to emit_insn_before.
(ra_insn_table_realloc): Bugfix. Argument SIZE now a size of table
not a size of increasing.
Update all calls to ra_insn_table_realloc.
(ra_reg_table_realloc): Bugfix. Argument SIZE now a size of table
not a size of increasing.
Update all calls to ra_reg_table_realloc
(pre_reload_collect): Use FOR_EACH_BB.
Index: pre-reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/pre-reload.c,v
retrieving revision 1.1.2.9
diff -c -3 -p -r1.1.2.9 pre-reload.c
*** pre-reload.c 19 Jun 2002 18:37:18 -0000 1.1.2.9
--- pre-reload.c 18 Jul 2002 20:16:01 -0000
*************** Boston, MA 02111-1307, USA. */
*** 31,40 ****
#include "tm_p.h"
#include "obstack.h"
#include "insn-config.h"
- #include "optabs.h"
#include "flags.h"
#include "function.h"
#include "expr.h"
#include "regs.h"
#include "basic-block.h"
#include "reload.h"
--- 31,40 ----
#include "tm_p.h"
#include "obstack.h"
#include "insn-config.h"
#include "flags.h"
#include "function.h"
#include "expr.h"
+ #include "optabs.h"
#include "regs.h"
#include "basic-block.h"
#include "reload.h"
*************** emit_output_pre_reload_insns (insn, rl,
*** 731,737 ****
if (rl->when_needed == RELOAD_OTHER)
{
! emit_insns (other_output_reload_insns[rl->opnum]);
other_output_reload_insns[rl->opnum] = get_insns ();
}
else
--- 731,737 ----
if (rl->when_needed == RELOAD_OTHER)
{
! emit_insn (other_output_reload_insns[rl->opnum]);
other_output_reload_insns[rl->opnum] = get_insns ();
}
else
*************** emit_pre_reload_insns (insn)
*** 856,880 ****
reloads for the operand. The RELOAD_OTHER output reloads are
output in descending order by reload number. */
! emit_insns_before (other_input_address_reload_insns, insn);
! emit_insns_before (other_input_reload_insns, insn);
for (j = 0; j < reload_n_operands; j++)
{
! emit_insns_before (inpaddr_address_reload_insns[j], insn);
! emit_insns_before (input_address_reload_insns[j], insn);
! emit_insns_before (input_reload_insns[j], insn);
}
! emit_insns_before (other_operand_reload_insns, insn);
! emit_insns_before (operand_reload_insns, insn);
for (j = 0; j < reload_n_operands; j++)
{
! emit_insns_before (outaddr_address_reload_insns[j], following_insn);
! emit_insns_before (output_address_reload_insns[j], following_insn);
! emit_insns_before (output_reload_insns[j], following_insn);
! emit_insns_before (other_output_reload_insns[j], following_insn);
}
}
--- 856,880 ----
reloads for the operand. The RELOAD_OTHER output reloads are
output in descending order by reload number. */
! emit_insn_before (other_input_address_reload_insns, insn);
! emit_insn_before (other_input_reload_insns, insn);
for (j = 0; j < reload_n_operands; j++)
{
! emit_insn_before (inpaddr_address_reload_insns[j], insn);
! emit_insn_before (input_address_reload_insns[j], insn);
! emit_insn_before (input_reload_insns[j], insn);
}
! emit_insn_before (other_operand_reload_insns, insn);
! emit_insn_before (operand_reload_insns, insn);
for (j = 0; j < reload_n_operands; j++)
{
! emit_insn_before (outaddr_address_reload_insns[j], following_insn);
! emit_insn_before (output_address_reload_insns[j], following_insn);
! emit_insn_before (output_reload_insns[j], following_insn);
! emit_insn_before (other_output_reload_insns[j], following_insn);
}
}
*************** find_pre_reloads_toplev (x, opnum, type,
*** 1834,1856 ****
/* SUBREG_REG (x) is a MEM, so we cant take the offset, instead we
calculate the register number as :
SUBREG_BYTE (x) / GET_MODE_SIZE (subreg_mode) */
- /* XXX abort for now, as the interface to find_valid_class() has
- changed, and I don't want to analyze what this does. */
- abort ();
- /*
if (is_set_dest)
push_pre_reload (NULL_RTX, SUBREG_REG (x), (rtx*)0, &SUBREG_REG (x),
find_valid_class (subreg_mode,
SUBREG_BYTE (x)
! / GET_MODE_SIZE (subreg_mode)),
VOIDmode, subreg_mode, 0, 0, opnum, type);
else
push_pre_reload (SUBREG_REG (x), NULL_RTX, &SUBREG_REG (x), (rtx*)0,
find_valid_class (subreg_mode,
SUBREG_BYTE (x)
! / GET_MODE_SIZE (subreg_mode)),
subreg_mode, VOIDmode, 0, 0, opnum, type);
- */
}
for (copied = 0, i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
--- 1834,1853 ----
/* SUBREG_REG (x) is a MEM, so we cant take the offset, instead we
calculate the register number as :
SUBREG_BYTE (x) / GET_MODE_SIZE (subreg_mode) */
if (is_set_dest)
push_pre_reload (NULL_RTX, SUBREG_REG (x), (rtx*)0, &SUBREG_REG (x),
find_valid_class (subreg_mode,
SUBREG_BYTE (x)
! / GET_MODE_SIZE (subreg_mode),
! REGNO (SUBREG_REG (x))),
VOIDmode, subreg_mode, 0, 0, opnum, type);
else
push_pre_reload (SUBREG_REG (x), NULL_RTX, &SUBREG_REG (x), (rtx*)0,
find_valid_class (subreg_mode,
SUBREG_BYTE (x)
! / GET_MODE_SIZE (subreg_mode),
! REGNO (SUBREG_REG (x))),
subreg_mode, VOIDmode, 0, 0, opnum, type);
}
for (copied = 0, i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
*************** pseudo_fits_class_p (operand, class, mod
*** 1886,1892 ****
enum reg_class class;
enum machine_mode mode;
{
! static unsigned int max_consecutive[FIRST_PSEUDO_REGISTER];
int i;
int num_consecutive = 0;
int clr = -1;
--- 1883,1889 ----
enum reg_class class;
enum machine_mode mode;
{
! static int max_consecutive[FIRST_PSEUDO_REGISTER];
int i;
int num_consecutive = 0;
int clr = -1;
*************** collect_insn_info (ra_info, insn, def_re
*** 2187,2193 ****
rtx op1 = recog_data.operand[c - '0'];
rtx op2 = recog_data.operand[i];
c -= '0';
-
if (GET_MODE (op1) != GET_MODE (op2)
&& INTEGRAL_MODE_P (GET_MODE (op1))
&& INTEGRAL_MODE_P (GET_MODE (op2)))
--- 2184,2189 ----
*************** collect_insn_info (ra_info, insn, def_re
*** 2206,2212 ****
if (o == SUBREG_BYTE (op2))
op2 = SUBREG_REG (op2);
}
! }
operands_match[c][i] = operands_match_p (op1, op2);;
/* An operand may not match itself. */
--- 2202,2208 ----
if (o == SUBREG_BYTE (op2))
op2 = SUBREG_REG (op2);
}
! }
operands_match[c][i] = operands_match_p (op1, op2);;
/* An operand may not match itself. */
*************** collect_insn_info (ra_info, insn, def_re
*** 3402,3408 ****
}
! /* Increase the insn info table by SIZE more elements. */
static void
ra_insn_table_realloc (ra_info, size)
struct ra_info *ra_info;
--- 3398,3404 ----
}
! /* Increase the insn info table for handling SIZE elements. */
static void
ra_insn_table_realloc (ra_info, size)
struct ra_info *ra_info;
*************** ra_insn_table_realloc (ra_info, size)
*** 3410,3418 ****
{
/* Make table 25 percent larger by default. */
if (! size)
! size = ra_info->insn_size / 4;
- size += ra_info->insn_size + 1;
ra_info->insns = (struct ra_refs **)
xrealloc (ra_info->insns, size * sizeof (struct ra_refs*));
--- 3406,3415 ----
{
/* Make table 25 percent larger by default. */
if (! size)
! size = ra_info->insn_size;
!
! size += ra_info->insn_size / 4 + 1;
ra_info->insns = (struct ra_refs **)
xrealloc (ra_info->insns, size * sizeof (struct ra_refs*));
*************** ra_insn_table_realloc (ra_info, size)
*** 3424,3430 ****
}
! /* Increase the reg info table by SIZE more elements. */
static void
ra_reg_table_realloc (ra_info, size)
struct ra_info *ra_info;
--- 3421,3427 ----
}
! /* Increase the reg info table for handling SIZE elements. */
static void
ra_reg_table_realloc (ra_info, size)
struct ra_info *ra_info;
*************** ra_reg_table_realloc (ra_info, size)
*** 3432,3440 ****
{
/* Make table 25 percent larger by default. */
if (! size)
! size = ra_info->reg_size / 4;
!
! size += ra_info->reg_size + 1;
ra_info->regs = (struct ra_refs **)
xrealloc (ra_info->regs, size * sizeof (struct ra_refs *));
--- 3429,3437 ----
{
/* Make table 25 percent larger by default. */
if (! size)
! size = ra_info->reg_size;
!
! size += ra_info->reg_size / 4 + 1;
ra_info->regs = (struct ra_refs **)
xrealloc (ra_info->regs, size * sizeof (struct ra_refs *));
*************** ra_info_add_insn_refs (ra_info, insn, re
*** 3633,3639 ****
int uid = INSN_UID (insn);
if (uid >= ra_info->insn_size)
! ra_insn_table_realloc (ra_info, 0);
else if (RA_INSN_REFS (ra_info, insn))
abort ();
--- 3630,3636 ----
int uid = INSN_UID (insn);
if (uid >= ra_info->insn_size)
! ra_insn_table_realloc (ra_info, uid);
else if (RA_INSN_REFS (ra_info, insn))
abort ();
*************** ra_info_add_reg_refs (ra_info, insn, ref
*** 3656,3662 ****
{
regno = RA_REF_REGNO (link->ref);
if (regno >= ra_info->reg_size)
! ra_reg_table_realloc (ra_info, 0);
if (!RA_REG_REFS (ra_info, regno))
{
--- 3653,3659 ----
{
regno = RA_REF_REGNO (link->ref);
if (regno >= ra_info->reg_size)
! ra_reg_table_realloc (ra_info, regno);
if (!RA_REG_REFS (ra_info, regno))
{
*************** ra_info_add_reg_refs (ra_info, insn, ref
*** 3674,3680 ****
{
regno = RA_REF_REGNO (link->ref);
if (regno >= ra_info->reg_size)
! ra_reg_table_realloc (ra_info, 0);
if (!RA_REG_REFS (ra_info, regno))
{
--- 3671,3677 ----
{
regno = RA_REF_REGNO (link->ref);
if (regno >= ra_info->reg_size)
! ra_reg_table_realloc (ra_info, regno);
if (!RA_REG_REFS (ra_info, regno))
{
*************** pre_reload (ra_info, modified)
*** 3895,3901 ****
}
});
if (max >= ra_info->insn_size)
! ra_insn_table_realloc (ra_info, 0);
}
pre_reload_collect (ra_info, modified);
}
--- 3892,3898 ----
}
});
if (max >= ra_info->insn_size)
! ra_insn_table_realloc (ra_info, max);
}
pre_reload_collect (ra_info, modified);
}
*************** pre_reload_collect (ra_info, modified)
*** 3908,3923 ****
{
rtx insn;
int cnt;
! int i;
ra_ref *def_refs[(sizeof (ra_ref *)
* MAX_RECOG_OPERANDS * MAX_REGS_PER_ADDRESS + 1)];
ra_ref *use_refs[(sizeof (ra_ref *)
* MAX_RECOG_OPERANDS * MAX_REGS_PER_ADDRESS + 1)];
! for (i = 0; i < n_basic_blocks; i++)
{
- basic_block bb = BASIC_BLOCK (i);
for (insn = bb->head;
insn && PREV_INSN (insn) != bb->end;
insn = NEXT_INSN (insn))
--- 3905,3919 ----
{
rtx insn;
int cnt;
! basic_block bb;
ra_ref *def_refs[(sizeof (ra_ref *)
* MAX_RECOG_OPERANDS * MAX_REGS_PER_ADDRESS + 1)];
ra_ref *use_refs[(sizeof (ra_ref *)
* MAX_RECOG_OPERANDS * MAX_REGS_PER_ADDRESS + 1)];
! FOR_EACH_BB (bb)
{
for (insn = bb->head;
insn && PREV_INSN (insn) != bb->end;
insn = NEXT_INSN (insn))
*************** pre_reload_collect (ra_info, modified)
*** 3987,3995 ****
}
/* Keep basic block info up to date. */
if (bb->head == orig_insn)
! bb->head = NEXT_INSN (prev);
if (bb->end == orig_insn)
! bb->end = PREV_INSN (next);
}
}
--- 3983,4001 ----
}
/* Keep basic block info up to date. */
if (bb->head == orig_insn)
! {
! if (prev)
! bb->head = NEXT_INSN (prev);
! else
! bb->head = get_insns ();
! }
if (bb->end == orig_insn)
! {
! if (next)
! bb->end = PREV_INSN (next);
! else
! bb->end = get_last_insn ();
! }
}
}
More information about the Gcc-patches
mailing list