[PATCH]: Move FIELD_DECL into it's own structure

Daniel Berlin dberlin@dberlin.org
Wed May 25 17:52:00 GMT 2005


On Mon, 2005-05-23 at 15:34 -0700, Mark Mitchell wrote:
> Daniel Berlin wrote:
> 
> > This is actually a much harder job than one first assumes.
> > In fact, because of the way we do some stuff at runtime, i'm not
> > actually sure it's posible
> 
> We estimated several person-months for a proper analysis.  So, I'm not 
> sure if that's harder than most people assume, but I sure don't think 
> it's trivial.  That's why I don't think you should be made to do it, 
> even though I really wish it were done up-front; it's not work we can 
> reasonably ask a volunteer to do.
> 
> > I have no problem with this.
> > Although i also have no deviation from the current macro usage planned,
> > if someone wants to do that, more power to them :)
> 
> Fair enough.  Incrementalism is a good thing.  Thanks!
> 

Okay, well, i've updated the patch based on your comments.

In fact, i've actually got 3 patches, and i'm not sure which would be
best to submit to start

They are:

1. The original FIELD_DECL patch i had submitted, updated per your
comments, which does not have the hierarchy on the web page, has a few !
= FIELD_DECL checks (though i added HAS_RTL_P and
HAS_DECL_ASSEMBLER_NAME_P so it's a very small number of checks), and
has the negative NOT_FIELD_DECL_CHECK's

2. An updated version of the FIELD_DECL patch that also contains the new
dynamic checking stuff, so that all the checks are positive checks
written like:

CHECK_CODE_CONTAINS_STRUCT (TREE_CODE (node), TS_DECL_NON_COMMON).

NOT_FIELD_DECL_CHECK (and DECL_CHECK) is completely gone, replaced with
positive structure checks of the above form.

HAS_RTL_P and HAS_DECL_ASSEMBLER_NAME_P are written as 
#define HAS_RTL_P (CODE_CONTAINS_STRUCT (TREE_CODE (NODE),
TS_DECL_NON_COMON))  

CODE_CONTAINS_STRUCT is the non-asserting form of
CHECK_CODE_CONTAINS_STRUCT

A new file treestruct.def is introduced to store the enums, and a
printable name for each enum, so we can use it in the
CHECK_CODE_CONTAINS_STRUCT failure function.

A langhook is added to init the tree_contains_struct array so that C++
and friends can set it up right.

However, the hierearchy is still the same as the original patch, only
FIELD_DECL is moved out.

Finally, i have 

3. An updated version of the FIELD_DECL patch that contains everything
in 2, plus the hierarchy looks like that described on the web page 
(tree_decl_minimal, tree_decl_common, tree_decl_with_rtl) and has
PARM_DECL split out into tree_parm_decl as well.

All of these bootstrap and regtest okay on 3 platforms (powerpc-darwin,
x86-64-linux-gnu, and i686-pc-linux-gnu)

In any case, we'd eventually get to 3, it's more a matter of what patch
i should start with.  I should also note that 2 and 3 are not
significantly larger than 1. because they all touch more or less the
same lines (3 is about 20 lines larger than 1).

I should also note that timings on all three patches are in decreasing
order.  IE the new dynamic checking is actually slightly faster than the
old tree_code_class checks on everything i've tried, from cc1-i-files to
tramp3d to Gerald's stuff, and patch 3 is the fastest of them all by a
slight amount, besides using the least memory.

--Dan



More information about the Gcc-patches mailing list