Find a file
Richard Sandiford 504279ae0a Simplify the implementation of HARD_REG_SET
We have two styles of HARD_REG_SET: a single integer based on
HOST_WIDEST_FAST_INT (used when FIRST_PSEUDO_REGISTER is small enough)
or an array of integers.  One of the nice properties of this arrangement
is that:

  void foo (const HARD_REG_SET);

is passed by value as an integer when the set is small enough and
by reference otherwise.

(This is in constrast to "const HARD_REG_SET &", which would always
be passed by reference, and in contrast to passing a structure wrapper
like "struct s { T elts[1]; }" by value, where the structure might be
passed like a T or by reference, depending on the ABI.)

However, one of the disadvantages of using an array is that simple
assignment doesn't work.  We need to use COPY_HARD_REG_SET instead.

This patch uses a structure wrapper around the array, and preserves
the above "nice property" using a new const_hard_reg_set typedef.
The patch also removes the manual unrolling for small array sizes;
I think these days we can rely on the compiler to do that for us.

This meant fixing two port-specific quirks:

- epiphany passed NULL as a HARD_REG_SET whose value doesn't matter.
  The patch passes the NO_REGS set instead.

- ia64 reused TEST_HARD_REG_BIT and SET_HARD_REG_BIT for arrays that
  are bigger than HARD_REG_SET.  The patch just open-codes them.

The patch is probably being too conservative.  Very few places actually
take advantage of the "nice property" above, and we could have a
cleaner interface if we used a structure wrapper for all cases.

2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* hard-reg-set.h (HARD_REG_SET): Define using a typedef rather
	than a #define.  Use a structure rather than an array as the
	fallback definition.  Remove special cases for low array sizes.
	(const_hard_reg_set): New typedef.
	(hard_reg_set_subset_p): Use it instead of "const HARD_REG_SET".
	(hard_reg_set_equal_p, hard_reg_set_intersect_p): Likewise.
	(hard_reg_set_empty_p): Likewise.
	(SET_HARD_REG_BIT): Use a function rather than a macro to
	handle the case in which HARD_REG_SET is a structure.
	(CLEAR_HARD_REG_BIT, TEST_HARD_REG_BIT, CLEAR_HARD_REG_SET)
	(SET_HARD_REG_SET, COPY_HARD_REG_SET, COMPL_HARD_REG_SET)
	(AND_HARD_REG_SET, AND_COMPL_HARD_REG_SET, IOR_HARD_REG_SET)
	(IOR_COMPL_HARD_REG_SET): Likewise.
	(hard_reg_set_iterator::pset): Constify the pointer target.
	(hard_reg_set_iter_init): Take a const_hard_reg_set instead
	of a "const HARD_REG_SET".  Update the handling of non-integer
	HARD_REG_SETs.
	* recog.h: Test HARD_CONST instead of CLEAR_HARD_REG_SET.
	* reload.h: Likewise.
	* rtl.h (choose_hard_reg_mode): Remove unnecessary line break.
	* regs.h (in_hard_reg_set_p): Take a const_hard_reg_set instead
	of a "const HARD_REG_SET".
	(overlaps_hard_reg_set_p, range_overlaps_hard_reg_set_p): Likewise.
	(range_in_hard_reg_set_p): Likewise.
	* ira-costs.c (restrict_cost_classes): Likewise.
	* shrink-wrap.c (move_insn_for_shrink_wrap): Likewise.
	* config/epiphany/resolve-sw-modes.c (pass_resolve_sw_modes::execute):
	Pass a NO_REGS HARD_REG_SET rather than NULL to emit_set_fp_mode.
	* config/ia64/ia64.c (rws_insn): In the CHECKING_P version,
	use unsigned HOST_WIDEST_FAST_INT rather than HARD_REG_ELT_TYPE.
	(rws_insn_set, rws_insn_test): In the CHECKING_P version,
	take an unsigned int and open-code the HARD_REG_SET operations.

