This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[new-regalloc-branch] fixes (s390x)
- From: Michael Matz <matz at suse dot de>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: Michael Matz <matz at suse dot de>
- Date: Tue, 7 May 2002 22:56:42 +0200 (CEST)
- Subject: [new-regalloc-branch] fixes (s390x)
Hi,
the below diff fixes the initial problem for s390x. Later the stage2 cc1
crashes nevertheless, but this also happens, if I switch off the new
allocator at all. As the newest HEAD seems to bootstrap on s390x (at
least C and c++) I consider to merge again. But not today.
Ciao,
Michael.
--
2002-05-07 Michael Matz <matz@suse.de>
* reload1.c (fixup_abnormal_edges): Don't insert on NULL edge.
* ra.c (undef_to_size_word): New rtx argument. Changed callers.
Use it in 0x0fff case.
(reg_alloc): Insert use of return value at each predecessor of
EXIT_BLOCK. Call fixup_abnormal_edges().
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.255.2.10
diff -u -p -r1.255.2.10 reload1.c
--- reload1.c 3 May 2002 19:52:29 -0000 1.255.2.10
+++ reload1.c 7 May 2002 20:45:41 -0000
@@ -9520,19 +9520,26 @@ fixup_abnormal_edges ()
next = NEXT_INSN (insn);
if (INSN_P (insn))
{
- rtx seq;
-
delete_insn (insn);
- /* We're not deleting it, we're moving it. */
- INSN_DELETED_P (insn) = 0;
+ /* Sometimes there's still the return value USE.
+ If it's placed after a trapping call (i.e. that
+ call is the last insn anyway), we have no fallthru
+ edge. Simply delete this use and don't try to insert
+ on the non-existant edge. */
+ if (GET_CODE (PATTERN (insn)) != USE)
+ {
+ rtx seq;
+ /* We're not deleting it, we're moving it. */
+ INSN_DELETED_P (insn) = 0;
- /* Emit a sequence, rather than scarfing the pattern, so
- that we don't lose REG_NOTES etc. */
- /* ??? Could copy the test from gen_sequence, but don't
- think it's worth the bother. */
- seq = gen_rtx_SEQUENCE (VOIDmode, gen_rtvec (1, insn));
- insert_insn_on_edge (seq, e);
+ /* Emit a sequence, rather than scarfing the pattern, so
+ that we don't lose REG_NOTES etc. */
+ /* ??? Could copy the test from gen_sequence, but don't
+ think it's worth the bother. */
+ seq = gen_rtx_SEQUENCE (VOIDmode, gen_rtvec (1, insn));
+ insert_insn_on_edge (seq, e);
+ }
}
insn = next;
}
Index: ra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ra.c,v
retrieving revision 1.1.2.54
diff -u -p -r1.1.2.54 ra.c
--- ra.c 3 May 2002 20:34:59 -0000 1.1.2.54
+++ ra.c 7 May 2002 20:45:41 -0000
@@ -319,7 +319,7 @@ static void create_insn_info PARAMS ((st
static void free_insn_info PARAMS ((void));
static bitmap find_sub_conflicts PARAMS ((struct web_part *, unsigned int));
static bitmap get_sub_conflicts PARAMS ((struct web_part *, unsigned int));
-static unsigned int undef_to_size_word PARAMS ((unsigned HOST_WIDE_INT *));
+static unsigned int undef_to_size_word PARAMS ((rtx, unsigned HOST_WIDE_INT *));
static bitmap undef_to_bitmap PARAMS ((struct web_part *,
unsigned HOST_WIDE_INT *));
static struct web_part * find_web_part_1 PARAMS ((struct web_part *));
@@ -1422,7 +1422,8 @@ struct undef_table_s {
{ 0, BL_TO_WORD (0, 4)}};
static unsigned int
-undef_to_size_word (undefined)
+undef_to_size_word (reg, undefined)
+ rtx reg;
unsigned HOST_WIDE_INT *undefined;
{
if (*undefined <= 15)
@@ -1438,8 +1439,11 @@ undef_to_size_word (undefined)
case 0x00ff : *undefined = 0; return BL_TO_WORD (0, 8);
case 0x0f00 : *undefined = 0; return BL_TO_WORD (8, 4);
case 0x0ff0 : *undefined = 0xf0; return BL_TO_WORD (8, 4);
- case 0x0fff : *undefined = 0; return BL_TO_WORD (0, 12); /* XFmode */
- /* case 0x0fff : *undefined = 0xff; return BL_TO_WORD (8, 4); */
+ case 0x0fff :
+ if (INTEGRAL_MODE_P (GET_MODE (reg)))
+ { *undefined = 0xff; return BL_TO_WORD (8, 4); }
+ else
+ { *undefined = 0; return BL_TO_WORD (0, 12); /* XFmode */ }
case 0xf000 : *undefined = 0; return BL_TO_WORD (12, 4);
case 0xff00 : *undefined = 0; return BL_TO_WORD (8, 8);
case 0xfff0 : *undefined = 0xf0; return BL_TO_WORD (8, 8);
@@ -1472,7 +1476,8 @@ undef_to_bitmap (wp, undefined)
struct web_part *wp;
unsigned HOST_WIDE_INT *undefined;
{
- unsigned int size_word = undef_to_size_word (undefined);
+ unsigned int size_word = undef_to_size_word (DF_REF_REAL_REG (wp->ref),
+ undefined);
return get_sub_conflicts (wp, size_word);
}
@@ -2872,7 +2877,7 @@ build_inverse_webs (web)
bits = undef & ~ rtx_to_undefined (sweb->orig_x);
while (bits)
{
- unsigned int size_word = undef_to_size_word (&bits);
+ unsigned int size_word = undef_to_size_word (web->orig_x, &bits);
if (!find_subweb_2 (web, size_word))
{
(void) add_subweb_2 (web, size_word);
@@ -9707,19 +9712,28 @@ reg_alloc (void)
{
int changed;
FILE *ra_dump_file = rtl_dump_file;
+ rtx last = get_last_insn ();
- if (!INSN_P (get_last_insn ())
- || GET_CODE (PATTERN (get_last_insn ())) != USE)
+ if (! INSN_P (last))
+ last = prev_real_insn (last);
+ /* If this is an empty function we shouldn't do all the following,
+ but instead just setup what's necessary, and return. */
+ if (last)
{
- rtx insn, last = get_last_insn ();
- basic_block bb = BLOCK_FOR_INSN (last);
- if (bb)
- {
- use_return_register ();
- for (insn = get_last_insn (); insn != last; insn = PREV_INSN (insn))
- set_block_for_insn (insn, bb);
- if (last == bb->end)
- bb->end = get_last_insn ();
+ edge e;
+ for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
+ {
+ basic_block bb = e->src;
+ last = bb->end;
+ if (!INSN_P (last) || GET_CODE (PATTERN (last)) != USE)
+ {
+ rtx insns;
+ start_sequence ();
+ use_return_register ();
+ insns = get_insns ();
+ end_sequence ();
+ emit_insns_after (insns, last);
+ }
}
}
@@ -9930,6 +9944,7 @@ reg_alloc (void)
no_new_pseudos = 1;
rtl_dump_file = ra_dump_file;
+ fixup_abnormal_edges ();
if ((debug_new_regalloc & DUMP_LAST_FLOW) == 0)
rtl_dump_file = NULL;
/*free_bb_for_insn ();