diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-08-07 18:37:21 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-08-07 18:37:21 +0000 |
commit | 915d28fe74dbb30352702ab07ea5bf30747043bb (patch) | |
tree | 7cca074f1dbc49e60b143875574a67c89ccbad67 /gcc/config/aarch64/check-sve-md.awk | |
parent | e3b4d9d7021e78a85b4627b67c89acb1515ae426 (diff) | |
download | gcc-915d28fe74dbb30352702ab07ea5bf30747043bb.zip gcc-915d28fe74dbb30352702ab07ea5bf30747043bb.tar.gz gcc-915d28fe74dbb30352702ab07ea5bf30747043bb.tar.bz2 |
[AArch64] Reorganise aarch64-sve.md
aarch64-sve.md was getting a bit jumbled, with related operations
separated by unrelated operations. Also, many SVE instructions need
to have several patterns due to the various ways in which predication
can be used, and it was getting hard to tell which instructions had a
complete set of patterns.
This patch therefore tries to use an explicit grouping scheme.
Banner comments are usually frowned on, but md files have been
a traditional exception (e.g. when using Mike's template for
new targets).
The patch also lists the instructions implemented by each section,
so that it's possible to search the file by instruction mnemonic.
I wouldn't be surprised if I end up having to rip out the contents
section, but I found it useful for the month or so that that I've
been using it locally. The patch checks that the contents remain
up-to-date by running a checking script during an early stage of
the build.
No functional change intended.
2019-08-07 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64-sve.md: Reorganize contents and add
banner comments.
* config/aarch64/check-sve-md.awk: New file.
* config/aarch64/t-aarch64 (s-check-sve-md): New rule.
(insn-conditions.md): Depend on it.
From-SVN: r274184
Diffstat (limited to 'gcc/config/aarch64/check-sve-md.awk')
-rw-r--r-- | gcc/config/aarch64/check-sve-md.awk | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gcc/config/aarch64/check-sve-md.awk b/gcc/config/aarch64/check-sve-md.awk new file mode 100644 index 0000000..3da78f3 --- /dev/null +++ b/gcc/config/aarch64/check-sve-md.awk @@ -0,0 +1,66 @@ +#!/usr/bin/awk -f +# Copyright (C) 2019 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This awk script checks that aarch64-sve.md (passed either on the +# command line or via stdin) has an up-to-date contents section. + +BEGIN { + seen1 = 0 + seen2 = 0 + errors = 0 +} + +# The headings in the comments use a two-level hierarchy: ";; == ..." +# for major sections and ";; ---- ..." for minor sections. Each section +# heading must be unique. +# +# The contents section should list all the section headings, using the +# same text and in the same order. We should therefore see exactly two +# copies of the section list. +/^;; == / || /^;; ---- / { + if ($0 in seen || seen2 > 0) + { + if (seen2 >= seen1) + { + printf "error: line not in contents: %s\n", $0 > "/dev/stderr" + errors += 1 + exit(1) + } + if ($0 != order[seen2]) + { + printf "error: mismatched contents\n saw: %s\nexpected: %s\n", \ + $0, order[seen2] > "/dev/stderr" + errors += 1 + exit(1) + } + seen2 += 1 + } + else + { + seen[$0] = 1 + order[seen1] = $0 + seen1 += 1 + } +} + +END { + if (seen2 < seen1 && errors == 0) + { + printf "error: line only in contents: %s\n", order[seen2] > "/dev/stderr" + exit(1) + } +} |