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]

[gimple-classes, committed 00/92] Initial slew of commits


These patches move the type-checking of gimple statement accessors
from run-time to compile-time, for about half of the accessors.

I've pushed them to the git branch "dmalcolm/gimple-classes", which
can be seen at:
https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/dmalcolm/gimple-classes

Patches 01-87:
  These correspond to patches 02-89 from the patch kit I posted in
  April, and approved by Jeff (with various caveats), rebased against trunk,
  and eliminating the as_a_gimple_foo and dyn_cast_gimple_foo *methods* in
  favor of direct use of as_a <>/dyn_cast <> from is-a.h
  I used a script [1] to add references to the initial patch kit and Jeff's
  reviews to the commit messages.

  They introduce various new gimple subclasses, along with typedefs for the
  const/non-const variants.  Richi didn't want these typedefs, so I
  immediately undo this part, renaming them in followups... (doing it this
  way was the least error-prone way):

Patch 88: "Preparatory work before subclass renaming":
  Various variables have names that confuse my subclass renaming
  script.  Rename them now to simplify the mass-renaming.

Patches 89 and 90 only make sense together; the former is handwritten, the
latter autogenerated:
  Patch 89: "Eliminate subclass typedefs from coretypes.h"
    This patch eliminates the const/non-const typedefs for the gimple
    subclasses.
  Patch 90: "Automated renaming of gimple subclasses"
    This patch renames the gimple subclasses based on the pattern from
    https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00346.html
    e.g.
      "gimple_switch" becomes "gswitch *".
      "const_gimple_bind" becomes "const gbind *".
  i.e. pointers to all gimple *subclasses* now must be explicitly referred
  to with "*".   "gimple" is still implicitly a pointer, to minimize noise
  when diffing against trunk.
  The renaming script was:
    https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/rename_gimple_subclasses.py

Patch 91: "Remove out-of-date references to typedefs":
  Fix some now-bogus comments.

Patch 92: "Update gimple.texi class hierarchy diagram"

I've successfully bootstrapped and regrtested patches 01-90 on
x86_64-unknown-linux-gnu (Fedora 20) - same results relative to
an unpatched control bootstrap of the branchpoint (r216157).

