A couple of small memory-reduction patches

Zack Weinberg zack@codesourcery.com
Thu Apr 10 05:25:00 GMT 2003


Dan Nicolaescu wrote a couple of small memory-reduction patches a few
weeks back. They were approved, one with caveats, but never got
applied because he doesn't have write privileges.  I have dusted them
off, dealt with the caveats, re-verified them (i686-linux, all
languages except Java which I believe is still broken on that
platform), and checked them in.

Here is the revised diff.

zw

        * regrename.c (struct du_chain): Use a bitfield for reg_class.
        * cse.c (struct qty_table_elem, struct table_elt, struct set):
        Use bitfields for fields holding enum rtx_code or
        enum machine_mode values.  Add comments explaining size choices.

===================================================================
Index: regrename.c
--- regrename.c	7 Feb 2003 01:20:04 -0000	1.65
+++ regrename.c	10 Apr 2003 05:19:26 -0000
@@ -51,7 +51,7 @@ struct du_chain
 
   rtx insn;
   rtx *loc;
-  enum reg_class class;
+  ENUM_BITFIELD(reg_class) class : 16;
   unsigned int need_caller_save_reg:1;
   unsigned int earlyclobber:1;
 };
===================================================================
Index: cse.c
--- cse.c	4 Apr 2003 21:49:42 -0000	1.258
+++ cse.c	10 Apr 2003 05:19:30 -0000
@@ -251,8 +251,10 @@ struct qty_table_elem
   rtx comparison_const;
   int comparison_qty;
   unsigned int first_reg, last_reg;
-  enum machine_mode mode;
-  enum rtx_code comparison_code;
+  /* The sizes of these fields should match the sizes of the
+     code and mode fields of struct rtx_def (see rtl.h).  */
+  ENUM_BITFIELD(rtx_code) comparison_code : 16;
+  ENUM_BITFIELD(machine_mode) mode : 8;
 };
 
 /* The table of all qtys, indexed by qty number.  */
@@ -462,7 +464,9 @@ struct table_elt
   struct table_elt *related_value;
   int cost;
   int regcost;
-  enum machine_mode mode;
+  /* The size of this field should match the size
+     of the mode field of struct rtx_def (see rtl.h).  */
+  ENUM_BITFIELD(machine_mode) mode : 8;
   char in_memory;
   char is_const;
   char flag;
@@ -4712,8 +4716,10 @@ struct set
   /* Nonzero if the SET_SRC contains something
      whose value cannot be predicted and understood.  */
   char src_volatile;
-  /* Original machine mode, in case it becomes a CONST_INT.  */
-  enum machine_mode mode;
+  /* Original machine mode, in case it becomes a CONST_INT.
+     The size of this field should match the size of the mode
+     field of struct rtx_def (see rtl.h).  */
+  ENUM_BITFIELD(machine_mode) mode : 8;
   /* A constant equivalent for SET_SRC, if any.  */
   rtx src_const;
   /* Original SET_SRC value used for libcall notes.  */





More information about the Gcc-patches mailing list