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]

[lto] PATCH: DIE readers for qualified types


Here are some more pieces of the type system. OK to commit?

-Sandra

2006-09-21  Sandra Loosemore  <sandra@codesourcery.com>

	* gcc/lto/lto.c (lto_read_pointer_reference_type_DIE): renamed from
	lto_read_pointer_type_DIE, and generalized to handle reference types,
	too.
	(lto_read_const_volatile_restrict_type_DIE): New.
	(lto_read_DIE): Update dispatch table to include new readers.

Index: gcc/lto/lto.c
===================================================================
*** gcc/lto/lto.c	(revision 117115)
--- gcc/lto/lto.c	(working copy)
*************** lto_read_unspecified_parameters_DIE (lto
*** 1967,1975 ****
  }
  
  static tree
! lto_read_pointer_type_DIE (lto_info_fd *fd,
! 			   const DWARF2_abbrev *abbrev,
! 			   lto_context *context)
  {
    tree pointed_to = NULL_TREE;
    tree type;
--- 1967,1975 ----
  }
  
  static tree
! lto_read_pointer_reference_type_DIE (lto_info_fd *fd,
! 				     const DWARF2_abbrev *abbrev,
! 				     lto_context *context)
  {
    tree pointed_to = NULL_TREE;
    tree type;
*************** lto_read_pointer_type_DIE (lto_info_fd *
*** 1992,1999 ****
    /* The DW_AT_type attribute is required.  */
    if (!pointed_to)
      lto_file_corrupt_error ((lto_fd *)fd);
!   /* Build the pointer type.  */
!   type = build_pointer_type (pointed_to);
  
    lto_read_child_DIEs (fd, abbrev, context);
    return type;
--- 1992,2009 ----
    /* The DW_AT_type attribute is required.  */
    if (!pointed_to)
      lto_file_corrupt_error ((lto_fd *)fd);
!   /* Build the pointer or reference type.  */
!   switch (abbrev->tag)
!     {
!     case DW_TAG_pointer_type:
!       type = build_pointer_type (pointed_to);
!       break;
!     case DW_TAG_reference_type:
!       type = build_reference_type (pointed_to);
!       break;
!     default:
!       gcc_unreachable ();
!     }
  
    lto_read_child_DIEs (fd, abbrev, context);
    return type;
*************** lto_read_base_type_DIE (lto_info_fd *fd,
*** 2208,2213 ****
--- 2218,2265 ----
    return type;
  }
  
+ static tree
+ lto_read_const_volatile_restrict_type_DIE (lto_info_fd *fd,
+ 					   const DWARF2_abbrev *abbrev,
+ 					   lto_context *context)
+ {
+   tree base_type = NULL_TREE;
+   tree type;
+ 
+   LTO_BEGIN_READ_ATTRS ()
+     {
+     case DW_AT_type:
+       base_type = lto_read_referenced_type_DIE (fd, 
+ 						context, 
+ 						attr_data.u.reference);
+       break;
+     }
+   LTO_END_READ_ATTRS ();
+ 
+   /* The DW_AT_type attribute is required.  */
+   if (!base_type)
+     lto_file_corrupt_error ((lto_fd *)fd);
+   /* Build the modified type.  */
+   switch (abbrev->tag)
+     {
+     case DW_TAG_const_type:
+       type = build_qualified_type (base_type, TYPE_QUAL_CONST);
+       break;
+     case DW_TAG_volatile_type:
+       type = build_qualified_type (base_type, TYPE_QUAL_VOLATILE);
+       break;
+     case DW_TAG_restrict_type:
+       type = build_qualified_type (base_type, TYPE_QUAL_RESTRICT);
+       break;
+     default:
+       gcc_unreachable ();
+     }
+ 
+   lto_read_child_DIEs (fd, abbrev, context);
+   return type;
+ }
+ 
+ 
  /* Read the next DIE from FD.  CONTEXT provides information about the
     current state of the compilation unit.  Returns a (possibly null) TREE
     representing the DIE read.  If more is non-NULL, *more is set to true
*************** lto_read_DIE (lto_info_fd *fd, lto_conte
*** 2237,2244 ****
        NULL, /* padding */
        NULL, /* member */
        NULL, /* padding */
!       lto_read_pointer_type_DIE,
!       NULL, /* reference_type */
        lto_read_compile_unit_DIE,
        NULL, /* string_type */
        NULL, /* structure_type */
--- 2289,2296 ----
        NULL, /* padding */
        NULL, /* member */
        NULL, /* padding */
!       lto_read_pointer_reference_type_DIE,
!       lto_read_pointer_reference_type_DIE,
        lto_read_compile_unit_DIE,
        NULL, /* string_type */
        NULL, /* structure_type */
*************** lto_read_DIE (lto_info_fd *fd, lto_conte
*** 2260,2266 ****
        NULL, /* access_declaration */
        lto_read_base_type_DIE,
        NULL, /* catch_block */
!       NULL, /* const_type */
        lto_read_variable_formal_parameter_constant_DIE,
        lto_read_enumerator_DIE,
        NULL, /* file_type */
--- 2312,2318 ----
        NULL, /* access_declaration */
        lto_read_base_type_DIE,
        NULL, /* catch_block */
!       lto_read_const_volatile_restrict_type_DIE,
        lto_read_variable_formal_parameter_constant_DIE,
        lto_read_enumerator_DIE,
        NULL, /* file_type */
*************** lto_read_DIE (lto_info_fd *fd, lto_conte
*** 2275,2283 ****
        NULL, /* try_block */
        NULL, /* variant_part */
        lto_read_variable_formal_parameter_constant_DIE,
!       NULL, /* volatile_type */
        NULL, /* dwarf_procedure */
!       NULL, /* restrict_type */
        NULL, /* interface_type */
        NULL, /* namespace */
        NULL, /* imported_module */
--- 2327,2335 ----
        NULL, /* try_block */
        NULL, /* variant_part */
        lto_read_variable_formal_parameter_constant_DIE,
!       lto_read_const_volatile_restrict_type_DIE,
        NULL, /* dwarf_procedure */
!       lto_read_const_volatile_restrict_type_DIE,
        NULL, /* interface_type */
        NULL, /* namespace */
        NULL, /* imported_module */

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