]> git.ipfire.org Git - thirdparty/gcc.git/commit
rs6000: genfusion: Rewrite load/compare code
authorSegher Boessenkool <segher@kernel.crashing.org>
Fri, 2 Jun 2023 15:32:41 +0000 (15:32 +0000)
committerSegher Boessenkool <segher@kernel.crashing.org>
Tue, 6 Jun 2023 13:43:25 +0000 (13:43 +0000)
commit19e5bf1d5fac00da0b8cd4144d5651b2979d8308
treee9d449be7fcc99f00acbf49d24309a386f1c4429
parentce2188e4320cbb46d6246bd3f478ba20440c62f3
rs6000: genfusion: Rewrite load/compare code

This makes the code more readable, more digestible, more maintainable,
more extensible.  That kind of thing.  It does that by pulling things
apart a bit, but also making what stays together more cohesive lumps.

The original function was a bunch of loops and early-outs, and then
quite a bit of stuff done per iteration, with the iterations essentially
independent of each other.  This patch moves the stuff done for one
iteration to a new _one function.

The second big thing is the stuff printed to the .md file is done in
"here documents" now, which is a lot more readable than having to quote
and escape and double-escape pieces of text.  Whitespace inside the
here-document is significant (will be printed as-is), which is a bit
awkward sometimes, or might take some getting used to, but it is also
one of the benefits of using them.

Local variables are declared at first use (or close to first use).
There also shouldn't be many at all, often you can write easier to
read and manage code by omitting to name something that is hard to name
in the first place.

Finally some things are done in more typical, more modern, and tighter
Perl style, for example REs in "if"s or "qw" for lists of constants.

2023-06-06  Segher Boessenkool  <segher@kernel.crashing.org>

* config/rs6000/genfusion.pl (gen_ld_cmpi_p10_one): New, rewritten and
split out from...
(gen_ld_cmpi_p10): ... this.
gcc/config/rs6000/genfusion.pl