Skip to content

davidmalcolm/gcc-refactoring-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCC Refactoring Scripts

This is a repository of scripts for automating large-scale changes to GCC's source code.

They are licensed under the GPL, version 3 or later.

Files tend to come in pairs: a foo.py and a test_foo.py.

Changes that I'm working on

refactor_cfun.py (and test_refactor_cfun.py)

Script to replace implicit uses of "cfun" via the preprocessor with explicit uses.

Status: a variant of this idea was approved by Richi in http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00780.html

I need to implement this.

refactor_options.py (and test_refactor_options.py)

Work-in-progress on replacing the implicit use of the preprocessor for accessing options with explicit macro use.

GCC's code has references to options like:

static bool
gate_vrp (void)
{
  return flag_tree_vrp != 0;
}

where "flag_tree_vrp" is actually an autogenerated macro to "global_options.x_flag_tree_vrp"

This is deeply confusing to a newbie (and indeed still to me after two years of working with GCC's internals) e.g. when stepping through code and trying to query the value in gdb. The idea is to replace the above with:

static bool
gate_vrp (void)
{
  return GCC_OPTION (flag_tree_vrp) != 0;
}

(I'd also like to asssociate options with a gcc::context, rather than have a single instance of options, perhaps explicitly adding a context arg to the macro???)

Status: posted as http://gcc.gnu.org/ml/gcc-patches/2014-05/msg00652.html

rename_gimple.py (and test_rename_gimple.py)

Work-in-progress experiment on removing the "gimple"/"const_gimple" typedefs in favor of something else (perhaps just "gimple *"); see :

http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01562.html

Status: works well enough to port the existing code (renaming to "gimple *").

Posted as: http://gcc.gnu.org/ml/gcc-patches/2014-05/msg00129.html

Review in progress; commits to trunk waiting until after 4.9.1 is released.

Changes blocking on something else

refactor_ipa_passes.py (and test_refactor_ipa_passes.py)

Conversion of remaining hooks in ipa_opt_pass_d from function ptrs to vfuncs.

Status: posted as http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00639.html I need to respond to Richi's concern: http://gcc.gnu.org/ml/gcc-patches/2013-10/msg00651.html

Helper scripts

refactor.py (and test_refactor.py)

This module is used by the other scripts, and provides commonly used facilities e.g. a way to manage ChangeLog entries.

commit-changes-to-git.py

This script locates changes to ChangeLog files and uses them to build a commit message, so the latter will appears as part of the email rather than the patch, when turned into an email by git format-patch.

Work that is already in GCC

refactor_passes.py (and test_refactor_passes.py)

This was used in the patch series that converted passes to C++ classes, specifically, to generate r201508.

refactor_symtab.py (and test_refactor_symtab.py)

This converted the symtabs types into a class hierarchy. It was used to generate r204171.

rename_symtab.py (and test_rename_symtab.py)

This is a followup to refactor_symtab.py which renames the types (from symtab_node_base to symtab_node, with various related fixups). It was used to generate r204279.

refactor_gimple.py (and test_refactor_gimple.py)

This was used to help convert gimple's statement types to use C++ inheritance, specically, to generate part of r205034.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages