Go to file
Richard Sandiford c9e926ce2b Add genmatch support for internal functions
This patch makes genmatch match calls based on combined_fn rather
than built_in_function and extends the matching to internal functions.
It also uses fold_const_call to fold the calls to a constant, rather
than going through fold_builtin_n.

In order to slightly simplify the code and remove potential
ambiguity, the patch enforces lower case for tree codes
(foo->FOO_EXPR), caps for functions (no built_in_hypot->BUILT_IN_HYPOT)
and requires an exact match for user-defined identifiers.  The first two
were already met in practice but there were a couple of cases where
operator lists were defined in one case and used in another.

Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.

gcc/
	* match.pd: Use HYPOT and COS rather than hypot and cos.
	Use CASE_CFN_* macros.  Guard log/exp folds with
	SCALAR_FLOAT_TYPE_P.
	* genmatch.c (internal_fn): New enum.
	(fn_id::fn): Change to an unsigned int.
	(fn_id::fn_id): Accept internal_fn too.
	(add_builtin): Rename to...
	(add_function): ...this and turn into a template.
	(get_operator): Only try one variation if the original name fails.
	Only add _EXPR if the original name was all lower case.
	Try converting internal and built-in function names to their
	CFN equivalents.
	(expr::gen_transform): Use maybe_build_call_expr_loc for generic.
	(dt_simplify::gen_1): Likewise.
	(dt_node::gen_kids_1): Use gimple_call_combined_fn for gimple
	and get_call_combined_fn for generic.
	(dt_simplify::gen): Use combined_fn as the type of fn_ids.
	(decision_tree::gen): Likewise.
	(main): Use lower case in the strings for {VIEW_,}CONVERT[012].
	Use add_function rather than add_builtin.  Register internal
	functions too.
	* generic-match-head.c: Include case-cfn-macros.h.
	* gimple-fold.c (replace_stmt_with_simplification): Use
	gimple_call_combined_fn to test whether we can keep an
	existing call.
	* gimple-match.h (code_helper): Replace built_in_function
	with combined_fn.
	* gimple-match-head.c: Include fold-const-call.h, internal-fn.h
	and case-fn-macros.h.
	(gimple_resimplify1): Use fold_const_call.
	(gimple_resimplify2, gimple_resimplify3): Likewise.
	(build_call_internal, build_call): New functions.
	(maybe_push_res_to_seq): Use them.
	(gimple_simplify): Use fold_const_call.  Set *rcode to a combined_fn
	rather than a built-in function.
	* tree.h (build_call_expr_internal_loc): Declare.
	(maybe_build_call_expr_loc): Likewise.
	* tree.c (build_call_expr_internal_loc_array): New function.
	(maybe_build_call_expr_loc): Likewise.

