Add a new hidden option -print-changes that reports in a patch-like notation
when a pass actually changes the IR.
A new hidden option -print-changes is introduced that reports when
a pass changes the IR and only prints a banner when no change is made
by a pass or when the pass or function is filtered out. The changes
are shown in a form similar to a dump of a function except that the
text which is removed is shown prefixed with a '-' and the text which
is added is shown with a '+' in front. Filtering of the output can
be controlled with the -filter-print-funcs and -filter-passes options.
The template base classes for these change reporters is moved into
separate files and the base classes are expanded to allow more complex
methods of reporting changes. The base classes handle all of the
determination of when a function or pass is "interesting" and should be
reported or filtered out. The base classes have pure virtual functions
which are called when a change by a pass has been recognized so the
derived class need only provide the overrides to present the information
about the changing IR. The new option -print-changes is the first of these
instantiations using these base classes. A second instantiation
is still to come in a subsequent commit.
This patch is made in relation to https://reviews.llvm.org/D86360 and
takes that as its base. I will endeavor to update this PR as that one
evolves based on its reviews.