Commit Graph

580 Commits

Author SHA1 Message Date
GCC Administrator c3642271e8 Daily bump. 2022-06-14 00:16:39 +00:00
Jakub Jelinek 1158fe4340 openmp: Conforming device numbers and omp_{initial,invalid}_device
OpenMP 5.2 changed once more what device numbers are allowed.
In 5.1, valid device numbers were [0, omp_get_num_devices()].
5.2 makes also -1 valid (calls it omp_initial_device), which is equivalent
in behavior to omp_get_num_devices() number but has the advantage that it
is a constant.  And it also introduces omp_invalid_device which is
also a constant with implementation defined value < -1.  That value should
act like sNaN, any time any device construct (GOMP_target*) or OpenMP runtime
API routine is asked for such a device, the program is terminated.
And if OMP_TARGET_OFFLOAD=mandatory, all non-conforming device numbers (which
is all but [-1, omp_get_num_devices()] other than omp_invalid_device)
must be treated like omp_invalid_device.

For device constructs, we have a compatibility problem, we've historically
used 2 magic negative values to mean something special.
GOMP_DEVICE_ICV (-1) means device clause wasn't present, pick the
		     omp_get_default_device () number
GOMP_DEVICE_FALLBACK (-2) means the host device (this is used e.g. for
			  #pragma omp target if (cond)
			  where if cond is false, we pass -2
But 5.2 requires that omp_initial_device is -1 (there were discussions
about it, advantage of -1 is that one can say iterate over the
[-1, omp_get_num_devices()-1] range to get all devices starting with
the host/initial one.
And also, if user passes -2, unless it is omp_invalid_device, we need to
treat it like non-conforming with OMP_TARGET_OFFLOAD=mandatory.

So, the patch does on the compiler side some number remapping,
user_device_num >= -2U ? user_device_num - 1 : user_device_num.
This remapping is done at compile time if device clause has constant
argument, otherwise at runtime, and means that for user -1 (omp_initial_device)
we pass -2 to GOMP_* in the runtime library where it treats it like host
fallback, while -2 is remapped to -3 (one of the non-conforming device numbers,
for those it doesn't matter which one is which).
omp_invalid_device is then -4.
For the OpenMP device runtime APIs, no remapping is done.

This patch doesn't deal with the initial default-device-var for
OMP_TARGET_OFFLOAD=mandatory , the spec says that the inital ICV value
for that should in that case depend on whether there are any offloading
devices or not (if not, should be omp_invalid_device), but that means
we can't determine the number of devices lazily (and let libraries have the
possibility to register their offloading data etc.).

2022-06-13  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* omp-expand.cc (expand_omp_target): Remap user provided
	device clause arguments, -1 to -2 and -2 to -3, either
	at compile time if constant, or at runtime.
include/
	* gomp-constants.h (GOMP_DEVICE_INVALID): Define.
libgomp/
	* omp.h.in (omp_initial_device, omp_invalid_device): New enumerators.
	* omp_lib.f90.in (omp_initial_device, omp_invalid_device): New
	parameters.
	* omp_lib.h.in (omp_initial_device, omp_invalid_device): Likewise.
	* target.c (resolve_device): Add remapped argument, handle
	GOMP_DEVICE_ICV only if remapped is true (and clear remapped),
	for negative values, treat GOMP_DEVICE_FALLBACK as fallback only
	if remapped, otherwise treat omp_initial_device that way.  For
	omp_invalid_device, always emit gomp_fatal, even when
	OMP_TARGET_OFFLOAD isn't mandatory.
	(GOMP_target, GOMP_target_ext, GOMP_target_data, GOMP_target_data_ext,
	GOMP_target_update, GOMP_target_update_ext,
	GOMP_target_enter_exit_data): Pass true as remapped argument to
	resolve_device.
	(omp_target_alloc, omp_target_free, omp_target_is_present,
	omp_target_memcpy_check, omp_target_associate_ptr,
	omp_target_disassociate_ptr, omp_get_mapped_ptr,
	omp_target_is_accessible): Pass false as remapped argument to
	resolve_device.  Treat omp_initial_device the same as
	gomp_get_num_devices ().  Don't bypass resolve_device calls if
	device_num is negative.
	(omp_pause_resource): Treat omp_initial_device the same as
	gomp_get_num_devices ().  Call resolve_device.
	* icv-device.c (omp_set_default_device): Always set to device_num
	even when it is negative.
	* libgomp.texi: Document that Conforming device numbers,
	omp_initial_device and omp_invalid_device is implemented.
	* testsuite/libgomp.c/target-41.c (main): Add test with
	omp_initial_device.
	* testsuite/libgomp.c/target-45.c: New test.
	* testsuite/libgomp.c/target-46.c: New test.
	* testsuite/libgomp.c/target-47.c: New test.
	* testsuite/libgomp.c-c++-common/target-is-accessible-1.c (main): Add
	test with omp_initial_device.  Use -5 instead of -1 for negative value
	test.
	* testsuite/libgomp.fortran/target-is-accessible-1.f90 (main):
	Likewise.  Reorder stop numbers.
2022-06-13 14:02:37 +02:00
GCC Administrator 820ead4519 Daily bump. 2022-06-01 00:16:34 +00:00
Alan Modra 6c3c8f087c Correct spelling of DW_AT_namelist_item
include/
	* dwarf2.def: Correct spelling of DW_AT_namelist_item.
gcc/
	* dwarf2out.cc (gen_namelist_decl): Adjust to suit correct
	spelling of DW_AT_namelist_item.
2022-05-31 23:35:23 +09:30
GCC Administrator 768f49a20f Daily bump. 2022-05-25 00:17:06 +00:00
David Malcolm 2c5c645663 libiberty: remove FINAL and OVERRIDE from ansidecl.h
libiberty's ansidecl.h provides macros FINAL and OVERRIDE to allow
virtual functions to be labelled with the C++11 "final" and "override"
specifiers, but with empty implementations on pre-C++11 C++ compilers.

We've used the macros in many places in GCC, but as of as of GCC 11
onwards GCC has required a C++11 compiler, such as GCC 4.8 or later.
On the assumption that any such compiler correctly implements "final"
and "override", I've simplified GCC's codebase by replacing all uses of
the FINAL and OVERRIDE macros in GCC's source tree with the lower-case
specifiers (via commits r13-690-gff171cb13df671 and
r13-716-g8473ef7be60443)

The macros are reportedly not used anywhere in binutils-gdb.

This patch completes this transition for GCC by eliminating the macros
from ansidecl.h.

include/ChangeLog:
	* ansidecl.h: Drop macros OVERRIDE and FINAL.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-05-24 10:22:37 -04:00
GCC Administrator 168fc8bda1 Daily bump. 2022-05-24 00:17:03 +00:00
Nathan Sidwell b7feb71d45 demangler: C++ modules support
This adds demangling support for C++ modules.  A new 'W' component
along with augmented behaviour of 'S' components.

	include/
	* demangle.h (enum demangle_component_type): Add module components.
	libiberty/
	* cp-demangle.c (d_make_comp): Adjust.
	(d_name, d_prefix): Adjust subst handling. Add module handling.
	(d_maybe_module_name): New.
	(d_unqualified_name): Add incoming module parm. Handle it.  Adjust all callers.
	(d_special_name): Add 'GI' support.
	(d_count_template_scopes): Adjust.
	(d_print_comp_inner): Print module.
	* testsuite/demangle-expected: New test cases
2022-05-23 05:39:15 -07:00
GCC Administrator 1cda629f96 Daily bump. 2022-05-19 00:16:32 +00:00
Thomas Schwinge 86f64400a5 'include/cuda/cuda.h': Add parts necessary for nvptx-tools 'nvptx-run'
include/
	* cuda/cuda.h (enum CUjit_option): Add
	'CU_JIT_GENERATE_DEBUG_INFO', 'CU_JIT_GENERATE_LINE_INFO'.
	(enum CUlimit): Add 'CU_LIMIT_STACK_SIZE',
	'CU_LIMIT_MALLOC_HEAP_SIZE'.
	(cuCtxSetLimit, cuGetErrorName): Add.
2022-05-18 12:06:20 +02:00
Thomas Schwinge bdd1dc1bfb 'include/cuda/cuda.h': For C++, wrap in 'extern "C"'
include/
	* cuda/cuda.h: For C++, wrap in 'extern "C"'.
2022-05-18 12:06:20 +02:00
GCC Administrator 3d9439b1bb Daily bump. 2022-05-18 00:16:36 +00:00
Nathan Sidwell 451894cadc demangler: Structured Bindings
C++ Structured bindings have a mangling that has yet to be formally
documented.  However, it's been around for a while and shows up for
module support.

	include/
	* demangle.h (enum demangle_component_type): Add
	DEMANGLE_COMPONENT_STRUCTURED_BINDING.
	libiberty/
	* cp-demangle.c (d_make_comp): Adjust.
	(d_unqualified_name): Add 'DC' support.
	(d_count_template_scopes): Adjust.
	(d_print_comp_inner): Add structured binding.
	* testsuite/demangle-expected: Add testcases.
2022-05-17 11:10:03 -07:00
Jakub Jelinek 2c16eb3157 openmp: Add support for inoutset depend-kind
This patch adds support for inoutset depend-kind in depend
clauses.  It is very similar to the in depend-kind in that
a task with a dependency with that depend-kind is dependent
on all previously created sibling tasks with matching address
unless they have the same depend-kind.
In the in depend-kind case everything is dependent except
for in -> in dependency, for inoutset everything is
dependent except for inoutset -> inoutset dependency.
mutexinoutset is also similar (everything is dependent except
for mutexinoutset -> mutexinoutset dependency), but there is
also the additional restriction that only one task with
mutexinoutset for each address can be scheduled at once (i.e.
mutual exclusitivty).  For now we support mutexinoutset
the same as inout/out, but the inoutset support is full.

In order not to bump the ABI for dependencies each time
(we've bumped it already once, the old ABI supports only
inout/out and in depend-kind, the new ABI supports
inout/out, mutexinoutset, in and depobj), this patch arranges
for inoutset to be at least for the time being always handled
as if it was specified through depobj even when it is not.
So it uses the new ABI for that and inoutset are represented
like depobj - pointer to a pair of pointers where the first one
will be the actual address of the object mentioned in depend
clause and second pointer will be (void *) GOMP_DEPEND_INOUTSET.

2022-05-17  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree-core.h (enum omp_clause_depend_kind): Add
	OMP_CLAUSE_DEPEND_INOUTSET.
	* tree-pretty-print.cc (dump_omp_clause): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
	* gimplify.cc (gimplify_omp_depend): Likewise.
	* omp-low.cc (lower_depend_clauses): Likewise.
gcc/c-family/
	* c-omp.cc (c_finish_omp_depobj): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
gcc/c/
	* c-parser.cc (c_parser_omp_clause_depend): Parse
	inoutset depend-kind.
	(c_parser_omp_depobj): Likewise.
gcc/cp/
	* parser.cc (cp_parser_omp_clause_depend): Parse
	inoutset depend-kind.
	(cp_parser_omp_depobj): Likewise.
	* cxx-pretty-print.cc (cxx_pretty_printer::statement): Handle
	OMP_CLAUSE_DEPEND_INOUTSET.
gcc/testsuite/
	* c-c++-common/gomp/all-memory-1.c (boo): Add test with
	inoutset depend-kind.
	* c-c++-common/gomp/all-memory-2.c (boo): Likewise.
	* c-c++-common/gomp/depobj-1.c (f1): Likewise.
	(f2): Adjusted expected diagnostics.
	* g++.dg/gomp/depobj-1.C (f4): Adjust expected diagnostics.
include/
	* gomp-constants.h (GOMP_DEPEND_INOUTSET): Define.
libgomp/
	* libgomp.h (struct gomp_task_depend_entry): Change is_in type
	from bool to unsigned char.
	* task.c (gomp_task_handle_depend): Handle GOMP_DEPEND_INOUTSET.
	Ignore dependencies where
	task->depend[i].is_in && task->depend[i].is_in == ent->is_in
	rather than just task->depend[i].is_in && ent->is_in.  Remember
	whether GOMP_DEPEND_IN loop is needed and guard the loop with that
	conditional.
	(gomp_task_maybe_wait_for_dependencies): Handle GOMP_DEPEND_INOUTSET.
	Ignore dependencies where elem.is_in && elem.is_in == ent->is_in
	rather than just elem.is_in && ent->is_in.
	* testsuite/libgomp.c-c++-common/depend-1.c (test): Add task with
	inoutset depend-kind.
	* testsuite/libgomp.c-c++-common/depend-2.c (test): Likewise.
	* testsuite/libgomp.c-c++-common/depend-3.c (test): Likewise.
	* testsuite/libgomp.c-c++-common/depend-inoutset-1.c: New test.
2022-05-17 15:40:27 +02:00
GCC Administrator e877898911 Daily bump. 2022-05-11 00:16:40 +00:00
Martin Liska 137da38377 Remove non-ANSI C macros in ansidecl.h.
include/ChangeLog:

	* ansidecl.h (PTR): Remove.
	(const): Likewise.
	(volatile): Likewise.
	(signed): Likewise.
2022-05-10 16:06:27 +02:00
Martin Liska 50b009c5da libiberty: stop using PTR macro
include/ChangeLog:

	* hashtab.h (HTAB_EMPTY_ENTRY): Use void * instead PTR.
	(HTAB_DELETED_ENTRY): Likewise.

libiberty/ChangeLog:

	* alloca.c (C_alloca): Use void * instead PTR.
	* calloc.c (malloc): Likewise.
	(bzero): Likewise.
	(calloc): Likewise.
	* hashtab.c (find_empty_slot_for_expand): Likewise.
	(eq_pointer): Likewise.
	(htab_create_alloc_ex): Likewise.
	(htab_create_typed_alloc): Likewise.
	(htab_set_functions_ex): Likewise.
	(htab_delete): Likewise.
	(htab_empty): Likewise.
	(htab_expand): Likewise.
	(htab_find_with_hash): Likewise.
	(htab_find): Likewise.
	(htab_find_slot_with_hash): Likewise.
	(htab_find_slot): Likewise.
	(htab_remove_elt): Likewise.
	(htab_remove_elt_with_hash): Likewise.
	(htab_clear_slot): Likewise.
	(htab_traverse_noresize): Likewise.
	(htab_traverse): Likewise.
	(htab_hash_string): Likewise.
	(iterative_hash): Likewise.
	(hash_pointer): Likewise.
	* memchr.c (memchr): Likewise.
	* memcmp.c (memcmp): Likewise.
	* memcpy.c (memcpy): Likewise.
	* memmove.c (memmove): Likewise.
	* mempcpy.c (memcpy): Likewise.
	(mempcpy): Likewise.
	* memset.c (memset): Likewise.
	* objalloc.c (malloc): Likewise.
	(free): Likewise.
	(objalloc_create): Likewise.
	(_objalloc_alloc): Likewise.
	(objalloc_free_block): Likewise.
	* random.c (PTR): Likewise.
	(void): Likewise.
	(initstate): Likewise.
	(setstate): Likewise.
	* regex.c: Likewise.
	* spaces.c (malloc): Likewise.
	(free): Likewise.
	* stpcpy.c (memcpy): Likewise.
	* strdup.c (malloc): Likewise.
	(memcpy): Likewise.
	* strerror.c (malloc): Likewise.
	(memset): Likewise.
	* strndup.c (malloc): Likewise.
	(memcpy): Likewise.
	* strsignal.c (malloc): Likewise.
	(memset): Likewise.
	* vasprintf.c (malloc): Likewise.
	* vprintf-support.c: Likewise.
	* xatexit.c (malloc): Likewise.
	* xmalloc.c (xmalloc): Likewise.
	(xcalloc): Likewise.
	(xrealloc): Likewise.
	* xmemdup.c (xmemdup): Likewise.
2022-05-10 16:04:30 +02:00
GCC Administrator bd022ff975 Daily bump. 2022-05-10 00:17:14 +00:00
Martin Liska 1fffe45fb5 Remove non-ANSI C path in ansidecl.h.
include/ChangeLog:

	* ansidecl.h (PTR): Remove Not ANCI C part.
2022-05-09 13:50:09 +02:00
GCC Administrator 3e7db51747 Daily bump. 2022-05-05 00:16:29 +00:00
Martin Liska c4ae175881 LTO plugin: modernize a bit.
include/ChangeLog:

	* plugin-api.h (enum ld_plugin_tag): Do not set implicit enum
	values.

lto-plugin/ChangeLog:

	* lto-plugin.c (struct plugin_objfile): Use bool for offset
	field.
	(exec_lto_wrapper): Assign true/false to bool variables.
	(process_offload_section): Likewise.
	(claim_file_handler): Likewise.
	(onload): Likewise.
2022-05-04 08:20:13 +02:00
GCC Administrator 80eb8ec672 Daily bump. 2022-04-07 00:16:45 +00:00
Thomas Schwinge 5e431ae4cc Move 'libgomp/plugin/cuda/cuda.h' to 'include/cuda/cuda.h'
... so that it may be used by other projects that inherit GCC's 'include'
directory.

	include/
	* cuda/cuda.h: New file.
	libgomp/
	* plugin/cuda/cuda.h: Remove file.
	* plugin/plugin-nvptx.c [PLUGIN_NVPTX_DYNAMIC]: Include
	"cuda/cuda.h" instead of <cuda.h>.
	* plugin/configfrag.ac <PLUGIN_NVPTX_DYNAMIC>: Don't set
	'PLUGIN_NVPTX_CPPFLAGS'.
	* configure: Regenerate.
2022-04-06 22:30:14 +02:00
GCC Administrator d7f00da1c0 Daily bump. 2022-03-20 00:16:30 +00:00
Tiezhu Yang b2dff6b2d9 rename floatformat_ia64_quad_{big, little} to floatformat_ieee_quad_{big, little}
I submitted a GDB patch [1] to rename floatformats_ia64_quad to
floatformats_ieee_quad to reflect the reality, and then we can
clean up the related code.

As GDB Global Maintainer Tom Tromey said [2]:

  These files are maintained in gcc and then imported into the
  binutils-gdb repository, so any changes to them will have to
  be proposed there first.

this GCC patch is preparation for the GDB patch, no functionality
change.

[1] https://sourceware.org/pipermail/gdb-patches/2022-March/186452.html
[2] https://sourceware.org/pipermail/gdb-patches/2022-March/186569.html

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

include/
	* floatformat.h (floatformat_ieee_quad_big): Renamed from
	floatformat_ia64_quad_big.
	(floatformat_ieee_quad_little): Similarly.

libiberty/
	* floatformat.c (floatformat_ieee_quad_big): Renamed from
	floatformat_ia64_quad_big.
	(floatformat_ieee_quad_little): Similarly.
2022-03-19 13:33:40 -04:00
Jakub Jelinek 7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
GCC Administrator c8dcf64b31 Daily bump. 2021-12-13 00:16:28 +00:00
Jonathan Wakely b8f7ff76d6 Replace gnu::unique_ptr with std::unique_ptr
Now that GCC is compiled as C++11 there is no need to keep the C++03
implementation of gnu::unique_ptr.

This removes the unique-ptr.h header and replaces it with <memory> in
system.h, and changes the INCLUDE_UNIQUE_PTR macro to INCLUDE_MEMORY.
Uses of gnu::unique_ptr and gnu::move can be replaced with
std::unique_ptr and std::move. There are no uses of unique_xmalloc_ptr
or xmalloc_deleter in GCC.

gcc/analyzer/ChangeLog:

	* engine.cc: Define INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR.

gcc/c-family/ChangeLog:

	* known-headers.cc: Define INCLUDE_MEMORY instead of
	INCLUDE_UNIQUE_PTR.
	* name-hint.h: Likewise.
	(class name_hint): Use std::unique_ptr instead of gnu::unique_ptr.

gcc/c/ChangeLog:

	* c-decl.c: Define INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR.
	* c-parser.c: Likewise.

gcc/cp/ChangeLog:

	* error.c: Define INCLUDE_MEMORY instead of
	INCLUDE_UNIQUE_PTR.
	* lex.c: Likewise.
	* name-lookup.c: Likewise.
	(class namespace_limit_reached): Use std::unique_ptr instead of
	gnu::unique_ptr.
	(suggest_alternatives_for): Use std::move instead of gnu::move.
	(suggest_alternatives_in_other_namespaces): Likewise.
	* parser.c: Define INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR.

gcc/ChangeLog:

	* Makefile.in: Remove unique-ptr-tests.o.
	* selftest-run-tests.c (selftest::run_tests): Remove
	unique_ptr_tests_cc_tests.
	* selftest.h (unique_ptr_tests_cc_tests): Remove.
	* system.h: Check INCLUDE_MEMORY instead of INCLUDE_UNIQUE_PTR
	and include <memory> instead of "unique-ptr.h".
	* unique-ptr-tests.cc: Removed.

include/ChangeLog:

	* unique-ptr.h: Removed.
2021-12-12 22:51:12 +00:00
GCC Administrator 0bceef1671 Daily bump. 2021-12-11 00:16:30 +00:00
Andrew Stubbs 4a87a8e4b1 amdgcn: Change offload variable table discovery
Up to now the libgomp GCN plugin has been finding the offload variables
by using a symbol lookup, but the AMD runtime requires that the symbols are
global for that to work. This was ensured by mkoffload as a post-procssing
step, but the LLVM 13 assembler no longer accepts this in the case where the
variable was previously declared differently.

This patch switches to locating the symbols directly from the
offload_var_table, which means that only one symbol needs to be forced
global.

This changes breaks the libgomp image compatibility so GOMP_VERSION_GCN has
also been bumped.

gcc/ChangeLog:

	* config/gcn/mkoffload.c (process_asm): Process the variable table
	completely differently.
	(process_obj): Encode the varaible data differently.

include/ChangeLog:

	* gomp-constants.h (GOMP_VERSION_GCN): Bump.

libgomp/ChangeLog:

	* plugin/plugin-gcn.c (struct gcn_image_desc): Remove global_variables.
	(GOMP_OFFLOAD_load_image): Locate the offload variables via the
	table, not individual symbols.
2021-12-10 10:45:09 +00:00
GCC Administrator 641ff2196f Daily bump. 2021-12-09 00:16:31 +00:00
Chung-Lin Tang 0ab29cf0bb openmp: Improve OpenMP target support for C++ (PR92120)
This patch implements several C++ specific mapping capabilities introduced for
OpenMP 5.0, including implicit mapping of this[:1] for non-static member
functions, zero-length array section mapping of pointer-typed members,
lambda captured variable access in target regions, and use of lambda objects
inside target regions.

Several adjustments to the C/C++ front-ends to allow more member-access syntax
as valid is also included.

	PR middle-end/92120

gcc/cp/ChangeLog:

	* cp-tree.h (finish_omp_target): New declaration.
	(finish_omp_target_clauses): Likewise.
	* parser.c (cp_parser_omp_clause_map): Adjust call to
	cp_parser_omp_var_list_no_open to set 'allow_deref' argument to true.
	(cp_parser_omp_target): Factor out code, adjust into calls to new
	function finish_omp_target.
	* pt.c (tsubst_expr): Add call to finish_omp_target_clauses for
	OMP_TARGET case.
	* semantics.c (handle_omp_array_sections_1): Add handling to create
	'this->member' from 'member' FIELD_DECL. Remove case of rejecting
	'this' when not in declare simd.
	(handle_omp_array_sections): Likewise.
	(finish_omp_clauses): Likewise. Adjust to allow 'this[]' in OpenMP
	map clauses. Handle 'A->member' case in map clauses. Remove case of
	rejecting 'this' when not in declare simd.
	(struct omp_target_walk_data): New struct for walking over
	target-directive tree body.
	(finish_omp_target_clauses_r): New function for tree walk.
	(finish_omp_target_clauses): New function.
	(finish_omp_target): New function.

gcc/c/ChangeLog:

	* c-parser.c (c_parser_omp_clause_map): Set 'allow_deref' argument in
	call to c_parser_omp_variable_list to 'true'.
	* c-typeck.c (handle_omp_array_sections_1): Add strip of MEM_REF in
	array base handling.
	(c_finish_omp_clauses): Handle 'A->member' case in map clauses.

gcc/ChangeLog:

	* gimplify.c ("tree-hash-traits.h"): Add include.
	(gimplify_scan_omp_clauses): Change struct_map_to_clause to type
	hash_map<tree_operand, tree> *. Adjust struct map handling to handle
	cases of *A and A->B expressions. Under !DECL_P case of
	GOMP_CLAUSE_MAP handling, add STRIP_NOPS for indir_p case, add to
	struct_deref_set for map(*ptr_to_struct) cases. Add MEM_REF case when
	handling component_ref_p case. Add unshare_expr and gimplification
	when created GOMP_MAP_STRUCT is not a DECL. Add code to add
	firstprivate pointer for *pointer-to-struct case.
	(gimplify_adjust_omp_clauses): Move GOMP_MAP_STRUCT removal code for
	exit data directives code to earlier position.
	* omp-low.c (lower_omp_target):
	Handle GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION, and
	GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION map kinds.
	* tree-pretty-print.c (dump_omp_clause): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/gomp/target-3.c: New testcase.
	* g++.dg/gomp/target-3.C: New testcase.
	* g++.dg/gomp/target-lambda-1.C: New testcase.
	* g++.dg/gomp/target-lambda-2.C: New testcase.
	* g++.dg/gomp/target-this-1.C: New testcase.
	* g++.dg/gomp/target-this-2.C: New testcase.
	* g++.dg/gomp/target-this-3.C: New testcase.
	* g++.dg/gomp/target-this-4.C: New testcase.
	* g++.dg/gomp/target-this-5.C: New testcase.
	* g++.dg/gomp/this-2.C: Adjust testcase.

include/ChangeLog:

	* gomp-constants.h (enum gomp_map_kind):
	Add GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION, and
	GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION map kinds.
	(GOMP_MAP_POINTER_P):
	Include GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION.

libgomp/ChangeLog:

	* libgomp.h (gomp_attach_pointer): Add bool parameter.
	* oacc-mem.c (acc_attach_async): Update call to gomp_attach_pointer.
	(goacc_enter_data_internal): Likewise.
	* target.c (gomp_map_vars_existing): Update assert condition to
	include GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION.
	(gomp_map_pointer): Add 'bool allow_zero_length_array_sections'
	parameter, add support for mapping a pointer with NULL target.
	(gomp_attach_pointer): Add 'bool allow_zero_length_array_sections'
	parameter, add support for attaching a pointer with NULL target.
	(gomp_map_vars_internal): Update calls to gomp_map_pointer and
	gomp_attach_pointer, add handling for
	GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION, and
	GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION cases.
	* testsuite/libgomp.c++/target-23.C: New testcase.
	* testsuite/libgomp.c++/target-lambda-1.C: New testcase.
	* testsuite/libgomp.c++/target-lambda-2.C: New testcase.
	* testsuite/libgomp.c++/target-this-1.C: New testcase.
	* testsuite/libgomp.c++/target-this-2.C: New testcase.
	* testsuite/libgomp.c++/target-this-3.C: New testcase.
	* testsuite/libgomp.c++/target-this-4.C: New testcase.
	* testsuite/libgomp.c++/target-this-5.C: New testcase.
2021-12-08 22:29:06 +08:00
GCC Administrator af2852b9dc Daily bump. 2021-11-13 00:16:39 +00:00
Chung-Lin Tang b7e2048063 openmp: Relax handling of implicit map vs. existing device mappings
This patch implements relaxing the requirements when a map with the implicit
attribute encounters an overlapping existing map. As the OpenMP 5.0 spec
describes on page 320, lines 18-27 (and 5.1 spec, page 352, lines 13-22):

"If a single contiguous part of the original storage of a list item with an
 implicit data-mapping attribute has corresponding storage in the device data
 environment prior to a task encountering the construct that is associated with
 the map clause, only that part of the original storage will have corresponding
 storage in the device data environment as a result of the map clause."

2021-11-12  Chung-Lin Tang  <cltang@codesourcery.com>

include/ChangeLog:

	* gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_3): Define special bit macro.
	(GOMP_MAP_IMPLICIT): New special map kind bits value.
	(GOMP_MAP_FLAG_SPECIAL_BITS): Define helper mask for whole set of
	special map kind bits.
	(GOMP_MAP_IMPLICIT_P): New predicate macro for implicit map kinds.

gcc/ChangeLog:

	* tree.h (OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P): New access macro for
	'implicit' bit, using 'base.deprecated_flag' field of tree_node.
	* tree-pretty-print.c (dump_omp_clause): Add support for printing
	implicit attribute in tree dumping.
	* gimplify.c (gimplify_adjust_omp_clauses_1):
	Set OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P to 1 if map clause is implicitly
	created.
	(gimplify_adjust_omp_clauses): Adjust place of adding implicitly created
	clauses, from simple append, to starting of list, after non-map clauses.
	* omp-low.c (lower_omp_target): Add GOMP_MAP_IMPLICIT bits into kind
	values passed to libgomp for implicit maps.

gcc/testsuite/ChangeLog:

	* c-c++-common/gomp/target-implicit-map-1.c: New test.
	* c-c++-common/goacc/combined-reduction.c: Adjust scan test pattern.
	* c-c++-common/goacc/firstprivate-mappings-1.c: Likewise.
	* c-c++-common/goacc/mdc-1.c: Likewise.
	* g++.dg/goacc/firstprivate-mappings-1.C: Likewise.

libgomp/ChangeLog:

	* target.c (gomp_map_vars_existing): Add 'bool implicit' parameter, add
	implicit map handling to allow a "superset" existing map as valid case.
	(get_kind): Adjust to filter out GOMP_MAP_IMPLICIT bits in return value.
	(get_implicit): New function to extract implicit status.
	(gomp_map_fields_existing): Adjust arguments in calls to
	gomp_map_vars_existing, and add uses of get_implicit.
	(gomp_map_vars_internal): Likewise.
	* testsuite/libgomp.c-c++-common/target-implicit-map-1.c: New test.
2021-11-12 20:29:48 +08:00
GCC Administrator 851dff042a Daily bump. 2021-11-06 00:16:24 +00:00
Gerald Pfeifer 44d9d55c6d include: Allow for our md5.h to defer to the system header
This came up in the context of libsanitizer, where platform-specific
support for FreeBSD relies on aspects provided by FreeBSD's own md5.h.

Address this by allowing GCC's md5.h to pull in the system header
instead, controlled by a new macro USE_SYSTEM_MD5.

2021-11-05  Gerald Pfeifer  <gerald@pfeifer.com>
	    Jakub Jelinek  <jakub@redhat.com>

include/
	* md5.h (USE_SYSTEM_MD5): Introduce.
2021-11-05 13:06:34 +01:00
GCC Administrator cf966403d9 Daily bump. 2021-09-28 00:16:21 +00:00
Vincent Lefevre 3e6a511b94 Update pathname for IBM long double description.
include/
	* floatformat.h: Update pathname for IBM long double description.
2021-09-27 10:56:14 -04:00
GCC Administrator e4777439fc Daily bump. 2021-09-23 00:16:29 +00:00
Alan Modra b032103265 obstack.h __PTR_ALIGN vs. ubsan
Current ubsan complains on every use of __PTR_ALIGN (when ptrdiff_t is
as large as a pointer), due to making calculations relative to a NULL
pointer.  This patch avoids the problem by extracting out and
simplifying __BPTR_ALIGN for the usual case.  I've continued to use
ptrdiff_t here, where it might be better to throw away __BPTR_ALIGN
entirely and just assume uintptr_t exists.

	* obstack.h (__PTR_ALIGN): Expand and simplify __BPTR_ALIGN
	rather than calculating relative to a NULL pointer.
2021-09-22 17:14:17 +09:30
GCC Administrator 38b19c5b08 Daily bump. 2021-08-24 00:17:00 +00:00
Jakub Jelinek 3bc75533d1 openmp: Add support for strict modifier on grainsize/num_tasks clauses
With strict: modifier on these clauses, the standard is explicit about
how many iterations (and which) each generated task of taskloop directive
should contain.  For num_tasks it actually matches what we were already
implementing, but for grainsize it does not (and even violates the old
rule - without strict it requires that the number of iterations (unspecified
which exactly) handled by each generated task is >= grainsize argument and
< 2 * grainsize argument, with strict: it requires that each generated
task handles exactly == grainsize argument iterations, except for the
generated task handling the last iteration which can handles <= grainsize
iterations).

The following patch implements it for C and C++.

2021-08-23  Jakub Jelinek  <jakub@redhat.com>

gcc/
	* tree.h (OMP_CLAUSE_GRAINSIZE_STRICT): Define.
	(OMP_CLAUSE_NUM_TASKS_STRICT): Define.
	* tree-pretty-print.c (dump_omp_clause) <case OMP_CLAUSE_GRAINSIZE,
	case OMP_CLAUSE_NUM_TASKS>: Print strict: modifier.
	* omp-expand.c (expand_task_call): Use GOMP_TASK_FLAG_STRICT in iflags
	if either grainsize or num_tasks clause has the strict modifier.
gcc/c/
	* c-parser.c (c_parser_omp_clause_num_tasks,
	c_parser_omp_clause_grainsize): Parse the optional strict: modifier.
gcc/cp/
	* parser.c (cp_parser_omp_clause_num_tasks,
	cp_parser_omp_clause_grainsize): Parse the optional strict: modifier.
include/
	* gomp-constants.h (GOMP_TASK_FLAG_STRICT): Define.
libgomp/
	* taskloop.c (GOMP_taskloop): Handle GOMP_TASK_FLAG_STRICT.
	* testsuite/libgomp.c-c++-common/taskloop-4.c (main): Fix up comment.
	* testsuite/libgomp.c-c++-common/taskloop-5.c: New test.
2021-08-23 10:16:24 +02:00
GCC Administrator 5a957cd388 Daily bump. 2021-07-25 00:16:22 +00:00
Marek Polacek 34dbb5f346 include: Fix -Wundef warnings in ansidecl.h
This quashes -Wundef warnings in ansidecl.h when compiled in C or C++.
In C, __cpp_constexpr and __cplusplus aren't defined so we evaluate
them to 0; conversely, __STDC_VERSION__ is not defined in C++.
This has caused grief when -Wundef is used with -Werror.

I've also tested -traditional-cpp.

include/ChangeLog:

	* ansidecl.h: Check if __cplusplus is defined before checking
	the value of __cpp_constexpr and __cplusplus.  Don't check
	__STDC_VERSION__ in C++.
2021-07-24 12:51:00 -04:00
GCC Administrator 7a60a6e8b3 Daily bump. 2021-07-03 00:16:31 +00:00
David Faust 18d0fad77b BTF: Support for BTF_KIND_FLOAT
Add BTF_KIND_FLOAT, a new BTF type kind which has recently stabilized in
the linux kernel [1]. This kind is used for encoding floating point
types, and is of particular use when generating BTF for some s390
arch-specific kernel headers.

Also update some BTF tests which previously used floating point types to
check correct behavior for types with no BTF representation.

[1]: b1828f0b04

include/ChangeLog:

	* btf.h (struct btf_type): Update bit usage comment.
	(BTF_INFO_KIND): Update bit mask.
	(BTF_KIND_FLOAT): New define.
	(BTF_KIND_MAX): Update.

gcc/ChangeLog:

	* btfout.c (get_btf_kind): Support BTF_KIND_FLOAT.
	(btf_asm_type): Likewise.

gcc/testsuite/ChangeLog:

	* gcc.dg/debug/btf/btf-float-1.c: New test.
	* gcc.dg/debug/btf/btf-function-3.c: Use different unrepresentable type.
	* gcc.dg/debug/btf/btf-struct-2.c: Likewise.
	* gcc.dg/debug/btf/btf-variables-2.c: Likewise.
2021-07-02 08:32:44 -07:00
GCC Administrator c8abc2058e Daily bump. 2021-06-29 00:16:42 +00:00
Indu Bhagat b7e215a8ee CTF/BTF debug formats
This commit introduces support for generating CTF debugging
information and BTF debugging information from GCC.

2021-06-28  Indu Bhagat  <indu.bhagat@oracle.com>
	    David Faust  <david.faust@oracle.com>
	    Jose E. Marchesi  <jose.marchesi@oracle.com>
	    Weimin Pan  <weimin.pan@oracle.com>

gcc/

	* Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to
	GTFILES.  Add new object files.
	* common.opt: Add CTF and BTF debug info options.
	* btfout.c: New file.
	* ctfc.c: Likewise.
	* ctfc.h: Likewise.
	* ctfout.c: Likewise.
	* dwarf2ctf.c: Likewise.
	* dwarf2ctf.h: Likewise.
	* dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and
	BTF_DEBUG.
	* dwarf2out.c (dwarf2out_source_line): Likewise.
	(dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to
	be generated.
	(debug_format_do_cu): New function.
	(dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for
	them if	requested.
	Include dwarf2ctf.c.
	* final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug
	formats.
	* flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG.
	(CTF_DEBUG): New bitmask.
	(BTF_DEBUG): Likewise.
	(enum ctf_debug_info_levels): New enum.
	* gengtype.c (open_base_files): Handle ctfc.h.
	(main): Handle uint32_t type.
	* flags.h (btf_debuginfo_p): New definition.
	(dwarf_based_debuginfo_p): Likewise.
	* opts.c (debug_type_names): Add entries for CTF and BTF.
	(btf_debuginfo_p): New function.
	(dwarf_based_debuginfo_p): Likewise.
	(common_handle_option): Handle -gctfN and -gbtf options.
	(set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate.
	* toplev.c (process_options): Inform the user and ignore -gctfLEVEL if
	frontend is not C.

include/

	* ctf.h: New file.
	* btf.h: Likewise.

libiberty/

	* simple-object.c (handle_lto_debug_sections): Copy over .ctf
	sections.
2021-06-28 18:47:20 +02:00
GCC Administrator cfe82a0cbe Daily bump. 2021-05-07 00:16:33 +00:00
Tom Tromey 77380c6806 libiberty: add htab_eq_string
The libiberty hash table includes a helper function for strings, but
no equality function.  Consequently, this equality function has been
reimplemented a number of times in both the gcc and binutils-gdb
source trees.  This patch adds the function to the libiberty hash
table, as a step toward the goal of removing all the copies.

One change to gcc is included here.  Normally I would have put this in
the next patch, but gensupport.c used the most natural name for its
reimplementation of this function, and this can't coexist with the
extern function in libiberty.

include

	* hashtab.h (htab_eq_string): Declare.

libiberty

	* hashtab.c (htab_eq_string): New function.

gcc

	* gensupport.c (htab_eq_string): Remove.
2021-05-06 08:51:28 -06:00