Patch to eliminate DECL_FIELD_SIZE

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Mon Feb 28 18:40:00 GMT 2000


This field is used only to communicate a specified size to layout_decl.
This size can just as easily be placed in DECL_SIZE, thus freeing the
field.  This will allow reuse of that space for new field related to
positions of decls.

While doing this, I took the opportunity to clean up the usage and
documentation of the unions inside union tree_decl and also to clean
up tree prints involving builtins.  Note that since DECL_IS_BUILTIN now
goes into the union, which may be used in the case of inlined decls,
it's best to use two bits of flags to respresent it.

I committed this patch:

Mon Feb 28 08:07:59 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* Eliminate DECL_FIELD_SIZE.
	* builtins.c (built_in_class_names, built_in_names): New variables.
	* c-decl.c (finish_struct): Set specified size in DECL_SIZE.
	* expr.c (expand_expr, case COMPONENT_REF): Get field size from
	DECL_SIZE, not DECL_FIELD_SIZE.
	* print-tree.c (print_node): Remove code that prints extra blank
	lines in some cases.
	Properly handle inline and builtin function cases.
	* stor-layout.c (layout_decl): Get specified size from DEC_SIZE.
	* tree.h (built_in_class_named, built_in_names): New declarations.
	(union tree_decl): Rename internal unions to u1 and u2 and change
	some of their components.
	Add new field built_in_class.
	(DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE):
	Reflect above changes.
	(DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise.
	(DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted.
	* objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE.
	(encode_field_decl): Likewise; also remove obsolete test for bitfield.
	* ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
	* ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
	* ch/typeck.c (make_chill_struct_type): Likewise.
	(apply_decl_field_layout): General cleanup.
	Set DECL_SIZE instead of DECL_FIELD_SIZE.
	* cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear
	DECL_FIELD_SIZE.
	(check_bitfield_decl, check_field_decls): Set DECL_SIZE, not
	DECL_FIELD_SIZE.
	* cp/rtti.c (expand_class_desc): Likewise.
	* cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name.
	(THUNK_VCALL_OFFSET): Likewise.
	(THUNK_DELTA): Reflect changes in ../tree.h.
	* java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h.
	(DECL_BIT_INDEX): Use underlying representation.
	* java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise.

*** builtins.c	2000/02/27 21:39:35	1.31
--- builtins.c	2000/02/28 19:23:01
*************** Boston, MA 02111-1307, USA.  */
*** 57,60 ****
--- 57,84 ----
  #endif
  
+ /* Define the names of the builtin function types and codes.  */
+ char *built_in_class_names[4]
+   = {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
+ 
+ char *built_in_names[(int) END_BUILTINS] =
+ {"BUILT_IN_ALLOCA", "BUILT_IN_ABS", "BUILT_IN_FABS", "BUILT_IN_LABS",
+   "BUILT_IN_FFS", "BUILT_IN_DIV", "BUILT_IN_LDIV", "BUILT_IN_FFLOOR",
+   "BUILT_IN_FCEIL", "BUILT_IN_FMOD", "BUILT_IN_FREM", "BUILT_IN_MEMCPY",
+   "BUILT_IN_MEMCMP", "BUILT_IN_MEMSET", "BUILT_IN_STRCPY", "BUILT_IN_STRCMP",
+   "BUILT_IN_STRLEN", "BUILT_IN_FSQRT", "BUILT_IN_SIN", "BUILT_IN_COS",
+   "BUILT_IN_GETEXP", "BUILT_IN_GETMAN", "BUILT_IN_SAVEREGS",
+   "BUILT_IN_CLASSIFY_TYPE", "BUILT_IN_NEXT_ARG", "BUILT_IN_ARGS_INFO",
+   "BUILT_IN_CONSTANT_P", "BUILT_IN_FRAME_ADDRESS", "BUILT_IN_RETURN_ADDRESS",
+   "BUILT_IN_AGGREGATE_INCOMING_ADDRESS", "BUILT_IN_APPLY_ARGS",
+   "BUILT_IN_APPLY", "BUILT_IN_RETURN", "BUILT_IN_SETJMP", "BUILT_IN_LONGJMP",
+   "BUILT_IN_TRAP", "BUILT_IN_ISGREATER", "BUILT_IN_ISGREATEREQUAL",
+   "BUILT_IN_ISLESS", "BUILT_IN_ISLESSEQUAL", "BUILT_IN_ISLESSGREATER",
+   "BUILT_IN_ISUNORDERED", "BUILT_IN_UNWIND_INIT", "BUILT_IN_DWARF_CFA",
+   "BUILT_IN_DWARF_FP_REGNUM", "BUILT_IN_INIT_DWARF_REG_SIZES",
+   "BUILT_IN_FROB_RETURN_ADDR", "BUILT_IN_EXTRACT_RETURN_ADDR",
+   "BUILT_IN_EH_RETURN", "BUILT_IN_VARARGS_START", "BUILT_IN_STDARG_START",
+   "BUILT_IN_VA_END", "BUILT_IN_VA_COPY", "BUILT_IN_NEW", "BUILT_IN_VEC_NEW",
+   "BUILT_IN_DELETE", "BUILT_IN_VEC_DELETE" };
+ 
  tree (*lang_type_promotes_to) PARAMS ((tree));
  
*************** static rtx expand_builtin_memcpy	PARAMS 
*** 86,90 ****
  static rtx expand_builtin_strcpy	PARAMS ((tree));
  static rtx expand_builtin_memset	PARAMS ((tree));
! static rtx expand_builtin_strlen	PARAMS ((tree, rtx, enum machine_mode));
  static rtx expand_builtin_alloca	PARAMS ((tree, rtx));
  static rtx expand_builtin_ffs		PARAMS ((tree, rtx, rtx));
--- 110,115 ----
  static rtx expand_builtin_strcpy	PARAMS ((tree));
  static rtx expand_builtin_memset	PARAMS ((tree));
! static rtx expand_builtin_strlen	PARAMS ((tree, rtx,
! 						 enum machine_mode));
  static rtx expand_builtin_alloca	PARAMS ((tree, rtx));
  static rtx expand_builtin_ffs		PARAMS ((tree, rtx, rtx));
*** c-decl.c	2000/02/27 21:39:35	1.98
--- c-decl.c	2000/02/28 19:23:08
*************** finish_struct (t, fieldlist, attributes)
*** 5118,5124 ****
  
    /* Install struct as DECL_CONTEXT of each field decl.
!      Also process specified field sizes.
!      Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
!      The specified size is found in the DECL_INITIAL.
       Store 0 there, except for ": 0" fields (so we can find them
       and delete them, below).  */
--- 5118,5122 ----
  
    /* Install struct as DECL_CONTEXT of each field decl.
!      Also process specified field sizes,m which is found in the DECL_INITIAL.
       Store 0 there, except for ": 0" fields (so we can find them
       and delete them, below).  */
*************** finish_struct (t, fieldlist, attributes)
*** 5128,5132 ****
        DECL_CONTEXT (x) = t;
        DECL_PACKED (x) |= TYPE_PACKED (t);
-       DECL_FIELD_SIZE (x) = 0;
  
        /* If any field is const, the structure type is pseudo-const.  */
--- 5126,5129 ----
*************** finish_struct (t, fieldlist, attributes)
*** 5167,5171 ****
  	  else
  	    {
! 	      error_with_decl (x, "bit-field `%s' width not an integer constant");
  	      DECL_INITIAL (x) = NULL;
  	    }
--- 5164,5169 ----
  	  else
  	    {
! 	      error_with_decl (x,
! 			       "bit-field `%s' width not an integer constant");
  	      DECL_INITIAL (x) = NULL;
  	    }
*************** finish_struct (t, fieldlist, attributes)
*** 5180,5183 ****
--- 5178,5182 ----
  	  DECL_INITIAL (x) = NULL;
  	}
+ 
        if (DECL_INITIAL (x) && pedantic
  	  && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node
*************** finish_struct (t, fieldlist, attributes)
*** 5192,5197 ****
        if (DECL_INITIAL (x))
  	{
- 	  unsigned HOST_WIDE_INT width = TREE_INT_CST_LOW (DECL_INITIAL (x));
- 
  	  if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0)
  	    {
--- 5191,5194 ----
*************** finish_struct (t, fieldlist, attributes)
*** 5200,5209 ****
  	    }
  	  else if (TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0
! 		   || width > TYPE_PRECISION (TREE_TYPE (x)))
  	    {
  	      DECL_INITIAL (x) = NULL;
  	      pedwarn_with_decl (x, "width of `%s' exceeds its type");
  	    }
! 	  else if (width == 0 && DECL_NAME (x) != 0)
  	    {
  	      error_with_decl (x, "zero width for bit-field `%s'");
--- 5197,5207 ----
  	    }
  	  else if (TREE_INT_CST_HIGH (DECL_INITIAL (x)) != 0
! 		   || (TREE_INT_CST_LOW (DECL_INITIAL (x))
! 		       > TYPE_PRECISION (TREE_TYPE (x))))
  	    {
  	      DECL_INITIAL (x) = NULL;
  	      pedwarn_with_decl (x, "width of `%s' exceeds its type");
  	    }
! 	  else if (integer_zerop (DECL_INITIAL (x)) && DECL_NAME (x) != 0)
  	    {
  	      error_with_decl (x, "zero width for bit-field `%s'");
*************** finish_struct (t, fieldlist, attributes)
*** 5224,5228 ****
  	    warning_with_decl (x, "`%s' is narrower than values of its type");
  
! 	  DECL_FIELD_SIZE (x) = width;
  	  DECL_BIT_FIELD (x) = DECL_C_BIT_FIELD (x) = 1;
  	  DECL_INITIAL (x) = NULL;
--- 5222,5226 ----
  	    warning_with_decl (x, "`%s' is narrower than values of its type");
  
! 	  DECL_SIZE (x) = bitsize_int (width);
  	  DECL_BIT_FIELD (x) = DECL_C_BIT_FIELD (x) = 1;
  	  DECL_INITIAL (x) = NULL;
*************** finish_struct (t, fieldlist, attributes)
*** 5244,5248 ****
  	{
  	  unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
! 			   : TYPE_ALIGN (TREE_TYPE (x)));
  	  /* Non-bit-fields are aligned for their type, except packed
  	     fields which require only BITS_PER_UNIT alignment.  */
--- 5242,5247 ----
  	{
  	  unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
! 				    : TYPE_ALIGN (TREE_TYPE (x)));
! 
  	  /* Non-bit-fields are aligned for their type, except packed
  	     fields which require only BITS_PER_UNIT alignment.  */
*** expr.c	2000/02/28 12:08:40	1.202
--- expr.c	2000/02/28 19:23:22
*************** expand_expr (exp, target, tmode, modifie
*** 6573,6577 ****
  		if (DECL_BIT_FIELD (TREE_PURPOSE (elt)))
  		  {
! 		    int bitsize = DECL_FIELD_SIZE (TREE_PURPOSE (elt));
  
  		    if (TREE_UNSIGNED (TREE_TYPE (TREE_PURPOSE (elt))))
--- 6573,6578 ----
  		if (DECL_BIT_FIELD (TREE_PURPOSE (elt)))
  		  {
! 		    HOST_WIDE_INT bitsize
! 		      = TREE_INT_CST_LOW (DECL_SIZE (TREE_PURPOSE (elt)));
  
  		    if (TREE_UNSIGNED (TREE_TYPE (TREE_PURPOSE (elt))))
*** print-tree.c	2000/02/24 04:04:05	1.23
--- print-tree.c	2000/02/28 19:23:23
*************** print_node (file, prefix, node, indent)
*** 270,275 ****
  
        if (!ggc_p)
! 	print_obstack_name ((char *) node, file, "");
!       indent_to (file, indent + 3);
      }
  
--- 270,277 ----
  
        if (!ggc_p)
! 	{
! 	  print_obstack_name ((char *) node, file, "");
! 	  indent_to (file, indent + 3);
! 	}
      }
  
*************** print_node (file, prefix, node, indent)
*** 400,416 ****
        print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
        
!       indent_to (file, indent + 3);
        if (TREE_CODE (node) != FUNCTION_DECL)
  	fprintf (file, " align %d", DECL_ALIGN (node));
        else if (DECL_INLINE (node))
! 	fprintf (file, " frame_size %d", DECL_FRAME_SIZE (node));
        else if (DECL_BUILT_IN (node))
! 	fprintf (file, " built-in code %d", DECL_FUNCTION_CODE (node));
!       if (TREE_CODE (node) == FIELD_DECL)
! 	print_node (file, "bitpos", DECL_FIELD_BITPOS (node), indent + 4);
        if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
  	fprintf (file, " alias set %d", DECL_POINTER_ALIAS_SET (node));
        print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
!       print_node_brief (file, "machine_attributes", DECL_MACHINE_ATTRIBUTES (node), indent + 4);
        print_node_brief (file, "abstract_origin",
  			DECL_ABSTRACT_ORIGIN (node), indent + 4);
--- 402,430 ----
        print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
        
!       if (TREE_CODE (node) != FUNCTION_DECL
! 	  || DECL_INLINE (node) || DECL_BUILT_IN (node))
! 	indent_to (file, indent + 3);
! 
        if (TREE_CODE (node) != FUNCTION_DECL)
  	fprintf (file, " align %d", DECL_ALIGN (node));
        else if (DECL_INLINE (node))
! 	{
! 	  fprintf (file, " frame_size ");
! 	  fprintf (file, HOST_WIDE_INT_PRINT_DEC, DECL_FRAME_SIZE (node));
! 	}
        else if (DECL_BUILT_IN (node))
! 	fprintf (file, " built-in %s:%s",
! 		 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
! 		 built_in_names[(int) DECL_FUNCTION_CODE (node)]);
! 
        if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
  	fprintf (file, " alias set %d", DECL_POINTER_ALIAS_SET (node));
+ 
+       if (TREE_CODE (node) == FIELD_DECL)
+ 	print_node (file, "bitpos", DECL_FIELD_BITPOS (node), indent + 4);
+ 
        print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
!       print_node_brief (file, "machine_attributes",
! 			DECL_MACHINE_ATTRIBUTES (node), indent + 4);
        print_node_brief (file, "abstract_origin",
  			DECL_ABSTRACT_ORIGIN (node), indent + 4);
*** stor-layout.c	2000/02/27 21:39:36	1.48
--- stor-layout.c	2000/02/28 19:23:25
*************** layout_decl (decl, known_align)
*** 266,276 ****
    register tree type = TREE_TYPE (decl);
    register enum tree_code code = TREE_CODE (decl);
!   int spec_size = DECL_FIELD_SIZE (decl);
  
    if (code == CONST_DECL)
      return;
! 
!   if (code != VAR_DECL && code != PARM_DECL && code != RESULT_DECL
!       && code != FIELD_DECL && code != TYPE_DECL)
      abort ();
  
--- 266,283 ----
    register tree type = TREE_TYPE (decl);
    register enum tree_code code = TREE_CODE (decl);
!   HOST_WIDE_INT spec_size = 0;
  
    if (code == CONST_DECL)
      return;
!   else if (code == FIELD_DECL)
!     {
!       if (DECL_SIZE (decl) != 0)
! 	{
! 	  spec_size = TREE_INT_CST_LOW (DECL_SIZE (decl));
! 	  DECL_SIZE (decl) = 0;
! 	}
!     }
!   else if (code != VAR_DECL && code != PARM_DECL && code != RESULT_DECL
! 	   && code != TYPE_DECL)
      abort ();
  
*************** extern int tree_code_length[MAX_TREE_COD
*** 68,73 ****
  extern const char *tree_code_name[MAX_TREE_CODES];
  
! /* Classify which part of the compiler has defined a given builtin
!    function.  */
  enum built_in_class
  {
--- 68,73 ----
  extern const char *tree_code_name[MAX_TREE_CODES];
  
! /* Classify which part of the compiler has defined a given builtin function.
!    Note that we assume below that this is no more than two bits.  */
  enum built_in_class
  {
*************** enum built_in_class
*** 77,80 ****
--- 77,84 ----
    BUILT_IN_NORMAL
  };
+ 
+ /* Names for the above.  */
+ extern char *built_in_class_names[4];
+ 
  /* Codes that identify the various built in functions
     so that expand_call can identify them quickly.  */
*************** enum built_in_function
*** 150,153 ****
--- 154,160 ----
    END_BUILTINS
  };
+ 
+ /* Names for the above.  */
+ extern char *built_in_names[(int) END_BUILTINS];
  
  /* The definition of tree nodes fills the next several pages.  */
*************** struct tree_type
*** 952,956 ****
    unsigned char precision;
  #ifdef ONLY_INT_FIELDS
!   int mode : 8;
  #else
    enum machine_mode mode : 8;
--- 959,963 ----
    unsigned char precision;
  #ifdef ONLY_INT_FIELDS
!   unsigned int mode : 8;
  #else
    enum machine_mode mode : 8;
*************** struct tree_type
*** 1147,1151 ****
  #define DECL_SIZE_UNIT(NODE) (DECL_CHECK (NODE)->decl.size_unit)
  /* Holds the alignment required for the datum.  */
! #define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.frame_size.u)
  /* Holds the machine mode corresponding to the declaration of a variable or
     field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
--- 1154,1158 ----
  #define DECL_SIZE_UNIT(NODE) (DECL_CHECK (NODE)->decl.size_unit)
  /* Holds the alignment required for the datum.  */
! #define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.u1.u)
  /* Holds the machine mode corresponding to the declaration of a variable or
     field.  Always equal to TYPE_MODE (TREE_TYPE (decl)) except for a
*************** struct tree_type
*** 1163,1178 ****
  /* For PARM_DECL, holds an RTL for the stack slot or register
     where the data was actually passed.  */
! #define DECL_INCOMING_RTL(NODE) (DECL_CHECK (NODE)->decl.saved_insns.r)
  /* For FUNCTION_DECL, if it is inline, holds the saved insn chain.  */
! #define DECL_SAVED_INSNS(NODE) (DECL_CHECK (NODE)->decl.saved_insns.f)
  /* For FUNCTION_DECL, if it is inline,
     holds the size of the stack frame, as an integer.  */
! #define DECL_FRAME_SIZE(NODE) (DECL_CHECK (NODE)->decl.frame_size.i)
  /* For FUNCTION_DECL, if it is built-in,
     this identifies which built-in operation it is.  */
! #define DECL_FUNCTION_CODE(NODE) (DECL_CHECK (NODE)->decl.frame_size.f.code)
! #define DECL_SET_FUNCTION_CODE(NODE,VAL) (DECL_CHECK (NODE)->decl.frame_size.f.code = (VAL))
! /* For a FIELD_DECL, holds the size of the member as an integer.  */
! #define DECL_FIELD_SIZE(NODE) (DECL_CHECK (NODE)->decl.saved_insns.i)
  
  /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
--- 1170,1182 ----
  /* For PARM_DECL, holds an RTL for the stack slot or register
     where the data was actually passed.  */
! #define DECL_INCOMING_RTL(NODE) (DECL_CHECK (NODE)->decl.u2.r)
  /* For FUNCTION_DECL, if it is inline, holds the saved insn chain.  */
! #define DECL_SAVED_INSNS(NODE) (DECL_CHECK (NODE)->decl.u2.f)
  /* For FUNCTION_DECL, if it is inline,
     holds the size of the stack frame, as an integer.  */
! #define DECL_FRAME_SIZE(NODE) (DECL_CHECK (NODE)->decl.u1.i)
  /* For FUNCTION_DECL, if it is built-in,
     this identifies which built-in operation it is.  */
! #define DECL_FUNCTION_CODE(NODE) (DECL_CHECK (NODE)->decl.u1.f)
  
  /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways.
*************** struct tree_type
*** 1298,1302 ****
  #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
  /* For a builtin function, identify which part of the compiler defined it.  */
! #define DECL_BUILT_IN_CLASS(NODE) (DECL_CHECK (NODE)->decl.frame_size.f.bclass)
  
  /* In a VAR_DECL that's static,
--- 1302,1306 ----
  #define DECL_BUILT_IN(NODE) (DECL_BUILT_IN_CLASS (NODE) != NOT_BUILT_IN)
  /* For a builtin function, identify which part of the compiler defined it.  */
! #define DECL_BUILT_IN_CLASS(NODE) (DECL_CHECK (NODE)->decl.built_in_class)
  
  /* In a VAR_DECL that's static,
*************** struct tree_decl
*** 1411,1414 ****
--- 1415,1430 ----
    unsigned weak_flag : 1;
  
+   unsigned non_addr_const_p : 1;
+   unsigned no_instrument_function_entry_exit : 1;
+   unsigned no_check_memory_usage : 1;
+   unsigned comdat_flag : 1;
+   unsigned malloc_flag : 1;
+   unsigned no_limit_stack : 1;
+ #ifdef ONLY_INT_FIELDS
+   unsigned int built_in_class : 2;
+ #else
+   enum built_in_class built_in_class : 2;
+ #endif
+ 
    unsigned lang_flag_0 : 1;
    unsigned lang_flag_1 : 1;
*************** struct tree_decl
*** 1420,1442 ****
    unsigned lang_flag_7 : 1;
  
-   unsigned non_addr_const_p : 1;
-   unsigned no_instrument_function_entry_exit : 1;
-   unsigned no_check_memory_usage : 1;
-   unsigned comdat_flag : 1;
-   unsigned malloc_flag : 1;
-   unsigned no_limit_stack : 1;
- 
    /* For a FUNCTION_DECL, if inline, this is the size of frame needed.
       If built-in, this is the code for which built-in function.
       For other kinds of decls, this is DECL_ALIGN.  */
    union {
!     int i;
      unsigned int u;
!     struct
!       {
! 	unsigned int code:24;
! 	unsigned int bclass:8;
!       } f;
!   } frame_size;
  
    union tree_node *size_unit;
--- 1436,1447 ----
    unsigned lang_flag_7 : 1;
  
    /* For a FUNCTION_DECL, if inline, this is the size of frame needed.
       If built-in, this is the code for which built-in function.
       For other kinds of decls, this is DECL_ALIGN.  */
    union {
!     HOST_WIDE_INT i;
      unsigned int u;
!     enum built_in_function f;
!   } u1;
  
    union tree_node *size_unit;
*************** struct tree_decl
*** 1450,1464 ****
    union tree_node *section_name;
    union tree_node *machine_attributes;
!   struct rtx_def *rtl;	/* acts as link to register transfer language
! 				   (rtl) info */
    struct rtx_def *live_range_rtl;
  
!   /* For FUNCTION_DECLs: points to insn that constitutes its definition
!      on the permanent obstack.  For FIELD_DECL, this is DECL_FIELD_SIZE.  */
    union {
      struct function *f;
      struct rtx_def *r;
!     HOST_WIDE_INT i;
!   } saved_insns;
    union tree_node *vindex;
    int pointer_alias_set;
--- 1455,1472 ----
    union tree_node *section_name;
    union tree_node *machine_attributes;
!   struct rtx_def *rtl;	/* RTL representation for object.  */
    struct rtx_def *live_range_rtl;
  
!   /* In FUNCTION_DECL, if it is inline, holds the saved insn chain.
!      In PARM_DECL, holds an RTL for the stack slot
!      of register where the data was actually passed.
!      Used by Chill and Java in LABEL_DECL and by C++ and Java in VAR_DECL.  */
    union {
      struct function *f;
      struct rtx_def *r;
!     union tree_node *t;
!     int i;
!   } u2;
! 
    union tree_node *vindex;
    int pointer_alias_set;
*** ch/ch-tree.h	2000/02/26 13:51:58	1.18
--- ch/ch-tree.h	2000/02/28 19:23:54
*************** extern int action_nesting_level;
*** 89,93 ****
  
  /* For a LABEL_DECL:  action_nesting_level of its target. */
! #define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.saved_insns.i)
  
  #define DECL_OLD_PREFIX(DECL) ((DECL)->decl.initial)
--- 89,93 ----
  
  /* For a LABEL_DECL:  action_nesting_level of its target. */
! #define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.u2.i)
  
  #define DECL_OLD_PREFIX(DECL) ((DECL)->decl.initial)
*** ch/decl.c	2000/02/20 01:10:48	1.19
--- ch/decl.c	2000/02/28 19:24:00
*************** finish_struct (t, fieldlist)
*** 4338,4353 ****
    register tree x;
  
!   /* Install struct as DECL_CONTEXT of each field decl.
!      Also process specified field sizes.
!      Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
!      The specified size is found in the DECL_INITIAL.
!      Store 0 there, except for ": 0" fields (so we can find them
!      and delete them, below).  */
! 
    for (x = fieldlist; x; x = TREE_CHAIN (x))
!     {
!       DECL_CONTEXT (x) = t;
!       DECL_FIELD_SIZE (x) = 0;
!     }
  
    TYPE_FIELDS (t) = fieldlist;
--- 4338,4344 ----
    register tree x;
  
!   /* Install struct as DECL_CONTEXT of each field decl.  */
    for (x = fieldlist; x; x = TREE_CHAIN (x))
!     DECL_CONTEXT (x) = t;
  
    TYPE_FIELDS (t) = fieldlist;
*** ch/typeck.c	2000/02/27 21:39:36	1.21
--- ch/typeck.c	2000/02/28 19:24:03
*************** make_chill_struct_type (fieldlist)
*** 2993,3006 ****
  {
    tree t, x;
!   if (TREE_UNION_ELEM (fieldlist))
!     t = make_node (UNION_TYPE);
!   else
!     t = make_node (RECORD_TYPE);
    /* Install struct as DECL_CONTEXT of each field decl. */
    for (x = fieldlist; x; x = TREE_CHAIN (x))
!     {
!       DECL_CONTEXT (x) = t;
!       DECL_FIELD_SIZE (x) = 0;
!     }
  
    /* Delete all duplicate fields from the fieldlist */
--- 2993,3002 ----
  {
    tree t, x;
! 
!   t = make_node (TREE_UNION_ELEM (fieldlist) ? UNION_TYPE : RECORD_TYPE);
! 
    /* Install struct as DECL_CONTEXT of each field decl. */
    for (x = fieldlist; x; x = TREE_CHAIN (x))
!     DECL_CONTEXT (x) = t;
  
    /* Delete all duplicate fields from the fieldlist */
*************** make_chill_struct_type (fieldlist)
*** 3033,3062 ****
    return t;
  }
  
- /* decl is a FIELD_DECL.
-    DECL_INIT (decl) is (NULL_TREE, integer_one_node, integer_zero_node, tree_list),
-    meaning (default, pack, nopack, POS (...) ).
     The return value is a boolean: 1 if POS specified, 0 if not */
  static int
  apply_chill_field_layout (decl, next_struct_offset)
       tree decl;
!      int* next_struct_offset;
  {
!   tree layout, type, temp, what;
!   int word = 0, wordsize, start_bit, offset, length, natural_length;
    int pos_error = 0;
!   int is_discrete;
  
-   type = TREE_TYPE (decl);
-   is_discrete = discrete_type_p (type);
    if (is_discrete)
!     natural_length = get_type_precision (TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type));
    else
      natural_length = TREE_INT_CST_LOW (TYPE_SIZE (type));
  
-   layout = DECL_INITIAL (decl);
    if (layout == integer_zero_node) /* NOPACK */
      {
-       DECL_PACKED (decl) = 0;
        *next_struct_offset += natural_length;
        return 0; /* not POS */
--- 3029,3062 ----
    return t;
  }
+ 
+ /* DECL is a FIELD_DECL.
+    DECL_INIT (decl) is
+        (NULL_TREE, integer_one_node, integer_zero_node, tree_list)
+     meaning
+         (default, pack, nopack, POS (...) ).
  
     The return value is a boolean: 1 if POS specified, 0 if not */
+ 
  static int
  apply_chill_field_layout (decl, next_struct_offset)
       tree decl;
!      int *next_struct_offset;
  {
!   tree layout = DECL_INITIAL (decl);
!   tree type = TREE_TYPE (decl);
!   tree temp, what;
!   HOST_WIDE_INT word = 0;
!   HOST_WIDE_INT wordsize, start_bit, offset, length, natural_length;
    int pos_error = 0;
!   int is_discrete = discrete_type_p (type);
  
    if (is_discrete)
!     natural_length
!       = get_type_precision (TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type));
    else
      natural_length = TREE_INT_CST_LOW (TYPE_SIZE (type));
  
    if (layout == integer_zero_node) /* NOPACK */
      {
        *next_struct_offset += natural_length;
        return 0; /* not POS */
*************** apply_chill_field_layout (decl, next_str
*** 3066,3077 ****
      {
        if (is_discrete)
- 	DECL_BIT_FIELD (decl) = 1;
-       else
  	{
! 	  DECL_BIT_FIELD (decl) = 0;
! 	  DECL_ALIGN (decl) = BITS_PER_UNIT;
  	}
        DECL_PACKED (decl) = 1;
-       DECL_FIELD_SIZE (decl) = natural_length;
        *next_struct_offset += natural_length;
        return 0; /* not POS */
--- 3066,3077 ----
      {
        if (is_discrete)
  	{
! 	  DECL_BIT_FIELD (decl) = 1;
! 	  DECL_SIZE (decl) = bitsize_int (natural_length);
  	}
+       else
+ 	DECL_ALIGN (decl) = BITS_PER_UNIT;
+ 
        DECL_PACKED (decl) = 1;
        *next_struct_offset += natural_length;
        return 0; /* not POS */
*************** apply_chill_field_layout (decl, next_str
*** 3091,3095 ****
      {
        word = TREE_INT_CST_LOW (TREE_PURPOSE (temp));
!       if (word < 0)
  	{
  	  error ("Starting word in POS must be >= 0");
--- 3091,3095 ----
      {
        word = TREE_INT_CST_LOW (TREE_PURPOSE (temp));
!       if (tree_int_cst_sgn (TREE_PURPOSE (temp)) < 0)
  	{
  	  error ("Starting word in POS must be >= 0");
*************** apply_chill_field_layout (decl, next_str
*** 3115,3119 ****
  	{
  	  start_bit = TREE_INT_CST_LOW (TREE_PURPOSE (temp));
! 	  if (start_bit < 0)
  	    {
  	      error ("Starting bit in POS must be >= 0");
--- 3115,3119 ----
  	{
  	  start_bit = TREE_INT_CST_LOW (TREE_PURPOSE (temp));
! 	  if (tree_int_cst_sgn (TREE_PURPOSE (temp)) < 0)
  	    {
  	      error ("Starting bit in POS must be >= 0");
*************** apply_chill_field_layout (decl, next_str
*** 3143,3147 ****
  		{
  		  length = TREE_INT_CST_LOW (TREE_VALUE (temp));
! 		  if (length <= 0)
  		    {
  		      error ("Length in POS must be > 0");
--- 3143,3147 ----
  		{
  		  length = TREE_INT_CST_LOW (TREE_VALUE (temp));
! 		  if (tree_int_cst_sgn (TREE_VALUE (temp)) < 0)
  		    {
  		      error ("Length in POS must be > 0");
*************** apply_chill_field_layout (decl, next_str
*** 3160,3164 ****
  	      else
  		{
! 		  int end_bit = TREE_INT_CST_LOW (TREE_VALUE (temp));
  		  if (end_bit < start_bit)
  		    {
--- 3160,3165 ----
  	      else
  		{
! 		  HOST_WIDE_INT end_bit = TREE_INT_CST_LOW (TREE_VALUE (temp));
! 
  		  if (end_bit < start_bit)
  		    {
*************** apply_chill_field_layout (decl, next_str
*** 3175,3178 ****
--- 3176,3180 ----
  		}
  	    }
+ 
  	  if (length != natural_length && ! pos_error)
  	    {
*************** apply_chill_field_layout (decl, next_str
*** 3190,3194 ****
    DECL_PACKED (decl) = 1;
    DECL_BIT_FIELD (decl) = is_discrete;
!   DECL_FIELD_SIZE (decl) = length;
    *next_struct_offset += natural_length;
  
--- 3192,3199 ----
    DECL_PACKED (decl) = 1;
    DECL_BIT_FIELD (decl) = is_discrete;
! 
!   if (is_discrete)
!     DECL_SIZE (decl) = bitsize_int (length);
! 
    *next_struct_offset += natural_length;
  
*************** layout_chill_struct_type (t)
*** 3209,3219 ****
  
    old_momentary = suspend_momentary ();
- 
-   /* Process specified field sizes.
-      Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
-      The specified size is found in the DECL_INITIAL.
-      Store 0 there, except for ": 0" fields (so we can find them
-      and delete them, below).  */
  
    next_struct_offset = 0;
    for (x = fieldlist; x; x = TREE_CHAIN (x))
--- 3214,3219 ----
  
    old_momentary = suspend_momentary ();
  
+   /* Process specified field sizes.  */
    next_struct_offset = 0;
    for (x = fieldlist; x; x = TREE_CHAIN (x))
*** cp/class.c	2000/02/27 21:39:37	1.264
--- cp/class.c	2000/02/28 19:24:58
*************** check_bitfield_decl (field)
*** 3677,3681 ****
  	{
  	  DECL_INITIAL (field) = NULL_TREE;
! 	  DECL_FIELD_SIZE (field) = width;
  	  DECL_BIT_FIELD (field) = 1;
  
--- 3677,3681 ----
  	{
  	  DECL_INITIAL (field) = NULL_TREE;
! 	  DECL_SIZE (field) = bitsize_int (width);
  	  DECL_BIT_FIELD (field) = 1;
  
*************** check_field_decls (t, access_decls, empt
*** 3922,3926 ****
  	  
        DECL_SAVED_INSNS (x) = 0;
-       DECL_FIELD_SIZE (x) = 0;
  
        /* When this goes into scope, it will be a non-local reference.  */
--- 3922,3925 ----
*************** build_vtbl_or_vbase_field (name, assembl
*** 4080,4084 ****
    DECL_FCONTEXT (field) = fcontext;
    DECL_SAVED_INSNS (field) = 0;
-   DECL_FIELD_SIZE (field) = 0;
    DECL_ALIGN (field) = TYPE_ALIGN (type);
  
--- 4079,4082 ----
*************** check_methods (t)
*** 4280,4290 ****
  	continue;
  
-       /* Do both of these, even though they're in the same union;
- 	 if the insn `r' member and the size `i' member are
- 	 different sizes, as on the alpha, the larger of the two
- 	 will end up with garbage in it.  */
        DECL_SAVED_INSNS (x) = 0;
-       DECL_FIELD_SIZE (x) = 0;
- 
        check_for_override (x, t);
        if (DECL_PURE_VIRTUAL_P (x) && ! DECL_VINDEX (x))
--- 4278,4282 ----
*** cp/cp-tree.h	2000/02/27 21:39:37	1.409
--- cp/cp-tree.h	2000/02/28 19:25:05
*************** Boston, MA 02111-1307, USA.  */
*** 113,120 ****
       TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
  
!    DECL_SAVED_INSNS/DECL_FIELD_SIZE
!      For a static VAR_DECL, this is DECL_INIT_PRIORITY.
! 
!    BINFO_VIRTUALS
       For a binfo, this is a TREE_LIST.  The BV_DELTA of each node
       gives the amount by which to adjust the `this' pointer when
--- 113,117 ----
       TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO.
  
!   BINFO_VIRTUALS
       For a binfo, this is a TREE_LIST.  The BV_DELTA of each node
       gives the amount by which to adjust the `this' pointer when
*************** struct lang_decl
*** 2059,2065 ****
     initialization priority.  If this value is zero, the NODE will be
     initialized at the DEFAULT_INIT_PRIORITY.  */
! #define DECL_INIT_PRIORITY(NODE) (DECL_FIELD_SIZE (VAR_DECL_CHECK (NODE)))
  
! /* In a TREE_LIST concatenating using directives, indicate indirekt
     directives  */
  #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
--- 2056,2062 ----
     initialization priority.  If this value is zero, the NODE will be
     initialized at the DEFAULT_INIT_PRIORITY.  */
! #define DECL_INIT_PRIORITY(NODE) (VAR_DECL_CHECK (NODE)->decl.u2.i)
  
! /* In a TREE_LIST concatenating using directives, indicate indirect
     directives  */
  #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
*************** extern int flag_new_for_scope;
*** 2867,2871 ****
  /* An integer indicating how many bytes should be subtracted from the
     `this' pointer when this function is called.  */
! #define THUNK_DELTA(DECL) ((DECL)->decl.frame_size.i)
  
  /* An integer indicating how many bytes should be subtracted from the
--- 2864,2868 ----
  /* An integer indicating how many bytes should be subtracted from the
     `this' pointer when this function is called.  */
! #define THUNK_DELTA(DECL) (DECL_CHECK (DECL)->decl.u1.i)
  
  /* An integer indicating how many bytes should be subtracted from the
*************** extern int flag_new_for_scope;
*** 2873,2877 ****
     is always located at offset zero from the f `this' pointer.)  If
     zero, then there is no vcall offset.  */
! #define THUNK_VCALL_OFFSET(DECL) (DECL_FIELD_SIZE (DECL))
  
  /* DECL_NEEDED_P holds of a declaration when we need to emit its
--- 2870,2874 ----
     is always located at offset zero from the f `this' pointer.)  If
     zero, then there is no vcall offset.  */
! #define THUNK_VCALL_OFFSET(DECL) (DECL_CHECK (DECL)->decl.u2.i)
  
  /* DECL_NEEDED_P holds of a declaration when we need to emit its
*** cp/rtti.c	2000/02/27 21:39:38	1.62
--- cp/rtti.c	2000/02/28 19:25:07
*************** expand_class_desc (tdecl, type)
*** 964,979 ****
  	 flag_new_abi ? intSI_type_node : unsigned_intSI_type_node);
        DECL_BIT_FIELD (fields[1]) = 1;
!       DECL_FIELD_SIZE (fields[1]) = 29;
  
!       fields [2] = build_lang_decl
! 	(FIELD_DECL, NULL_TREE, boolean_type_node);
        DECL_BIT_FIELD (fields[2]) = 1;
!       DECL_FIELD_SIZE (fields[2]) = 1;
  
        /* Actually enum access */
!       fields [3] = build_lang_decl
! 	(FIELD_DECL, NULL_TREE, integer_type_node);
        DECL_BIT_FIELD (fields[3]) = 1;
!       DECL_FIELD_SIZE (fields[3]) = 2;
  
        finish_builtin_type (base_desc_type_node, "__base_info", fields,
--- 964,977 ----
  	 flag_new_abi ? intSI_type_node : unsigned_intSI_type_node);
        DECL_BIT_FIELD (fields[1]) = 1;
!       DECL_SIZE (fields[1]) = bitsize_int (29);
  
!       fields [2] = build_lang_decl (FIELD_DECL, NULL_TREE, boolean_type_node);
        DECL_BIT_FIELD (fields[2]) = 1;
!       DECL_SIZE (fields[2]) = bitsize_int (1);
  
        /* Actually enum access */
!       fields [3] = build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node);
        DECL_BIT_FIELD (fields[3]) = 1;
!       DECL_SIZE (fields[3]) = bitsize_int (2);
  
        finish_builtin_type (base_desc_type_node, "__base_info", fields,
*** java/java-tree.h	2000/02/26 19:56:23	1.54
--- java/java-tree.h	2000/02/28 19:25:19
*************** struct lang_identifier
*** 403,407 ****
  
  /* In a LABEL_DECL, the corresponding bytecode program counter. */
! #define LABEL_PC(NODE) ((NODE)->decl.saved_insns.i)
  
  /* Used during verification to mark the label has "changed". (See JVM Spec). */
--- 403,407 ----
  
  /* In a LABEL_DECL, the corresponding bytecode program counter. */
! #define LABEL_PC(NODE) ((NODE)->decl.u2.i)
  
  /* Used during verification to mark the label has "changed". (See JVM Spec). */
*************** struct lang_identifier
*** 441,445 ****
     specifies if this decl is definitively assigned.
     A DECL_BIT_INDEX of -1 means we no longer care. */
! #define DECL_BIT_INDEX(DECL) DECL_FIELD_SIZE(DECL)
  
  /* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
--- 441,445 ----
     specifies if this decl is definitively assigned.
     A DECL_BIT_INDEX of -1 means we no longer care. */
! #define DECL_BIT_INDEX(DECL) (DECL_CHECK (DECL)->decl.u2.i)
  
  /* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
*** java/parse.h	2000/01/25 18:29:02	1.44
--- java/parse.h	2000/02/28 19:25:20
*************** typedef struct _jdeplist {
*** 594,598 ****
  /* Macro for the xreferencer */
  #define DECL_END_SOURCE_LINE(DECL)       DECL_FRAME_SIZE (DECL)
! #define DECL_INHERITED_SOURCE_LINE(DECL) DECL_FIELD_SIZE (DECL)
       
  /* Parser context data structure. */
--- 594,598 ----
  /* Macro for the xreferencer */
  #define DECL_END_SOURCE_LINE(DECL)       DECL_FRAME_SIZE (DECL)
! #define DECL_INHERITED_SOURCE_LINE(DECL) (DECL_CHECK (DECL)->decl.u2.i)
       
  /* Parser context data structure. */
*** objc/objc-act.c	2000/02/26 19:53:58	1.37
--- objc/objc-act.c	2000/02/28 19:25:28
*************** objc_copy_list (list, head)
*** 2469,2480 ****
        /* The following statement fixes a bug when inheriting instance
  	 variables that are declared to be bitfields. finish_struct
! 	 expects to find the width of the bitfield in DECL_INITIAL,
! 	 which it nulls out after processing the decl of the super
! 	 class...rather than change the way finish_struct works (which
! 	 is risky), I create the situation it expects...s.naroff
! 	 (7/23/89).  */
! 
        if (DECL_BIT_FIELD (tail) && DECL_INITIAL (tail) == 0)
! 	DECL_INITIAL (tail) = build_int_2 (DECL_FIELD_SIZE (tail), 0);
  
        newlist = chainon (newlist, tail);
--- 2469,2475 ----
        /* The following statement fixes a bug when inheriting instance
  	 variables that are declared to be bitfields. finish_struct
! 	 expects to find the width of the bitfield in DECL_INITIAL.  */
        if (DECL_BIT_FIELD (tail) && DECL_INITIAL (tail) == 0)
! 	DECL_INITIAL (tail) = DECL_SIZE (tail);
  
        newlist = chainon (newlist, tail);
*************** encode_field_decl (field_decl, curtype, 
*** 6871,6879 ****
      {
        if (DECL_BIT_FIELD (field_decl))
! 	encode_bitfield (DECL_FIELD_SIZE (field_decl));
!       else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
! 	       && DECL_FIELD_SIZE (field_decl)
! 	       && TYPE_MODE (type) > DECL_MODE (field_decl))
! 	encode_bitfield (DECL_FIELD_SIZE (field_decl));
        else
  	encode_type (TREE_TYPE (field_decl), curtype, format);
--- 6866,6870 ----
      {
        if (DECL_BIT_FIELD (field_decl))
! 	encode_bitfield (TREE_INT_CST_LOW (DECL_SIZE (field_decl)));
        else
  	encode_type (TREE_TYPE (field_decl), curtype, format);
*************** encode_field_decl (field_decl, curtype, 
*** 6881,6893 ****
    else
      {
!       if (DECL_BIT_FIELD (field_decl)
! 	  || (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
! 	      && DECL_FIELD_SIZE (field_decl)
! 	      && TYPE_MODE (type) > DECL_MODE (field_decl)))
! 	{
! 	  encode_complete_bitfield (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl)),
! 				    DECL_BIT_FIELD_TYPE (field_decl),
! 				    DECL_FIELD_SIZE (field_decl));
! 	}
        else
  	encode_type (TREE_TYPE (field_decl), curtype, format);
--- 6872,6879 ----
    else
      {
!       if (DECL_BIT_FIELD (field_decl))
! 	encode_complete_bitfield (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl)),
! 				  DECL_BIT_FIELD_TYPE (field_decl),
! 				  TREE_INT_CST_LOW (DECL_SIZE (field_decl)));
        else
  	encode_type (TREE_TYPE (field_decl), curtype, format);


More information about the Gcc-patches mailing list