public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [LTO][PATCH] Handle name in pointer and ref types
@ 2007-12-14  7:25 Doug Kwan (關振德)
  2007-12-14 13:38 ` Diego Novillo
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Kwan (關振德) @ 2007-12-14  7:25 UTC (permalink / raw)
  To: gcc-patches, Kenneth Zadeck, Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Hi,

   Could someone review this? Internal pointer types created by gcc
can have names.  The current code in lto1 does not handle this
situation.  This patch does reasonable things to handle that
situation.

-Doug

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1184 bytes --]

2007-12-13  Doug Kwan  <dougkwan@google.com>

	* lto.c (lto_read_pointer_reference_type_DIE): Handle optional name
	in pointer and reference types.

Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c	(revision 130927)
+++ gcc/lto/lto.c	(working copy)
@@ -2793,10 +2793,15 @@ lto_read_pointer_reference_type_DIE (lto
 				     lto_context *context)
 {
   tree pointed_to = NULL_TREE;
+  tree name = NULL_TREE;
   tree type;
 
   LTO_BEGIN_READ_ATTRS ()
     {
+    case DW_AT_name:
+      name = lto_get_identifier (&attr_data);
+      break;
+
     case DW_AT_type:
       pointed_to = lto_read_referenced_type_DIE (fd, 
 						 context, 
@@ -2830,6 +2835,16 @@ lto_read_pointer_reference_type_DIE (lto
       gcc_unreachable ();
     }
 
+  /* If pointer/reference has a name, build a typedef. */
+  if (name != NULL_TREE)
+    {
+      tree named_type = build_variant_type_copy (type);
+      tree decl = build_decl (TYPE_DECL, name, named_type);
+      TYPE_NAME (named_type) = decl;
+      DECL_ORIGINAL_TYPE (decl) = type;
+      type = named_type;
+    }
+
   lto_read_child_DIEs (fd, abbrev, context);
   return type;
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTO][PATCH] Handle name in pointer and ref types
  2007-12-14  7:25 [LTO][PATCH] Handle name in pointer and ref types Doug Kwan (關振德)
@ 2007-12-14 13:38 ` Diego Novillo
  2007-12-14 19:41   ` Doug Kwan (關振德)
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Novillo @ 2007-12-14 13:38 UTC (permalink / raw)
  To: "Doug Kwan (關振德)"
  Cc: gcc-patches, Kenneth Zadeck

On 12/13/07 9:17 PM, Doug Kwan (關振德) wrote:

> 	* lto.c (lto_read_pointer_reference_type_DIE): Handle optional name
> 	in pointer and reference types.

OK.


Diego.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTO][PATCH] Handle name in pointer and ref types
  2007-12-14 13:38 ` Diego Novillo
@ 2007-12-14 19:41   ` Doug Kwan (關振德)
  0 siblings, 0 replies; 3+ messages in thread
From: Doug Kwan (關振德) @ 2007-12-14 19:41 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-patches, Kenneth Zadeck

committed to branch. Thanks.

-Doug

2007/12/14, Diego Novillo <dnovillo@google.com>:
> On 12/13/07 9:17 PM, Doug Kwan (關振德) wrote:
>
> >       * lto.c (lto_read_pointer_reference_type_DIE): Handle optional name
> >       in pointer and reference types.
>
> OK.
>
>
> Diego.
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-12-14 19:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-14  7:25 [LTO][PATCH] Handle name in pointer and ref types Doug Kwan (關振德)
2007-12-14 13:38 ` Diego Novillo
2007-12-14 19:41   ` Doug Kwan (關振德)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).