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-genbif) 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. Note that none of the code in this patch set affects GCC's operation at all, with the exception of patch #14. Patch 14 causes the program rs6000-genbif to be built and executed, producing the output files, and linking rs6000-bif.o into the executable. However, none of the code in rs6000-bif.o is called, so the only effect is to make the gcc executable larger. I'd like to consider at least patches 1-13 as stage 4 material for the current release. I'd prefer to also include patch 14 for convenience, but I understand if that's not deemed acceptable. I've attempted to break this up into logical pieces for easy consumption, but some of the patches may still be a bit large. Please let me know if you'd like me to break any of them up. Thanks in advance for the review! Bill Schmidt (14): Initial create of rs6000-genbif.c. Add stubs for input files. These will grow much larger. Add file support and functions for diagnostic support. Support functions to parse whitespace, lines, identifiers, integers. Add support functions for matching types. Red-black tree implementation for balanced tree search. Add main function with stub functions for parsing and output. Add support for parsing rs6000-bif.def. Add parsing support for rs6000-overload.def. Build function type identifiers and store them. Write #defines to rs6000-vecdefines.h. Write code to rs6000-bif.h. Write code to rs6000-bif.c. Incorporate new code into the build machinery. gcc/config.gcc | 3 +- gcc/config/rs6000/rbtree.c | 233 +++ gcc/config/rs6000/rbtree.h | 51 + gcc/config/rs6000/rs6000-bif.def | 187 ++ gcc/config/rs6000/rs6000-call.c | 35 + gcc/config/rs6000/rs6000-genbif.c | 2295 +++++++++++++++++++++++++ gcc/config/rs6000/rs6000-overload.def | 5 + gcc/config/rs6000/t-rs6000 | 22 + 8 files changed, 2830 insertions(+), 1 deletion(-) create mode 100644 gcc/config/rs6000/rbtree.c create mode 100644 gcc/config/rs6000/rbtree.h create mode 100644 gcc/config/rs6000/rs6000-bif.def create mode 100644 gcc/config/rs6000/rs6000-genbif.c create mode 100644 gcc/config/rs6000/rs6000-overload.def -- 2.17.1