From-SVN: r230484
2015-11-17 18:47:44 +00:00
boehm-gc Testsuite: add dg-{begin|end}-multiline-output commands 2015-10-09 13:55:23 +00:00
config libsanitizer merge from upstream r250806, compiler part. 2015-10-21 10:40:54 +03:00
contrib count-headers: Initial file. 2015-11-11 14:28:46 +00:00
fixincludes inclhack.def (aix_stdio_inline): New fix. 2015-08-14 07:17:29 -04:00
gcc Add genmatch support for internal functions 2015-11-17 18:47:44 +00:00
gnattools configure.ac (*-*-dragonfly*): New configuration. 2015-06-08 07:27:56 +00:00
gotools Makefile.am (go_cmd_go_files): Update to Go 1.5.1 library by adding alldocs.go, doc.go, note.go. 2015-10-31 21:29:38 +00:00
include c-pragma.c (oacc_pragmas): Add entry for declare directive. 2015-11-12 22:20:41 +00:00
INSTALL
intl Makefile.def (libiconv): Define bootstrap=true. 2015-08-07 01:13:52 -04:00
libada
libatomic Testsuite: add dg-{begin|end}-multiline-output commands 2015-10-09 13:55:23 +00:00
libbacktrace posix.c (backtrace_open): Cast second argument of open() to int. 2015-09-17 13:08:04 -04:00
libcc1 hash-traits.h (free_ptr_hash): New class. 2015-06-25 17:06:24 +00:00
libcilkrts re PR target/66326 (Floating point exception with -mfpmath=387 and -fcilkplus.) 2015-11-09 10:12:34 +00:00
libcpp Source range tracking in libcpp and C FE, with bit-packing optimization 2015-11-13 16:29:59 +00:00
libdecnumber IA MCU psABI support: changes to libraries 2015-06-30 09:42:07 -07:00
libffi re PR libffi/65441 (FAIL: libffi.call/float2.c -W -Wall -Wno-psabi (test for excess errors)) 2015-10-27 00:39:32 +00:00
libgcc on_exit.c: New file. 2015-11-15 18:41:44 -05:00
libgfortran re PR libfortran/67527 (io.h sanitizer complains on 1 << 31) 2015-09-12 12:05:44 +00:00
libgo libgo: use Solaris sendfile lib, fix Solaris _in6_addr_t fields 2015-11-10 21:38:30 +00:00
libgomp priority_queue.c: New file. 2015-11-17 09:29:34 -08:00
libiberty * Makefile.in (etags tags TAGS): Use && instead of ;. 2015-11-12 19:18:54 +00:00
libitm Support sized delete. 2015-11-09 17:30:24 +00:00
libjava libjava: fix locale handling when sorting JNI methods 2015-10-26 18:32:41 +00:00
libmpx re PR other/66887 (trunk/libmpx/mpxrt/mpxrt.c:158: possible performance problem) 2015-10-15 09:26:39 +00:00
libobjc replace BITS_PER_UNIT with __CHAR_BIT__ in target libs 2015-11-07 19:36:26 +00:00
liboffloadmic omp-low.c (lower_omp_ordered): Add argument to GOMP_SMD_ORDERED_* internal calls - 0 if... 2015-11-14 19:42:13 +01:00
libquadmath Makefile.am (libquadmath_la_SOURCES): Add math/logbq.c. 2015-08-09 08:46:52 +00:00
libsanitizer Update libsanitizer obstack interceptors 2015-11-09 14:53:25 +10:30
libssp libssp: Bump to automake 1.11.6 2015-05-13 11:12:39 +00:00
libstdc++-v3 re PR libstdc++/67440 (pretty-printing of a const set<foo> fails) 2015-11-16 21:32:26 +00:00
libvtv Correct libvtv obstack use 2015-11-09 14:49:43 +10:30
lto-plugin configure.ac: Add AC_USE_SYSTEM_EXTENSIONS. 2015-07-02 10:30:07 +02:00
maintainer-scripts update_version_svn: Add gcc-4_8-branch to IGNORE_BRANCHES. 2015-06-23 07:48:06 +00:00
zlib zlib: Bump to automake 1.11.6 2015-05-13 11:31:32 +00:00
.dir-locals.el
.gitignore
ABOUT-NLS
ChangeLog configure.ac: Enable libmpx by default. 2015-11-13 06:48:20 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
config.guess * config.sub, config.guess: Import from upstream. 2015-07-28 10:57:40 +10:00
config.rpath
config.sub * config.sub, config.guess: Import from upstream. 2015-07-28 10:57:40 +10:00
configure configure.ac: Enable libmpx by default. 2015-11-13 06:48:20 +00:00
configure.ac configure.ac: Enable libmpx by default. 2015-11-13 06:48:20 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update email address. 2015-10-23 17:06:07 +00:00
Makefile.def re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
Makefile.in re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
Makefile.tpl revert: configure.ac: Add -std=c++98 to stage1_cxxflags. 2015-05-21 13:05:33 -04:00
missing
mkdep
mkinstalldirs
move-if-change
README
symlink-tree
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.