I posted a version of these patches back in stage 4 (February), but we agreed that holding off until stage 1 was a better idea. Since then I've made more progress and reorganized the patches accordingly. This group of patches lays groundwork, but does not actually change GCC's behavior yet, other than to generate the new initialization information and ignore it.
The current built-in support in the rs6000 back end requires at least a master's degree in spelunking to comprehend. It's full of cruft, redundancy, and unused bits of code, and long overdue for a replacement. This is the first part of my project to do that. My intent is to make adding new built-in functions as simple as adding a few lines to a couple of files, and automatically generating as much of the initialization, overload resolution, and expansion logic as possible. This patch series establishes the format of the input files and creates a new program (rs6000-gen-builtins) to: * Parse the input files into an internal representation; * Generate a file of #defines (rs6000-vecdefines.h) for eventual inclusion into altivec.h; and * Generate an initialization file to create and initialize tables of built-in functions and overloads. Patches 1, 3-7, and 9-19 contain the logic for rs6000-gen-builtins. Patch 8 provides balanced tree search support for parsing scalability. Patches 2 and 21-27 provide a first cut at the input files. Patch 20 incorporates the new code into the GCC build. Patch 28 adds comments to some existing files that will help during the transition from the previous builtin mechanism. The patch series is constructed so that any prefix set of the patches can be upstreamed without breaking anything, so we can take the reviews slowly. There's still plenty of work left, but I think it will be helpful to get this big chunk of patches upstream to make further progress easier. Thanks in advance for your reviews! Bill Schmidt (28): rs6000: Initial create of rs6000-gen-builtins.c rs6000: Add initial input files rs6000: Add file support and functions for diagnostic support rs6000: Add helper functions for parsing rs6000: Add functions for matching types, part 1 of 3 rs6000: Add functions for matching types, part 2 of 3 rs6000: Add functions for matching types, part 3 of 3 rs6000: Red-black tree implementation for balanced tree search rs6000: Main function with stubs for parsing and output rs6000: Parsing built-in input file, part 1 of 3 rs6000: Parsing built-in input file, part 2 of 3 rs6000: Parsing built-in input file, part 3 of 3 rs6000: Parsing of overload input file rs6000: Build and store function type identifiers rs6000: Write output to the vector definition include file rs6000: Write output to the builtins header file rs6000: Write output to the builtins init file, part 1 of 3 rs6000: Write output to the builtins init file, part 2 of 3 rs6000: Write output to the builtins init file, part 3 of 3 rs6000: Incorporate new builtins code into the build machinery rs6000: Add remaining MASK_ALTIVEC builtins rs6000: Add MASK_VSX builtins rs6000: Add available-everywhere and ancient builtins rs6000: Add Power7 builtins rs6000: Add MASK_P8_VECTOR builtins rs6000: Add MASK_P9_VECTOR and MASK_P9_MISC builtins rs6000: Add remaining builtins rs6000: Add comments to help with transition gcc/config.gcc | 3 +- gcc/config/rs6000/rbtree.c | 233 ++ gcc/config/rs6000/rbtree.h | 51 + gcc/config/rs6000/rs6000-builtin-new.def | 2965 ++++++++++++++++++++++ gcc/config/rs6000/rs6000-builtin.def | 15 + gcc/config/rs6000/rs6000-call.c | 166 ++ gcc/config/rs6000/rs6000-gen-builtins.c | 2586 +++++++++++++++++++ gcc/config/rs6000/rs6000-overload.def | 57 + gcc/config/rs6000/t-rs6000 | 25 +- 9 files changed, 6099 insertions(+), 2 deletions(-) create mode 100644 gcc/config/rs6000/rbtree.c create mode 100644 gcc/config/rs6000/rbtree.h create mode 100644 gcc/config/rs6000/rs6000-builtin-new.def create mode 100644 gcc/config/rs6000/rs6000-gen-builtins.c create mode 100644 gcc/config/rs6000/rs6000-overload.def -- 2.17.1