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]
Other format: [Raw text]

[PATCH v2 0/6] Port symtab/cgraph/varpool nodes to use C++ inheritance; rename types.


Here's version 2 of this patch series.

This is now 6 patches.

The first two patches correspond to the two patches from the original
patch series (and must both be applied together to make sense).  They
convert cgraph_node and varpool_node to inherit from symtab_node_base,
eliminating union symtab_node_def, and the "symbol" fields at the
top of the two subclasses.

Specifically:

  * Patch 1 of 6 is the hand-written part of the conversion to a C++
    inheritance hierarchy, plus various workarounds for dealing with
    issues in how gengtype handles GTY((user)).  It corresponds to
    "patch 1/2" in the original patch series.  It is largely unchanged
    from the previous submission.

  * Patch 2 of 6 is the automated part of the conversion to C++
    inheritance, corresponding to "patch 2/2" in the original series.
    The main improvement is that the script now removes casts to
    (symtab_node) where these are unnecessary i.e. almost all of them,
    apart from a few that I whitelisted.  See refactor_symtab.py
    within https://github.com/davidmalcolm/gcc-refactoring-scripts for
    details.

The remaining 4 patches rename some types:

"symtab_node_base" becomes "symtab_node" (Honza's preferred name, AIUI).

This would clash with the pre-existing "symtab_node", which was a
typedef for:
  union symtab_node_def *
before patch 1, and for:
  symtab_node_base *
after it.

So we eliminate this typedef, and all uses become simply a
"symtab_node *", which is the bulk of the renaming.  There is also
a "const_symtab_node" typedef, which is eliminated; all uses become
simply a "const symtab_node *".

Details of these patches

  * Patch 3 of 6: this is trivial preparatory work before running an
    automated script - split up declarations of multiple symtab_node,
    so that each gets its own declaration.

  * Patch 4 of 6: this eliminates the symtab_node and const_symtab_node
    typedefs from ipa-ref.h

  * Patch 5 of 6: generated by another automated script, this time
    "rename_symtab.py" (as opposed to "refactor_symtab.py"), with a
    testsuite "test_rename_symtab.py"; again, these can be seen at:
    https://github.com/davidmalcolm/gcc-refactoring-scripts

    This performs the big renaming described above.

    There are some mistakes in the ChangeLog of this patch.  I would
    fix these up manually before committing.

  * Patch 6 of 6: this patch updates the hand-written GTY-handling
    code from patch 1 to take into account the changing names of the
    types.

Again, all 4 patches must be applied together for the code to compile.

I've successfully bootstrapped:
   patches (1+2)
and
   all 6 patches together
on top of r202339 on x86_64-unknown-linux-gnu.

For both builds all tests showed the same test results as an unpatched
bootstrap of r202339.

OK for trunk?

David Malcolm (6):
  Convert symtab, cgraph and varpool nodes into a real class hierarchy
  Automated conversion of symtab to class hierarchy
  Split symtab_node declarations onto multiple lines
  Remove symtab_node and const_symtab_node typedefs.
  Automated renaming of symtab types
  Update hand-written GTY routines for type renaming

 gcc/ada/gcc-interface/trans.c |   2 +-
 gcc/ada/gcc-interface/utils.c |   2 +-
 gcc/asan.c                    |  10 +-
 gcc/c-family/c-gimplify.c     |   2 +-
 gcc/c-family/c-pragma.c       |   4 +-
 gcc/cfgexpand.c               |   2 +-
 gcc/cgraph.c                  | 526 +++++++++++++++++++++++++++++-------------
 gcc/cgraph.h                  | 266 +++++++++++----------
 gcc/cgraphbuild.c             |  56 ++---
 gcc/cgraphclones.c            |  90 ++++----
 gcc/cgraphunit.c              | 327 +++++++++++++-------------
 gcc/config/i386/i386.c        |  18 +-
 gcc/coverage.c                |   4 +-
 gcc/cp/call.c                 |   2 +-
 gcc/cp/decl2.c                |  26 +--
 gcc/cp/lambda.c               |   4 +-
 gcc/cp/method.c               |   4 +-
 gcc/cp/optimize.c             |   2 +-
 gcc/cp/tree.c                 |   4 +-
 gcc/dbxout.c                  |   2 +-
 gcc/dwarf2out.c               |   4 +-
 gcc/gimple-fold.c             |  10 +-
 gcc/gimplify.c                |   4 +-
 gcc/ipa-cp.c                  |  72 +++---
 gcc/ipa-devirt.c              |  44 ++--
 gcc/ipa-inline-analysis.c     |  54 ++---
 gcc/ipa-inline-transform.c    |  52 ++---
 gcc/ipa-inline.c              | 168 +++++++-------
 gcc/ipa-profile.c             |  36 +--
 gcc/ipa-prop.c                |  88 +++----
 gcc/ipa-pure-const.c          |  56 ++---
 gcc/ipa-ref-inline.h          |   4 +-
 gcc/ipa-ref.c                 |  34 +--
 gcc/ipa-ref.h                 |  26 +--
 gcc/ipa-reference.c           |  66 +++---
 gcc/ipa-split.c               |  28 +--
 gcc/ipa-utils.c               |  92 ++++----
 gcc/ipa.c                     | 444 +++++++++++++++++------------------
 gcc/is-a.h                    |   8 +-
 gcc/java/decl.c               |   2 +-
 gcc/lto-cgraph.c              | 320 ++++++++++++-------------
 gcc/lto-section-in.c          |  12 +-
 gcc/lto-streamer-in.c         |   6 +-
 gcc/lto-streamer-out.c        |  46 ++--
 gcc/lto-streamer.h            |  18 +-
 gcc/lto/lto-partition.c       | 242 +++++++++----------
 gcc/lto/lto-symtab.c          | 245 ++++++++++----------
 gcc/lto/lto.c                 |  34 +--
 gcc/passes.c                  |  34 +--
 gcc/symtab.c                  | 518 ++++++++++++++++++++---------------------
 gcc/toplev.c                  |   6 +-
 gcc/trans-mem.c               |  94 ++++----
 gcc/tree-eh.c                 |   4 +-
 gcc/tree-emutls.c             |  40 ++--
 gcc/tree-inline.c             |  42 ++--
 gcc/tree-nested.c             |  10 +-
 gcc/tree-pretty-print.c       |   2 +-
 gcc/tree-profile.c            |  20 +-
 gcc/tree-sra.c                |  20 +-
 gcc/tree-ssa-structalias.c    |  40 ++--
 gcc/tree-vectorizer.c         |   2 +-
 gcc/tree.c                    |  10 +-
 gcc/value-prof.c              |  22 +-
 gcc/varasm.c                  |  32 +--
 gcc/varpool.c                 | 142 ++++++------
 65 files changed, 2411 insertions(+), 2195 deletions(-)

-- 
1.7.11.7


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