From-SVN: r275526
2019-09-09 17:58:36 +00:00
config Fix GCC_LINUX_FUTEX to work with C99 compilers 2019-09-06 12:27:36 +02:00
contrib GCC port for eBPF 2019-09-09 12:13:23 +02:00
fixincludes [Darwin, fixincludes] Fix PR83531 2019-08-18 18:54:13 +00:00
gcc Simplify the implementation of HARD_REG_SET 2019-09-09 17:58:36 +00:00
gnattools PR81878: fix --disable-bootstrap --enable-languages=ada 2018-11-20 00:07:47 +00:00
gotools libgo: update to Go 1.13beta1 release 2019-09-06 18:12:46 +00:00
include Fix file descriptor existence of MinGW. 2019-08-08 07:50:28 +00:00
INSTALL
intl iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS. 2018-11-07 15:41:21 -07:00
libada Update copyright years. 2019-01-01 13:31:55 +01:00
libatomic re PR other/79543 (Inappropriate "ld --version" checking) 2019-09-03 14:10:26 +00:00
libbacktrace Remove Cell Broadband Engine SPU targets 2019-09-03 15:08:28 +00:00
libcc1 [C++ PATCH] Using decls 2019-05-21 14:33:24 +00:00
libcpp [preprocessor] Popping "" file names 2019-09-06 12:54:19 +00:00
libdecnumber Update copyright years. 2019-01-01 13:31:55 +01:00
libffi re PR other/79543 (Inappropriate "ld --version" checking) 2019-09-03 14:10:26 +00:00
libgcc GCC port for eBPF 2019-09-09 12:13:23 +02:00
libgfortran Improve PRNG jumping when using threads 2019-09-05 09:59:55 +03:00
libgo libgo: update to Go 1.13beta1 release 2019-09-06 18:12:46 +00:00
libgomp Fix GCC_LINUX_FUTEX to work with C99 compilers 2019-09-06 12:27:36 +02:00
libhsail-rt Update copyright years. 2019-01-01 13:31:55 +01:00
libiberty rust-demangle.c (unescape): Remove. 2019-09-03 14:04:32 -06:00
libitm Fix GCC_LINUX_FUTEX to work with C99 compilers 2019-09-06 12:27:36 +02:00
libobjc re PR target/89093 (C++ exception handling clobbers d8 VFP register) 2019-04-23 12:03:41 +02:00
liboffloadmic PR other/16615 [1/5] 2019-01-09 16:37:45 -05:00
libphobos libphobos.exp (libphobos_init): Add multi-lib libgcc dirs to the ld_library_path var. 2019-09-03 08:24:03 +00:00
libquadmath quadmath.h (M_Eq, [...]): Use two more decimal places. 2019-08-02 09:59:19 +02:00
libsanitizer libsanitizer, record a local patch. 2019-08-16 19:49:07 +00:00
libssp Update copyright years. 2019-01-01 13:31:55 +01:00
libstdc++-v3 Forgot Changelog from latest commit. 2019-09-09 17:18:52 +00:00
libvtv Fix testsuite 2019-02-20 08:07:19 -08:00
lto-plugin lto-plugin, removed unused variable 2019-05-15 14:10:27 +00:00
maintainer-scripts update_web_docs_svn: Proceed even if the invocation of sphinx fails. 2019-08-04 22:31:54 +00:00
zlib Makefile.am (noinst_LTLIBRARIES): Rename libzgcj_convience.la to libz_convenience.la. 2019-01-21 17:23:58 +00:00
.dir-locals.el
.gitattributes
.gitignore Add .clangd and compile_commands.json to .gitignore. 2019-08-28 19:33:28 +00:00
ABOUT-NLS
ar-lib Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ChangeLog GCC port for eBPF 2019-09-09 12:13:23 +02:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess Update config.sub and config.guess. 2019-09-09 11:14:32 +02:00
config.rpath
config.sub Update config.sub and config.guess. 2019-09-09 11:14:32 +02:00
configure GCC port for eBPF 2019-09-09 12:13:23 +02:00
configure.ac GCC port for eBPF 2019-09-09 12:13:23 +02:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS GCC port for eBPF 2019-09-09 12:13:23 +02:00
Makefile.def Sync top-level change from gdb 2019-06-15 21:32:03 +00:00
Makefile.in Makefile.tpl (HOST_EXPORTS): Add CXX_FOR_BUILD. 2019-08-23 15:37:22 -06:00
Makefile.tpl Makefile.tpl (HOST_EXPORTS): Add CXX_FOR_BUILD. 2019-08-23 15:37:22 -06:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
README
symlink-tree
test-driver Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.