mbox series

[0/3] genmatch: Speed up recompilation after changes to match.pd

Message ID 20230731110346.174848-1-andrzej.turko@gmail.com
Headers show
Series genmatch: Speed up recompilation after changes to match.pd | expand

Message

Andrzej Turko July 31, 2023, 11:03 a.m. UTC
The following reduces the number of object files that need to be rebuilt
after match.pd has been modified. Right now a change to match.pd which
adds/removes a line almost always forces recompilation of all files that
genmatch generates from it. This is because of unnecessary changes to
the generated .cc files:

1. Function names and ordering change as does the way the functions are
        distributed across multiple source files.
2. Code locations from match.pd are quoted directly (including line
        numbers) by logging fprintf calls.

This patch addresses the those issues without changing the behaviour
of the generated code. The first one is solved by making sure that minor
changes to match.pd do not influence the order in which functions are
generated. The second one by using a lookup table with line numbers.

Now a change to a single function will trigger a rebuild of 4 object
files (one with the function  and the one with the lookup table both for
gimple and generic) instead all of them (20 by default).
For reference, this decreased the rebuild time with 48 threads from 3.5
minutes to 1.5 minutes on my machine.


Note for reviewers: I do not have write access.

Andrzej Turko (3):
  Support get_or_insert in ordered_hash_map
  genmatch: Reduce variability of generated code
  genmatch: Log line numbers indirectly

 gcc/Makefile.in               |  4 +-
 gcc/genmatch.cc               | 76 ++++++++++++++++++++++++++++++-----
 gcc/ordered-hash-map-tests.cc | 19 +++++++--
 gcc/ordered-hash-map.h        | 26 ++++++++++++
 4 files changed, 110 insertions(+), 15 deletions(-)