This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Gcc extra alignment..
- To: Linus Torvalds <torvalds at transmeta dot com>
- Subject: Re: Gcc extra alignment..
- From: Richard Henderson <rth at cygnus dot com>
- Date: Tue, 31 Oct 2000 17:31:10 -0800
- Cc: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <20001031115556.A31170@cygnus.com> <Pine.LNX.4.10.10010311200180.21954-100000@penguin.transmeta.com>
On Tue, Oct 31, 2000 at 12:08:15PM -0800, Linus Torvalds wrote:
> Might it not be worth-while to special-case the "do { } while (0)"
> construct and get rid of the "loop" very very early? It's pretty much the
> standard way of writing just about any macro.
Yep, that does seem worth while.
r~
* c-semantics.c (genrtl_do_stmt): Special case do/while(0).
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-semantics.c,v
retrieving revision 1.10
diff -c -p -d -r1.10 c-semantics.c
*** c-semantics.c 2000/10/29 02:26:16 1.10
--- c-semantics.c 2000/11/01 01:27:29
*************** void
*** 480,498 ****
genrtl_do_stmt (t)
tree t;
{
! tree cond;
! emit_nop ();
! emit_line_note (input_filename, lineno);
! expand_start_loop_continue_elsewhere (1);
! expand_stmt (DO_BODY (t));
! expand_loop_continue_here ();
! cond = expand_cond (DO_COND (t));
! emit_line_note (input_filename, lineno);
! expand_exit_loop_if_false (0, cond);
! expand_end_loop ();
}
/* Build the node for a return statement and return it. */
--- 480,507 ----
genrtl_do_stmt (t)
tree t;
{
! tree cond = DO_COND (t);
! /* Recognize the common special-case of do { ... } while (0) and do
! not emit the loop widgetry in this case. In particular this
! avoids cluttering the rtl with dummy loop notes, which can affect
! alignment of adjacent labels. */
! if (cond == integer_zero_node)
! expand_stmt (DO_BODY (t));
! else
! {
! emit_nop ();
! emit_line_note (input_filename, lineno);
! expand_start_loop_continue_elsewhere (1);
! expand_stmt (DO_BODY (t));
! expand_loop_continue_here ();
! cond = expand_cond (cond);
! emit_line_note (input_filename, lineno);
! expand_exit_loop_if_false (0, cond);
! expand_end_loop ();
! }
}
/* Build the node for a return statement and return it. */