[Bug middle-end/54779] New: split FRAME variables back into pieces

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 2 10:11:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54779

             Bug #: 54779
           Summary: split FRAME variables back into pieces
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ebotcazou@gcc.gnu.org
                CC: jamborm@gcc.gnu.org


Created attachment 28323
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28323
Original implementation

When nested functions access local variables of their parent, the compiler 
creates a special FRAME local variable in the parent, which represents the 
non-local frame, and puts into it all the variables accessed non-locally.

If these nested functions are later inlined into their parent, these FRAME 
variables generally remain unmodified and this has various drawbacks:
 1) the frame of the parent is unnecessarily large,
 2) scalarization of aggregates put into the FRAME variables is hindered,
 3) debug info for scalars put into the FRAME variables is poor since VTA only 
works on GIMPLE registers.

The attached patch makes it so that the compiler splits FRAME variables back 
into pieces when all the nested functions have been inlined.  The
transformation
is implemented as a sub-pass of execute_update_addresses_taken.  It also comes
with a testcase.  Prerequisite is revision 191970.


        * gimple.c (gimple_ior_addresses_taken_1): Handle non-local frame
        structures specially.
        * tree-ssa.c (lookup_decl_for_field): New static function.
        (split_nonlocal_frames_op): Likewise.
        (execute_update_addresses_taken): Break up non-local frame structures
        into variables when possible.



More information about the Gcc-bugs mailing list