For reference, here's what the class hierarchy diagram from
gimple.texi looks like after these patches, with the new subclass
names (e.g. "gassign" and "gphi"):

   gimple_statement_base
     |    layout: GSS_BASE
     |    used for 4 codes: GIMPLE_ERROR_MARK
     |                      GIMPLE_NOP
     |                      GIMPLE_OMP_SECTIONS_SWITCH
     |                      GIMPLE_PREDICT
     |
     + gimple_statement_with_ops_base
     |   |    (no GSS layout)
     |   |
     |   + gimple_statement_with_ops
     |   |   |    layout: GSS_WITH_OPS
     |   |   |
     |   |   + gcond
     |   |   |     code: GIMPLE_COND
     |   |   |
     |   |   + gdebug
     |   |   |     code: GIMPLE_DEBUG
     |   |   |
     |   |   + ggoto
     |   |   |     code: GIMPLE_GOTO
     |   |   |
     |   |   + glabel
     |   |   |     code: GIMPLE_LABEL
     |   |   |
     |   |   + gswitch
     |   |         code: GIMPLE_SWITCH
     |   |
     |   + gimple_statement_with_memory_ops_base
     |       |    layout: GSS_WITH_MEM_OPS_BASE
     |       |
     |       + gimple_statement_with_memory_ops
     |       |   |    layout: GSS_WITH_MEM_OPS
     |       |   |
     |       |   + gassign
     |       |   |    code GIMPLE_ASSIGN
     |       |   |
     |       |   + greturn
     |       |        code GIMPLE_RETURN
     |       |
     |       + gcall
     |       |        layout: GSS_CALL, code: GIMPLE_CALL
     |       |
     |       + gasm
     |       |        layout: GSS_ASM, code: GIMPLE_ASM
     |       |
     |       + gtransaction
     |                layout: GSS_TRANSACTION, code: GIMPLE_TRANSACTION
     |
     + gimple_statement_omp
     |   |    layout: GSS_OMP.  Used for code GIMPLE_OMP_SECTION
     |   |
     |   + gomp_critical
     |   |        layout: GSS_OMP_CRITICAL, code: GIMPLE_OMP_CRITICAL
     |   |
     |   + gomp_for
     |   |        layout: GSS_OMP_FOR, code: GIMPLE_OMP_FOR
     |   |
     |   + gomp_parallel_layout
     |   |   |    layout: GSS_OMP_PARALLEL_LAYOUT
     |   |   |
     |   |   + gimple_statement_omp_taskreg
     |   |   |   |
     |   |   |   + gomp_parallel
     |   |   |   |        code: GIMPLE_OMP_PARALLEL
     |   |   |   |
     |   |   |   + gomp_task
     |   |   |            code: GIMPLE_OMP_TASK
     |   |   |
     |   |   + gimple_statement_omp_target
     |   |            code: GIMPLE_OMP_TARGET
     |   |
     |   + gomp_sections
     |   |        layout: GSS_OMP_SECTIONS, code: GIMPLE_OMP_SECTIONS
     |   |
     |   + gimple_statement_omp_single_layout
     |       |    layout: GSS_OMP_SINGLE_LAYOUT
     |       |
     |       + gomp_single
     |       |        code: GIMPLE_OMP_SINGLE
     |       |
     |       + gomp_teams
     |                code: GIMPLE_OMP_TEAMS
     |
     + gbind
     |        layout: GSS_BIND, code: GIMPLE_BIND
     |
     + gcatch
     |        layout: GSS_CATCH, code: GIMPLE_CATCH
     |
     + geh_filter
     |        layout: GSS_EH_FILTER, code: GIMPLE_EH_FILTER
     |
     + geh_else
     |        layout: GSS_EH_ELSE, code: GIMPLE_EH_ELSE
     |
     + geh_mnt
     |        layout: GSS_EH_MNT, code: GIMPLE_EH_MUST_NOT_THROW
     |
     + gphi
     |        layout: GSS_PHI, code: GIMPLE_PHI
     |
     + gimple_statement_eh_ctrl
     |   |    layout: GSS_EH_CTRL
     |   |
     |   + gresx
     |   |        code: GIMPLE_RESX
     |   |
     |   + geh_dispatch
     |            code: GIMPLE_EH_DISPATCH
     |
     + gtry
     |        layout: GSS_TRY, code: GIMPLE_TRY
     |
     + gimple_statement_wce
     |        layout: GSS_WCE, code: GIMPLE_WITH_CLEANUP_EXPR
     |
     + gomp_continue
     |        layout: GSS_OMP_CONTINUE, code: GIMPLE_OMP_CONTINUE
     |
     + gomp_atomic_load
     |        layout: GSS_OMP_ATOMIC_LOAD, code: GIMPLE_OMP_ATOMIC_LOAD
     |
     + gimple_statement_omp_atomic_store_layout
         |    layout: GSS_OMP_ATOMIC_STORE_LAYOUT,
         |    code: GIMPLE_OMP_ATOMIC_STORE
         |
         + gomp_atomic_store
         |        code: GIMPLE_OMP_ATOMIC_STORE
         |
         + gomp_return
                  code: GIMPLE_OMP_RETURN

Dave

[1] https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/refactor_gimple_patches.py
and https://github.com/davidmalcolm/gcc-refactoring-scripts/blob/master/gimple_approvals.py

