GCC Middle and Back End API Reference
nesting_info Struct Reference
Collaboration diagram for nesting_info:

Data Fields

struct nesting_infoouter
struct nesting_infoinner
struct nesting_infonext
struct pointer_map_tfield_map
struct pointer_map_tvar_map
struct pointer_set_tmem_refs
bitmap suppress_expansion
tree context
tree new_local_var_chain
tree debug_var_chain
tree frame_type
tree frame_decl
tree chain_field
tree chain_decl
tree nl_goto_field
bool any_parm_remapped
bool any_tramp_created
char static_chain_added

Detailed Description

   Nested function decomposition for GIMPLE.
   Copyright (C) 2004-2013 Free Software Foundation, Inc.

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.

   GCC is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with GCC; see the file COPYING3.  If not see
   <http://www.gnu.org/licenses/>.  
   The object of this pass is to lower the representation of a set of nested
   functions in order to expose all of the gory details of the various
   nonlocal references.  We want to do this sooner rather than later, in
   order to give us more freedom in emitting all of the functions in question.

   Back in olden times, when gcc was young, we developed an insanely
   complicated scheme whereby variables which were referenced nonlocally
   were forced to live in the stack of the declaring function, and then
   the nested functions magically discovered where these variables were
   placed.  In order for this scheme to function properly, it required
   that the outer function be partially expanded, then we switch to
   compiling the inner function, and once done with those we switch back
   to compiling the outer function.  Such delicate ordering requirements
   makes it difficult to do whole translation unit optimizations
   involving such functions.

   The implementation here is much more direct.  Everything that can be
   referenced by an inner function is a member of an explicitly created
   structure herein called the "nonlocal frame struct".  The incoming
   static chain for a nested function is a pointer to this struct in
   the parent.  In this way, we settle on known offsets from a known
   base, and so are decoupled from the logic that places objects in the
   function's stack frame.  More importantly, we don't have to wait for
   that to happen -- since the compilation of the inner function is no
   longer tied to a real stack frame, the nonlocal frame struct can be
   allocated anywhere.  Which means that the outer function is now
   inlinable.

   Theory of operation here is very simple.  Iterate over all the
   statements in all the functions (depth first) several times,
   allocating structures and fields on demand.  In general we want to
   examine inner functions first, so that we can avoid making changes
   to outer functions which are unnecessary.

   The order of the passes matters a bit, in that later passes will be
   skipped if it is discovered that the functions don't actually interact
   at all.  That is, they're nested in the lexical sense but could have
   been written as independent functions without change.  

Field Documentation

bool nesting_info::any_parm_remapped

Referenced by remap_vla_decls().

bool nesting_info::any_tramp_created

Referenced by remap_vla_decls().

tree nesting_info::chain_decl

Referenced by convert_gimple_call().

tree nesting_info::chain_field
tree nesting_info::debug_var_chain
struct pointer_map_t* nesting_info::field_map
tree nesting_info::frame_decl
tree nesting_info::frame_type

Referenced by remap_vla_decls().

struct nesting_info* nesting_info::inner

Referenced by remap_vla_decls().

struct pointer_set_t* nesting_info::mem_refs
tree nesting_info::new_local_var_chain

Referenced by remap_vla_decls().

struct nesting_info* nesting_info::next

Referenced by remap_vla_decls().

tree nesting_info::nl_goto_field

Referenced by lookup_tramp_for_decl().

struct nesting_info* nesting_info::outer
char nesting_info::static_chain_added
bitmap nesting_info::suppress_expansion
struct pointer_map_t* nesting_info::var_map

Referenced by get_frame_field().


The documentation for this struct was generated from the following file: