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]
Other format: [Raw text]

Fix docs/comments for SPARC64


This patch stems from a discussion inside ACT about why the SPARC64/VxWorks 
port, which is ILP32 and uses the "medlow" code model, works fine while the 
docs/comments appear to imply it should not.

It turned out that the docs/comments are slightly inacurrate (this is 
basically the ptr_mode<-->Pmode issue).  Fixed by the attached patch, 
applied to mainline and 3.4 branch.


2004-03-15  Eric Botcazou  <ebotcazou@act-europe.fr>

	* config/sparc/sparc.h: Rework comments about the code model
	in 64-bit environment and the mode 'Pmode'.
	* doc/invoke.texi (SPARC options): Rework description of the
	different code models supported in 64-bit environment.


-- 
Eric Botcazou
Index: config/sparc/sparc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.h,v
retrieving revision 1.236.6.4
diff -c -r1.236.6.4 sparc.h
*** config/sparc/sparc.h	9 Mar 2004 03:00:13 -0000	1.236.6.4
--- config/sparc/sparc.h	15 Mar 2004 17:17:19 -0000
***************
*** 69,103 ****
  #endif /* IN_LIBGCC2 */
  #define TARGET_ARCH64 (! TARGET_ARCH32)
  
! /* Code model selection.
!    -mcmodel is used to select the v9 code model.
!    Different code models aren't supported for v7/8 code.
! 
!    TARGET_CM_32:     32 bit address space, top 32 bits = 0,
! 		     pointers are 32 bits.  Note that this isn't intended
!                      to imply a v7/8 abi.
! 
!    TARGET_CM_MEDLOW: 32 bit address space, top 32 bits = 0,
!                      avoid generating %uhi and %ulo terms,
! 		     pointers are 64 bits.
! 
!    TARGET_CM_MEDMID: 64 bit address space.
!                      The executable must be in the low 16 TB of memory.
!                      This corresponds to the low 44 bits, and the %[hml]44
!                      relocs are used.  The text segment has a maximum size
!                      of 31 bits.
! 
!    TARGET_CM_MEDANY: 64 bit address space.
!                      The text and data segments have a maximum size of 31
!                      bits and may be located anywhere.  The maximum offset
!                      from any instruction to the label _GLOBAL_OFFSET_TABLE_
!                      is 31 bits.
! 
!    TARGET_CM_EMBMEDANY: 64 bit address space.
!                      The text and data segments have a maximum size of 31 bits
!                      and may be located anywhere.  Register %g4 contains
!                      the start address of the data segment.
! */
  
  enum cmodel {
    CM_32,
--- 69,109 ----
  #endif /* IN_LIBGCC2 */
  #define TARGET_ARCH64 (! TARGET_ARCH32)
  
! /* Code model selection in 64-bit environment.
! 
!    The machine mode used for addresses is 32-bit wide:
! 
!    TARGET_CM_32:     32-bit address space.
!                      It is the code model used when generating 32-bit code.
! 
!    The machine mode used for addresses is 64-bit wide:
! 
!    TARGET_CM_MEDLOW: 32-bit address space.
!                      The executable must be in the low 32 bits of memory.
!                      This avoids generating %uhi and %ulo terms.  Programs
!                      can be statically or dynamically linked.
! 
!    TARGET_CM_MEDMID: 44-bit address space.
!                      The executable must be in the low 44 bits of memory,
!                      and the %[hml]44 terms are used.  The text and data
!                      segments have a maximum size of 2GB (31-bit span).
!                      The maximum offset from any instruction to the label
!                      _GLOBAL_OFFSET_TABLE_ is 2GB (31-bit span).
! 
!    TARGET_CM_MEDANY: 64-bit address space.
!                      The text and data segments have a maximum size of 2GB
!                      (31-bit span) and may be located anywhere in memory.
!                      The maximum offset from any instruction to the label
!                      _GLOBAL_OFFSET_TABLE_ is 2GB (31-bit span).
! 
!    TARGET_CM_EMBMEDANY: 64-bit address space.
!                      The text and data segments have a maximum size of 2GB
!                      (31-bit span) and may be located anywhere in memory.
!                      The global register %g4 contains the start address of
!                      the data segment.  Programs are statically linked and
!                      PIC is not supported.
! 
!    Different code models are not supported in 32-bit environment.  */
  
  enum cmodel {
    CM_32,
***************
*** 2397,2405 ****
     is done just by pretending it is already truncated.  */
  #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  
! /* Specify the machine mode that pointers have.
!    After generation of rtl, the compiler makes no further distinction
!    between pointers and any other objects of this machine mode.  */
  #define Pmode (TARGET_ARCH64 ? DImode : SImode)
  
  /* Generate calls to memcpy, memcmp and memset.  */
--- 2403,2409 ----
     is done just by pretending it is already truncated.  */
  #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
  
! /* Specify the machine mode used for addresses.  */
  #define Pmode (TARGET_ARCH64 ? DImode : SImode)
  
  /* Generate calls to memcpy, memcmp and memset.  */
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.390.2.19
diff -c -r1.390.2.19 invoke.texi
*** doc/invoke.texi	7 Mar 2004 23:16:00 -0000	1.390.2.19
--- doc/invoke.texi	15 Mar 2004 17:18:20 -0000
***************
*** 6394,6424 ****
  
  @item -mcmodel=medlow
  @opindex mcmodel=medlow
! Generate code for the Medium/Low code model: the program must be linked
! in the low 32 bits of the address space.  Pointers are 64 bits.
! Programs can be statically or dynamically linked.
  
  @item -mcmodel=medmid
  @opindex mcmodel=medmid
! Generate code for the Medium/Middle code model: the program must be linked
! in the low 44 bits of the address space, the text segment must be less than
! 2G bytes, and data segment must be within 2G of the text segment.
! Pointers are 64 bits.
  
  @item -mcmodel=medany
  @opindex mcmodel=medany
! Generate code for the Medium/Anywhere code model: the program may be linked
! anywhere in the address space, the text segment must be less than
! 2G bytes, and data segment must be within 2G of the text segment.
! Pointers are 64 bits.
  
  @item -mcmodel=embmedany
  @opindex mcmodel=embmedany
  Generate code for the Medium/Anywhere code model for embedded systems:
! assume a 32-bit text and a 32-bit data segment, both starting anywhere
! (determined at link time).  Register %g4 points to the base of the
! data segment.  Pointers are still 64 bits.
! Programs are statically linked, PIC is not supported.
  
  @item -mstack-bias
  @itemx -mno-stack-bias
--- 6394,6424 ----
  
  @item -mcmodel=medlow
  @opindex mcmodel=medlow
! Generate code for the Medium/Low code model: 64-bit addresses, programs
! must be linked in the low 32 bits of memory.  Programs can be statically
! or dynamically linked.
  
  @item -mcmodel=medmid
  @opindex mcmodel=medmid
! Generate code for the Medium/Middle code model: 64-bit addresses, programs
! must be linked in the low 44 bits of memory, the text and data segments must
! be less than 2GB in size and the data segment must be located within 2GB of
! the text segment.
  
  @item -mcmodel=medany
  @opindex mcmodel=medany
! Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
! may be linked anywhere in memory, the text and data segments must be less
! than 2GB in size and the data segment must be located within 2GB of the
! text segment.
  
  @item -mcmodel=embmedany
  @opindex mcmodel=embmedany
  Generate code for the Medium/Anywhere code model for embedded systems:
! 64-bit addresses, the text and data segments must be less than 2GB in
! size, both starting anywhere in memory (determined at link time).  The
! global register %g4 points to the base of the data segment.  Programs
! are statically linked and PIC is not supported.
  
  @item -mstack-bias
  @itemx -mno-stack-bias

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