David Malcolm (92):
  Introduce gimple_switch and use it in various places
  Introduce gimple_bind and use it for accessors.
  Introduce gimple_cond and use it in various places
  Introduce gimple_assign and use it in various places
  Introduce gimple_label and use it in a few places
  Introduce gimple_debug and use it in a few places
  Introduce gimple_phi and use it in various places
  Introduce gimple_phi_iterator
  Update ssa_prop_visit_phi_fn callbacks to take a gimple_phi
  tree-parloops.c: use gimple_phi in various places
  tree-predcom.c: use gimple_phi in various places
  tree-ssa-phiprop.c: use gimple_phi
  tree-ssa-loop-niter.c: use gimple_phi in a few places
  tree-ssa-loop-manip.c: use gimple_phi in three places
  tree-ssa-loop-ivopts.c: use gimple_phi in a few places
  Update various expressions within tree-scalar-evolution.c to be
    gimple_phi
  Concretize get_loop_exit_condition et al to working on gimple_cond
  Introduce gimple_call
  Introduce gimple_return
  Introduce gimple_goto
  Introduce gimple_asm
  Introduce gimple_transaction
  Introduce gimple_catch
  Introduce gimple_eh_filter
  Introduce gimple_eh_must_not_throw
  Introduce gimple_eh_else
  Introduce gimple_resx
  Introduce gimple_eh_dispatch
  Use subclasses of gimple in various places
  Introduce gimple_try
  Use more concrete types for various gimple statements
  Introduce gimple_omp_atomic_load
  Introduce gimple_omp_atomic_store
  Introduce gimple_omp_continue
  Introduce gimple_omp_critical
  Introduce gimple_omp_for
  Introduce gimple_omp_parallel
  tree-cfg.c: Make verify_gimple_call require a gimple_call
  Introduce gimple_omp_task
  Introduce gimple_omp_single
  Introduce gimple_omp_target
  Introduce gimple_omp_teams
  Introduce gimple_omp_sections
  tree-parloops.c: Use gimple_phi in various places
  omp-low.c: Use more concrete types of gimple statement for various
    locals
  Make gimple_phi_arg_def_ptr and gimple_phi_arg_has_location require a
    gimple_phi
  Make add_phi_arg require a gimple_phi
  Make gimple_phi_arg_set_location require a gimple_phi
  Update GRAPHITE to use more concrete gimple statement classes
  Make gimple_phi_arg_edge require a gimple_phi
  More gimple_phi
  Make gimple_call_return_slot_opt_p require a gimple_call.
  Use gimple_call for callgraph edges
  Various gimple to gimple_call conversions in IPA
  Concretize parameter to gimple_call_copy_skip_args
  Make gimple_label_set_label require a gimple_label
  Make gimple_goto_set_dest require a gimple_goto
  Concretize gimple_catch_types
  Concretize gimple_call_use_set and gimple_call_clobber_set
  Concretize gimple_label_label
  Concretize gimple_eh_filter_set_types and gimple_eh_filter_set_failure
  Concretize gimple_try_set_catch_is_cleanup
  Concretize three gimple_try_set_ accessors
  Make gimple_phi_arg_location_from_edge require a gimple_phi
  Make gimple_phi_arg_location require a gimple_phi.
  Concretize three gimple_return_ accessors
  Make gimple_cond_set_{true|false}_label require gimple_cond.
  Concretize locals within expand_omp_for_init_counts
  Concretize gimple_cond_make_{false|true}
  Concretize gimple_switch_index and gimple_switch_index_ptr
  Concretize gimple_cond_{true|false}_label
  Concretize gimple_cond_set_code
  Concretize gimple_cond_set_{lhs|rhs}
  Concretize gimple_cond_{lhs|rhs}_ptr
  Concretize various expressions from gimple to gimple_cond
  Concretize gimple_call_set_nothrow
  Concretize gimple_call_nothrow_p
  Tweak to gimplify_modify_expr
  Concretize gimple_call_set_fn
  Concretize gimple_call_set_fntype
  Concretize gimple_call_set_tail and gimple_call_tail_p
  Concretize gimple_call_arg_flags
  Concretize gimple_assign_nontemporal_move_p
  Concretize gimple_call_copy_flags and ipa_modify_call_arguments
  Use gimple_call in some places within tree-ssa-dom.c
  Use gimple_phi in many more places.
  Convert various gimple to gimple_phi within ssa-iterators.h
  Preparatory work before subclass renaming
  Eliminate subclass typedefs from coretypes.h
  Automated renaming of gimple subclasses
  Remove out-of-date references to typedefs
  Update gimple.texi class hierarchy diagram

 gcc/ChangeLog.gimple-classes          | 4483 +++++++++++++++++++++++++++++++++
 gcc/asan.c                            |   20 +-
 gcc/builtins.c                        |    4 +-
 gcc/builtins.h                        |    4 +-
 gcc/c-family/ChangeLog.gimple-classes |   20 +
 gcc/c-family/c-gimplify.c             |    4 +-
 gcc/cfgexpand.c                       |   58 +-
 gcc/cfgloop.c                         |    6 +-
 gcc/cfgloopmanip.c                    |    4 +-
 gcc/cgraph.c                          |   21 +-
 gcc/cgraph.h                          |   16 +-
 gcc/cgraphbuild.c                     |   30 +-
 gcc/cgraphclones.c                    |    7 +-
 gcc/cgraphunit.c                      |    6 +-
 gcc/coretypes.h                       |   35 +
 gcc/doc/gimple.texi                   |   79 +-
 gcc/expr.h                            |    2 +-
 gcc/gdbhooks.py                       |   19 +-
 gcc/gimple-builder.c                  |   16 +-
 gcc/gimple-builder.h                  |   16 +-
 gcc/gimple-fold.c                     |   40 +-
 gcc/gimple-iterator.c                 |   12 +-
 gcc/gimple-iterator.h                 |   11 +-
 gcc/gimple-low.c                      |   39 +-
 gcc/gimple-pretty-print.c             |  181 +-
 gcc/gimple-ssa-isolate-paths.c        |   22 +-
 gcc/gimple-ssa-strength-reduction.c   |   38 +-
 gcc/gimple-streamer-in.c              |   34 +-
 gcc/gimple-streamer-out.c             |   46 +-
 gcc/gimple-walk.c                     |  169 +-
 gcc/gimple.c                          |  352 +--
 gcc/gimple.h                          | 1400 +++++-----
 gcc/gimplify-me.c                     |   29 +-
 gcc/gimplify.c                        |  143 +-
 gcc/gimplify.h                        |    6 +-
 gcc/graphite-scop-detection.c         |   22 +-
 gcc/graphite-sese-to-poly.c           |  141 +-
 gcc/gsstruct.def                      |   34 +-
 gcc/internal-fn.c                     |   48 +-
 gcc/internal-fn.def                   |    2 +-
 gcc/internal-fn.h                     |    2 +-
 gcc/ipa-inline-analysis.c             |   18 +-
 gcc/ipa-prop.c                        |   37 +-
 gcc/ipa-prop.h                        |    2 +-
 gcc/ipa-pure-const.c                  |   10 +-
 gcc/ipa-split.c                       |  111 +-
 gcc/java/ChangeLog.gimple-classes     |   20 +
 gcc/java/java-gimplify.c              |    2 +-
 gcc/lto-streamer-in.c                 |    4 +-
 gcc/lto-streamer-out.c                |   15 +-
 gcc/omp-low.c                         |  469 ++--
 gcc/predict.c                         |   56 +-
 gcc/sese.c                            |   13 +-
 gcc/ssa-iterators.h                   |   20 +-
 gcc/stmt.c                            |    4 +-
 gcc/trans-mem.c                       |  132 +-
 gcc/tree-call-cdce.c                  |   29 +-
 gcc/tree-cfg.c                        |  409 +--
 gcc/tree-cfg.h                        |    4 +-
 gcc/tree-cfgcleanup.c                 |   44 +-
 gcc/tree-complex.c                    |   39 +-
 gcc/tree-data-ref.c                   |    3 +-
 gcc/tree-dfa.c                        |   12 +-
 gcc/tree-eh.c                         |  279 +-
 gcc/tree-eh.h                         |    6 +-
 gcc/tree-emutls.c                     |   13 +-
 gcc/tree-if-conv.c                    |   15 +-
 gcc/tree-inline.c                     |  214 +-
 gcc/tree-inline.h                     |    4 +-
 gcc/tree-into-ssa.c                   |   59 +-
 gcc/tree-into-ssa.h                   |    2 +-
 gcc/tree-loop-distribution.c          |   55 +-
 gcc/tree-nested.c                     |   52 +-
 gcc/tree-nrv.c                        |   11 +-
 gcc/tree-object-size.c                |   20 +-
 gcc/tree-outof-ssa.c                  |   23 +-
 gcc/tree-parloops.c                   |  101 +-
 gcc/tree-phinodes.c                   |   52 +-
 gcc/tree-phinodes.h                   |    8 +-
 gcc/tree-predcom.c                    |   30 +-
 gcc/tree-profile.c                    |   19 +-
 gcc/tree-scalar-evolution.c           |   87 +-
 gcc/tree-scalar-evolution.h           |    2 +-
 gcc/tree-sra.c                        |  125 +-
 gcc/tree-ssa-alias.c                  |   16 +-
 gcc/tree-ssa-alias.h                  |    4 +-
 gcc/tree-ssa-ccp.c                    |   30 +-
 gcc/tree-ssa-coalesce.c               |   29 +-
 gcc/tree-ssa-copy.c                   |   12 +-
 gcc/tree-ssa-copyrename.c             |   12 +-
 gcc/tree-ssa-dce.c                    |   37 +-
 gcc/tree-ssa-dom.c                    |   76 +-
 gcc/tree-ssa-forwprop.c               |   23 +-
 gcc/tree-ssa-ifcombine.c              |   27 +-
 gcc/tree-ssa-live.c                   |   16 +-
 gcc/tree-ssa-loop-im.c                |   65 +-
 gcc/tree-ssa-loop-ivcanon.c           |   41 +-
 gcc/tree-ssa-loop-ivopts.c            |   44 +-
 gcc/tree-ssa-loop-manip.c             |   64 +-
 gcc/tree-ssa-loop-niter.c             |   25 +-
 gcc/tree-ssa-loop-prefetch.c          |    4 +-
 gcc/tree-ssa-loop-unswitch.c          |   19 +-
 gcc/tree-ssa-math-opts.c              |   38 +-
 gcc/tree-ssa-operands.c               |    8 +-
 gcc/tree-ssa-phiopt.c                 |   38 +-
 gcc/tree-ssa-phiprop.c                |   12 +-
 gcc/tree-ssa-pre.c                    |   62 +-
 gcc/tree-ssa-propagate.c              |   36 +-
 gcc/tree-ssa-propagate.h              |    2 +-
 gcc/tree-ssa-reassoc.c                |   39 +-
 gcc/tree-ssa-sccvn.c                  |   29 +-
 gcc/tree-ssa-sccvn.h                  |    2 +-
 gcc/tree-ssa-sink.c                   |    8 +-
 gcc/tree-ssa-strlen.c                 |   13 +-
 gcc/tree-ssa-structalias.c            |   86 +-
 gcc/tree-ssa-tail-merge.c             |   33 +-
 gcc/tree-ssa-ter.c                    |    4 +-
 gcc/tree-ssa-threadedge.c             |   19 +-
 gcc/tree-ssa-threadedge.h             |    2 +-
 gcc/tree-ssa-threadupdate.c           |   22 +-
 gcc/tree-ssa-uncprop.c                |    7 +-
 gcc/tree-ssa-uninit.c                 |   74 +-
 gcc/tree-ssa.c                        |   56 +-
 gcc/tree-stdarg.c                     |   19 +-
 gcc/tree-switch-conversion.c          |   57 +-
 gcc/tree-tailcall.c                   |   46 +-
 gcc/tree-vect-data-refs.c             |    7 +-
 gcc/tree-vect-generic.c               |   13 +-
 gcc/tree-vect-loop-manip.c            |   74 +-
 gcc/tree-vect-loop.c                  |   61 +-
 gcc/tree-vect-patterns.c              |    2 +-
 gcc/tree-vect-slp.c                   |   15 +-
 gcc/tree-vect-stmts.c                 |   22 +-
 gcc/tree-vectorizer.h                 |    2 +-
 gcc/tree-vrp.c                        |  100 +-
 gcc/tree.c                            |    5 +-
 gcc/ubsan.c                           |    4 +-
 gcc/value-prof.c                      |   91 +-
 gcc/value-prof.h                      |    3 +-
 gcc/vtable-verify.c                   |    2 +-
 140 files changed, 8532 insertions(+), 3376 deletions(-)
 create mode 100644 gcc/ChangeLog.gimple-classes
 create mode 100644 gcc/c-family/ChangeLog.gimple-classes
 create mode 100644 gcc/java/ChangeLog.gimple-classes

-- 
1.8.5.3


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