aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-04-22 16:44:42 +0200
committerJakub Jelinek <jakub@redhat.com>2020-04-22 16:44:42 +0200
commitc3a34659036b55fa36a5355fdd67133f427eeb2d (patch)
tree2a42175d9f7f989fa0acc263563ccb13b024e69a /gcc
parent4e16452e2900fc79b090794e7b7a5727f1136a4a (diff)
downloadgcc-c3a34659036b55fa36a5355fdd67133f427eeb2d.zip
gcc-c3a34659036b55fa36a5355fdd67133f427eeb2d.tar.gz
gcc-c3a34659036b55fa36a5355fdd67133f427eeb2d.tar.bz2
calls: Introduce cxx17_empty_base_field_p [PR94383]
As multiple targets are affected apparently, I believe at least aarch64, arm, powerpc64le, s390{,x} and ia64, I think we should have a middle-end predicate for this, so that if we need to tweak it, we can do it in one spot. 2020-04-22 Jakub Jelinek <jakub@redhat.com> PR target/94383 * calls.h (cxx17_empty_base_field_p): Declare. * calls.c (cxx17_empty_base_field_p): Define.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/calls.c18
-rw-r--r--gcc/calls.h1
3 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 961048a..043ee40 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/94383
+ * calls.h (cxx17_empty_base_field_p): Declare.
+ * calls.c (cxx17_empty_base_field_p): Define.
+
2020-04-22 Christophe Lyon <christophe.lyon@linaro.org>
* doc/sourcebuild.texi (arm_softfp_ok, arm_hard_ok): Document.
diff --git a/gcc/calls.c b/gcc/calls.c
index 5bd9227..9ac7f94 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -6261,5 +6261,23 @@ must_pass_va_arg_in_stack (tree type)
return targetm.calls.must_pass_in_stack (arg);
}
+/* Return true if FIELD is the C++17 empty base field that should
+ be ignored for ABI calling convention decisions in order to
+ maintain ABI compatibility between C++14 and earlier, which doesn't
+ add this FIELD to classes with empty bases, and C++17 and later
+ which does. */
+
+bool
+cxx17_empty_base_field_p (const_tree field)
+{
+ return (TREE_CODE (field) == FIELD_DECL
+ && DECL_ARTIFICIAL (field)
+ && RECORD_OR_UNION_TYPE_P (TREE_TYPE (field))
+ && DECL_SIZE (field)
+ && integer_zerop (DECL_SIZE (field))
+ && TYPE_SIZE (TREE_TYPE (field))
+ && !integer_zerop (TYPE_SIZE (TREE_TYPE (field))));
+}
+
/* Tell the garbage collector about GTY markers in this source file. */
#include "gt-calls.h"
diff --git a/gcc/calls.h b/gcc/calls.h
index 9c9dd96..4ee4936 100644
--- a/gcc/calls.h
+++ b/gcc/calls.h
@@ -135,5 +135,6 @@ extern tree get_attr_nonstring_decl (tree, tree * = NULL);
extern void maybe_warn_nonstring_arg (tree, tree);
extern bool get_size_range (tree, tree[2], bool = false);
extern rtx rtx_for_static_chain (const_tree, bool);
+extern bool cxx17_empty_base_field_p (const_tree);
#endif // GCC_CALLS_H