Basic block numbers no longer in sequence
Richard Earnshaw
rearnsha@arm.com
Mon Oct 4 03:51:00 GMT 1999
Sorry, I should have forwarded this to the list as well.
------- Forwarded Message
To: law@cygnus.com
Cc: richard.earnshaw@arm.com
Cc: bernds@cygnus.co.uk
Reply-To: richard.earnshaw@arm.com
Organization: ARM Ltd.
Subject: Re: Basic block numbers no longer in sequence
Mime-Version: 1.0
Content-Type: multipart/mixed ;
boundary="==_Exmh_-11295752790"
Date: Mon, 04 Oct 1999 11:45:46 +0100
From: Richard Earnshaw <rearnsha@arm.com>
Content-Length: 3010
This is a multipart MIME message.
- --==_Exmh_-11295752790
Content-Type: text/plain; charset=us-ascii
> OK. We should have deleted block 4, not block 22. ie, we need to
> delete the block we move since that will always be the one out of
> order. And we need to reorder starting with the lower block number.
> Ugh. I'll put this on my list (since it's my code breaking things)
> unless you want it.
This has been causing a bootstrap failure for the ARM port, so I finally
got around to looking at it over the weekend. Here's a patch. It isn't
wonderfully clean, but the alternative is to rewrite (or duplicate the
code in) merge_blocks_nomove to allow us to clean up the first basic block
of the two listed. I think doing the swap here instead is probably
cleaner long term.
I've moved the rtl_dump message before the cleanup call so that it gets
the block numbers correct without more hacking (though note that the
numbers are the old numbers (before the re-order).
With this patch the arm-netbsd port will now bootstrap again.
Richard.
<date> Richard Earnshaw (rearnsha@arm.com)
* flow.c (merge_blocks_move_predecessor_nojumps): Re-order the basic
block records so that merge_blocks_nomove will clean up correctly.
- --==_Exmh_-11295752790
Content-Type: application/x-patch ; name="bbdel.patch"
Content-Description: bbdel.patch
Content-Disposition: attachment; filename="bbdel.patch"
Index: flow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/flow.c,v
retrieving revision 1.161
diff -p -r1.161 flow.c
*** flow.c 1999/09/23 15:07:25 1.161
- --- flow.c 1999/10/04 10:38:26
*************** merge_blocks_move_predecessor_nojumps (a
*** 1946,1951 ****
- --- 1946,1952 ----
basic_block a, b;
{
rtx start, end, insertpoint, barrier;
+ int index;
start = a->head;
end = a->end;
*************** merge_blocks_move_predecessor_nojumps (a
*** 1977,1990 ****
/* Scramble the insn chain. */
reorder_insns (start, end, insertpoint);
- - /* Now blocks A and B are contiguous. Merge them. */
- - merge_blocks_nomove (a, b);
- -
if (rtl_dump_file)
{
fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
a->index, b->index);
}
return 1;
}
- --- 1978,2000 ----
/* Scramble the insn chain. */
reorder_insns (start, end, insertpoint);
if (rtl_dump_file)
{
fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
a->index, b->index);
}
+
+ /* Swap the records for the two blocks around. Although we are
deleting B,
+ A is now where B was and we want to compact the BB array from where
+ A used to be. */
+ BASIC_BLOCK(a->index) = b;
+ BASIC_BLOCK(b->index) = a;
+ index = a->index;
+ a->index = b->index;
+ b->index = index;
+
+ /* Now blocks A and B are contiguous. Merge them. */
+ merge_blocks_nomove (a, b);
return 1;
}
- --==_Exmh_-11295752790--
------- End of Forwarded Message
More information about the Gcc-patches
mailing list