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]

Re: Patch: Prune unused DECL_STMTs from saved tree structure


On Tue, Aug 29, 2000 at 09:46:35AM -0700, Mark Mitchell wrote:
> 
> Good question.  walk_tree is pretty flexible -- you can give it hints
> about how to walk -- but perhaps it is not worth the bother.  Zack,
> why don't you take a quick look, and if you can't make it work, use
> your original patch.  We can always switch it later.

It does appear to work on a quick look.  I have a question about the
tree structure, though.

Here's what we get for inline int foo() { return 23; } after pruning
unused decls.

 <compound_stmt 0x4010a840 tree_1
    arg 0 <scope_stmt 0x4010a860 tree_0 tree_1
        arg 0 <block 0x4010ad60 used>
        chain <return_stmt 0x4010ad20 tree_1
            arg 0 <init_expr 0x4010ad00 type <integer_type 0x400fb400 int>
                side-effects 
                arg 0 <result_decl 0x4010b380>
                arg 1 <integer_cst 0x4010aca0 constant 23>>
            chain <scope_stmt 0x4010ad40 tree_1 arg 0 <block 0x4010ad60>>>>>

The BLOCK node no longer contains any data at all.  Would it be safe
to discard it and the SCOPE_STMTs, too?  Thus producing

 <compound_stmt 0x4010a840 tree_1
    arg 0 <return_stmt 0x4010ad20 tree_1
            arg 0 <init_expr 0x4010ad00 type <integer_type 0x400fb400 int>
                side-effects
                arg 0 <result_decl 0x4010b380>
                arg 1 <integer_cst 0x4010aca0 constant 23>>>>

Or even just 

 <return_stmt 0x4010ad20 tree_1
    arg 0 <init_expr 0x4010ad00 type <integer_type 0x400fb400 int>
        side-effects 
        arg 0 <result_decl 0x4010b380>
        arg 1 <integer_cst 0x4010aca0 constant 23>>>

Eliminating the SCOPE_STMTs and BLOCKs would be good for another
megabyte off Apple's test case, and the COMPOUND_STMTs another 250K or
so.  (Assuming they all go away.)

zw

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