This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Fix 20000724-1.c



This patch improves the documentation, stealing from Richard's email
description, and also fixes some buglets posted earlier.

Tested on i686-pc-linux-gnu, installed on the mainline and the branch.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-04-30  Mark Mitchell  <mark@codesourcery.com>
            Richard Henderson  <rth@redhat.com>
	
	* extend.texi: Improve documentation of volatile asms.
	
2001-04-30  Mark Mitchell  <mark@codesourcery.com>

	* c-tree.texi: Fix thinko.
	* gcc.texi: Likewise.

Index: c-tree.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-tree.texi,v
retrieving revision 1.8.4.2
diff -c -p -r1.8.4.2 c-tree.texi
*** c-tree.texi	2001/04/30 22:28:44	1.8.4.2
--- c-tree.texi	2001/05/01 00:35:07
*************** Copyright @copyright{} 1999, 2000, 2001 
*** 32,42 ****
  
  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.1 or
! any later version published by the Free Software Foundation; with the
! Invariant Sections being ``GNU General Public License'', the Front-Cover
! texts being (a) (see below), and with the Back-Cover Texts being (b)
! (see below).  A copy of the license is included in the section entitled
! ``GNU Free Documentation License''.
  
  (a) The FSF's Front-Cover Text is:
  
--- 32,41 ----
  
  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.1 or
! any later version published by the Free Software Foundation; with no
! invariant sections, the Front-Cover texts being (a) (see below), and
! with the Back-Cover Texts being (b) (see below).  A copy of the license
! is included in the section entitled ``GNU Free Documentation License''.
  
  (a) The FSF's Front-Cover Text is:
  
Index: gcc.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.texi,v
retrieving revision 1.75.2.6
diff -c -p -r1.75.2.6 gcc.texi
*** gcc.texi	2001/04/30 22:28:44	1.75.2.6
--- gcc.texi	2001/05/01 00:35:09
*************** Copyright (C) 1988, 1989, 1992, 1993, 19
*** 125,134 ****
  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.1 or
  any later version published by the Free Software Foundation; with the
! Invariant Sections being ``GNU General Public License'', the Front-Cover
! texts being (a) (see below), and with the Back-Cover Texts being (b)
! (see below).  A copy of the license is included in the section entitled
! ``GNU Free Documentation License''.
  
  (a) The FSF's Front-Cover Text is:
  
--- 125,134 ----
  Permission is granted to copy, distribute and/or modify this document
  under the terms of the GNU Free Documentation License, Version 1.1 or
  any later version published by the Free Software Foundation; with the
! Invariant Sections being ``GNU General Public License'' and ``Funding
! Free Software'', the Front-Cover texts being (a) (see below), and with
! the Back-Cover Texts being (b) (see below).  A copy of the license is
! included in the section entitled ``GNU Free Documentation License''.
  
  (a) The FSF's Front-Cover Text is:
  
Index: extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/extend.texi,v
retrieving revision 1.92.2.6
diff -c -p -r1.92.2.6 extend.texi
*** extend.texi	2001/04/30 14:44:47	1.92.2.6
--- extend.texi	2001/05/01 00:35:10
*************** the @code{asm}.  For example:
*** 3052,3074 ****
  @noindent
  If you write an @code{asm} instruction with no outputs, GNU CC will know
  the instruction has side-effects and will not delete the instruction or
! move it outside of loops.  If the side-effects of your instruction are
! not purely external, but will affect variables in your program in ways
! other than reading the inputs and clobbering the specified registers or
! memory, you should write the @code{volatile} keyword to prevent future
! versions of GNU CC from moving the instruction around within a core
! region.
  
! An @code{asm} instruction without any operands or clobbers (an ``old
! style'' @code{asm}) will not be deleted or moved significantly,
! regardless, unless it is unreachable, the same way as if you had
! written a @code{volatile} keyword.
  
  Note that even a volatile @code{asm} instruction can be moved in ways
  that appear insignificant to the compiler, such as across jump
  instructions.  You can't expect a sequence of volatile @code{asm}
  instructions to remain perfectly consecutive.  If you want consecutive
! output, use a single @code{asm}.
  
  It is a natural idea to look for a way to give access to the condition
  code left by the assembler instruction.  However, when we attempted to
--- 3052,3089 ----
  @noindent
  If you write an @code{asm} instruction with no outputs, GNU CC will know
  the instruction has side-effects and will not delete the instruction or
! move it outside of loops.
  
! The @code{volatile} keyword indicates that the instruction has
! important side-effects.  GCC will not delete a volatile @code{asm} if
! it is reachable.  (The instruction can still be deleted if GCC can
! prove that control-flow will never reach the location of the
! instruction.)  In addition, GCC will not reschedule instructions
! across a volatile @code{asm} instruction.  For example:
! 
! @example
! (volatile int *)addr = foo;
! asm volatile ("eieio" : : );
! @end example
! 
! @noindent 
! Assume @code{addr} contains the address of a memory mapped device
! register.  The PowerPC @code{eieio} instruction (Enforce In-order
! Execution of I/O) tells the cpu to make sure that the store to that
! device register happens before it issues any other I/O.
  
  Note that even a volatile @code{asm} instruction can be moved in ways
  that appear insignificant to the compiler, such as across jump
  instructions.  You can't expect a sequence of volatile @code{asm}
  instructions to remain perfectly consecutive.  If you want consecutive
! output, use a single @code{asm}.  Also, GCC will perform some
! optimizations across a volatile @code{asm} instruction; GCC does not
! ``forget everything'' when it encounters a volatile @code{asm}
! instruction the way some other compilers do.
! 
! An @code{asm} instruction without any operands or clobbers (an ``old
! style'' @code{asm}) will be treated identically to a volatile
! @code{asm} instruction.
  
  It is a natural idea to look for a way to give access to the condition
  code left by the assembler instruction.  However, when we attempted to


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]