public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: Richard Henderson <rth@redhat.com>, gcc@gcc.gnu.org, dnovillo@redhat.com
Subject: Re: pruning unused debugging types (enums/PR23336)
Date: Fri, 10 Feb 2006 20:03:00 -0000	[thread overview]
Message-ID: <m3k6c3c78v.fsf@pantani.quesejoda.com> (raw)
In-Reply-To: <437D7395.8080000@codesourcery.com>

Hi folks.

Sorry I've taken so long on this.  There was this marriage thing in
which I was a protagonist, and it's gotten me way off balance :).

I've been chasing my tail on implementation details.  I was hoping
someone could give me a few hints.

 >> A solution that comes to mind is to have the front-end add dummy
 >> TYPE_DECL nodes to the BLOCK_VARS list of the function's outer-most
 >> BLOCK.  If the TYPE_DECL node were marked DECL_ARTIFICIAL and had
 >> no DECL_NAME, it'd be easy for us to notice that we shouldn't 
 >> actually emit debug info for the TYPE_DECL itself, but that we
 >> should consider its TREE_TYPE to be used.
 >> 
 >> I'm open to better schemes.  Perhaps a used-type hash table in
 >> the struct function.

 > I like the idea, but I think a hash table would be better.  In fact, I
 > think the best choice would be a hash table during compilation of the
 > function, transformed into a vector after the closing brace of the
 > function, so that we do not have the wasted memory associated with
 > either dummy TYPE_DECLs or hash table entries.  Also, we should do this
 > only for the kinds of types we tend to lose (maybe casts and enums?), to
 > keep the extra memory cost to a minimum.

So far the way I've envisioned (correct me if I'm wrong please), is to
add 2 entries to struct function: one for a hash table which will be
freed when we're done parsing the function, and one containing the
vector of used types.

I'd like to avoid adding 2 entries, but just the vector.  However,
parsing nested functions require us to keep a used type hash table for
each function while we parse.  Mark is this ok (adding 2 entries)?

[I was thinking we could have a static stack of hashes of used types
in the parser, and only pollute struct function with the vector.  Mark
what did you have in mind?]

[Diego suggested doing all this in the gimplifier, since we gimplify
one function at a time plus we'd only have to implement this once
instead of in each parser, but by the time the gimplifier gets a hold
of things like "(struct foo *)0x1234)->I", we no longer have a cast;
it has been decomposed into an INDIRECT_REF.]

Problem number two... I'm apparently GTY clueless, and have been
unable to declare a vector of trees as a field of struct function.
So far I have:

        VEC(tree,gc) * GTY (()) used_types_vector;

This gives me:

        build/gengtype /blah/function.h:324: unidentified type
        `VEC_tree_gc'

I've also tried:

        GTY (()) VEC(tree,gc) *used_types_vector;

        build/gengtype /blah/function.h:324: syntax error, unexpected GTY_TOKEN, expecting '}'

I've been looking for examples of tree VECTORs in GTY'able structures
to no avail, and my GTYfoo is as good as my surfing (I know I'm
supposed to go on the surfboard, but that's about it).

Below is my non working patch to function.h.

Any ideas?  Thanks.
Aldy

Index: function.h
===================================================================
--- function.h  (revision 110692)
+++ function.h  (working copy)
@@ -23,6 +23,11 @@ Software Foundation, 51 Franklin Street,
 #define GCC_FUNCTION_H

 #include "tree.h"
+#include "hashtab.h"
+#include "ggc.h"
+#include "alloc-pool.h"
+#include "varray.h"
+#include "vec.h"

 struct var_refs_queue GTY(())
 {
@@ -312,6 +317,12 @@ struct function GTY(())
   /* Language-specific code can use this to store whatever it likes.  */
   struct language_function * language;

+  /* Used types hash table.  */
+  htab_t GTY ((param_is (union tree_node))) used_types_hash;
+
+  /* Used types vector.  */
+  GTY (()) VEC(tree,gc) *used_types_vector;
+
   /* For reorg.  */

  parent reply	other threads:[~2006-02-10 20:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-17 22:08 Aldy Hernandez
2005-11-17 23:09 ` Richard Henderson
2005-11-18  6:24   ` Mark Mitchell
2005-11-18 20:09     ` Aldy Hernandez
2005-11-19  1:03       ` Mark Mitchell
2006-02-10 20:03     ` Aldy Hernandez [this message]
2006-02-14  2:11       ` Mark Mitchell
2006-02-14 11:52         ` Aldy Hernandez
2006-02-15  2:08           ` Mark Mitchell
2006-02-16 19:42             ` Aldy Hernandez
2006-02-17 23:53               ` Richard Henderson
2006-02-15 13:48           ` Diego Novillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k6c3c78v.fsf@pantani.quesejoda.com \
    --to=aldyh@redhat.com \
    --cc=dnovillo@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=mark@codesourcery.com \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).