This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
New front-end option: internal REFERENCE_TYPEs
- To: gcc-patches at gcc dot gnu dot org
- Subject: New front-end option: internal REFERENCE_TYPEs
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Tue, 6 Feb 01 08:09:05 EST
This lets a front end tell GCC that it is using REFERENCE_TYPEs for
inernal purposes only, thus allowing Pmode to be used for them rather than
ptr_mode. This makes a major improvement to Ada on 32/64 machines.
Since this change doesn't affect anything unless it's enabled by a front
end, it's a safe change to put in during the slush period.
Tue Feb 6 07:54:51 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* stor-layout.c (reference_types_internal): New variable.
(internal_reference_types): New function.
(layout_type, case REFERENCE_TYPE): Make Pmode if internal.
* tree.h (internal_reference_types): New declaration.
*** stor-layout.c 2000/12/17 17:22:41 1.92
--- stor-layout.c 2001/02/06 12:44:47
*************** unsigned int maximum_field_alignment;
*** 51,54 ****
--- 51,59 ----
unsigned int set_alignment = 0;
+ /* Nonzero if all REFERENCE_TYPEs are internal and hence should be
+ allocated in Pmode, not ptr_mode. Set only by internal_reference_types
+ called only by a front end. */
+ static int reference_types_internal = 0;
+
static void finalize_record_size PARAMS ((record_layout_info));
static void finalize_type_size PARAMS ((tree));
*************** static tree pending_sizes;
*** 65,68 ****
--- 70,82 ----
int immediate_size_expand;
+ /* Show that REFERENCE_TYPES are internal and should be Pmode. Called only
+ by front end. */
+
+ void
+ internal_reference_types ()
+ {
+ reference_types_internal = 1;
+ }
+
/* Get a list of all the objects put on the pending sizes list. */
*************** layout_type (type)
*** 1316,1324 ****
case POINTER_TYPE:
case REFERENCE_TYPE:
! TYPE_MODE (type) = ptr_mode;
! TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
! TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
! TREE_UNSIGNED (type) = 1;
! TYPE_PRECISION (type) = POINTER_SIZE;
break;
--- 1330,1344 ----
case POINTER_TYPE:
case REFERENCE_TYPE:
! {
! int nbits = ((TREE_CODE (type) == REFERENCE_TYPE
! && reference_types_internal)
! ? GET_MODE_BITSIZE (Pmode) : POINTER_SIZE);
!
! TYPE_MODE (type) = nbits == POINTER_SIZE ? ptr_mode : Pmode;
! TYPE_SIZE (type) = bitsize_int (nbits);
! TYPE_SIZE_UNIT (type) = size_int (nbits / BITS_PER_UNIT);
! TREE_UNSIGNED (type) = 1;
! TYPE_PRECISION (type) = nbits;
! }
break;
*** tree.h 2001/01/30 01:38:41 1.222
--- tree.h 2001/02/06 12:44:57
*************** extern void set_yydebug PARAMS ((int))
*** 2774,2777 ****
--- 2774,2778 ----
/* In stor-layout.c */
extern void fixup_signed_type PARAMS ((tree));
+ extern void internal_reference_types PARAMS ((void));
/* varasm.c */