[PATCH 0/2] Convert IPA pass hooks to virtual functions

David Malcolm dmalcolm@redhat.com
Thu Oct 10 00:41:00 GMT 2013


r201505 and r201508 converted passes to C++ classes, with the gate
and execute hooks becoming virtual functions, allowing for the
possibility of storing state within pass instances, rather than
statically allocating it.  This has benefits for state-isolation,
for example within my JIT branch, which invokes the compiler
multiple times in one process.

The following patches convert the additional function pointer hooks
in ipa_opt_pass_d to be virtual functions, for similar reasons.
The changes are analogous to those earlier patches for gate and
execute.

It is in two parts:

* patch 1 of 2 is handwritten: it updates the core ipa declarations
  to use virtual functions rather than function pointers, with a
  "const struct ipa_pass_data" holding metadata such as flags to
  determine if a hook is present (since we can't portably check
  a virtual function against NULL).

* patch 2 of 2 converts all of the passes themselves to this new API.
  It is automatically generated using a refactoring script:
    refactor_ipa_passes.py within
  https://github.com/davidmalcolm/gcc-refactoring-scripts
  There is a test suite for the refactoring script within the same
  repository: test_refactor_ipa_passes.py
  
Successfully bootstrapped and regtesting on x86_64-unknown-linux.

OK for trunk?

David Malcolm (2):
  Handwritten part of conversion of IPA pass hooks to virtual functions
  Automated conversion of IPA passes to new API

 gcc/ipa-cp.c           | 56 ++++++++++++++++++++++++++++++++--------
 gcc/ipa-devirt.c       | 24 ++++++++++-------
 gcc/ipa-inline.c       | 44 ++++++++++++++++++++++++-------
 gcc/ipa-profile.c      | 39 +++++++++++++++++++++-------
 gcc/ipa-pure-const.c   | 39 +++++++++++++++++++++-------
 gcc/ipa-reference.c    | 38 ++++++++++++++++++---------
 gcc/ipa.c              | 48 +++++++++++++++++++++-------------
 gcc/lto-streamer-out.c | 68 +++++++++++++++++++++++++++++++++++-------------
 gcc/passes.c           | 70 ++++++++++++++++++++++++++++++++++++++++++++------
 gcc/tree-pass.h        | 54 +++++++++++++++++++-------------------
 10 files changed, 350 insertions(+), 130 deletions(-)

-- 
1.7.11.7



More information about the Gcc-patches mailing list