summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/config/i386/i386.c3
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/doc/tm.texi6
-rw-r--r--gcc/doc/tm.texi.in2
-rw-r--r--gcc/target.def10
-rw-r--r--gcc/testsuite/g++.dg/abi/empty12.C2
-rw-r--r--gcc/testsuite/g++.dg/abi/empty13.C2
-rw-r--r--gcc/testsuite/g++.dg/abi/empty14.C2
-rw-r--r--gcc/testsuite/g++.dg/abi/empty15.C2
-rw-r--r--gcc/testsuite/g++.dg/abi/empty16.C2
-rw-r--r--gcc/testsuite/g++.dg/abi/empty17.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-1.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-10.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-11.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-12.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-2.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-3.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-5.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-6.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-7.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-8.C2
-rw-r--r--gcc/testsuite/g++.dg/pr60336-9.C2
-rw-r--r--gcc/testsuite/g++.dg/pr68355.C2
23 files changed, 42 insertions, 18 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2a9cda619ae..4d4150f7c10 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -54598,6 +54598,9 @@ ix86_addr_space_zero_address_valid (addr_space_t as)
#undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE ix86_promote_function_mode
+#undef TARGET_CXX_FUNCTION_SKIP_EMPTY_CLASS_P
+#define TARGET_CXX_FUNCTION_SKIP_EMPTY_CLASS_P hook_bool_void_true
+
#undef TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE
#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE ix86_override_options_after_change
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index f34b1ef647f..b674208ef8f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6885,6 +6885,9 @@ is_empty_type (tree type)
static bool
is_really_empty_type (tree type)
{
+ if (!targetm.cxx.function_skip_empty_class_p ())
+ return false;
+
if (type == error_mark_node)
return false;
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 8b3bccda967..32639565bc5 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -10238,6 +10238,12 @@ modified value and perform any other actions necessary to support the
backend's targeted operating system.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_CXX_FUNCTION_SKIP_EMPTY_CLASS_P (void)
+This hook should return true if no memory slot nor register should be
+used to pass or return an object of empty C++ class. The default is to
+return @code{false}.
+@end deftypefn
+
@deftypefn {Target Hook} bool TARGET_CXX_CDTOR_RETURNS_THIS (void)
This hook should return @code{true} if constructors and destructors return
the address of the object created/destroyed. The default is to return
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index f31c763991c..8d82175c7b7 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -7392,6 +7392,8 @@ floating-point support; they are not included in this mechanism.
@hook TARGET_CXX_IMPORT_EXPORT_CLASS
+@hook TARGET_CXX_FUNCTION_SKIP_EMPTY_CLASS_P
+
@hook TARGET_CXX_CDTOR_RETURNS_THIS
@hook TARGET_CXX_KEY_METHOD_MAY_BE_INLINE
diff --git a/gcc/target.def b/gcc/target.def
index 5c8e4e16cc1..9e21696f791 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -5393,6 +5393,16 @@ modified value and perform any other actions necessary to support the\n\
backend's targeted operating system.",
int, (tree type, int import_export), NULL)
+/* Returns true if no memory slot nor register should be used to pass
+ or return an object of empty C++ class. */
+DEFHOOK
+(function_skip_empty_class_p,
+ "This hook should return true if no memory slot nor register should be\n\
+used to pass or return an object of empty C++ class. The default is to\n\
+return @code{false}.",
+ bool, (void),
+ hook_bool_void_false)
+
/* Returns true if constructors and destructors return "this". */
DEFHOOK
(cdtor_returns_this,
diff --git a/gcc/testsuite/g++.dg/abi/empty12.C b/gcc/testsuite/g++.dg/abi/empty12.C
index db2fd24f6db..c2e4dc7461c 100644
--- a/gcc/testsuite/g++.dg/abi/empty12.C
+++ b/gcc/testsuite/g++.dg/abi/empty12.C
@@ -1,5 +1,5 @@
// PR c++/60336
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-x c" }
// { dg-additional-sources "empty12a.c" }
// { dg-prune-output "command line option" }
diff --git a/gcc/testsuite/g++.dg/abi/empty13.C b/gcc/testsuite/g++.dg/abi/empty13.C
index d1e094685de..d2e297edbb2 100644
--- a/gcc/testsuite/g++.dg/abi/empty13.C
+++ b/gcc/testsuite/g++.dg/abi/empty13.C
@@ -1,5 +1,5 @@
// PR c++/60336
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-x c -fabi-version=9" }
// { dg-additional-sources "empty13a.c" }
// { dg-prune-output "command line option" }
diff --git a/gcc/testsuite/g++.dg/abi/empty14.C b/gcc/testsuite/g++.dg/abi/empty14.C
index d32eed77d66..48ee1f845e6 100644
--- a/gcc/testsuite/g++.dg/abi/empty14.C
+++ b/gcc/testsuite/g++.dg/abi/empty14.C
@@ -1,5 +1,5 @@
// PR c++/60336
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-x c" }
// { dg-additional-sources "empty14a.c" }
// { dg-prune-output "command line option" }
diff --git a/gcc/testsuite/g++.dg/abi/empty15.C b/gcc/testsuite/g++.dg/abi/empty15.C
index 507a0cd2345..7bb6055ef7c 100644
--- a/gcc/testsuite/g++.dg/abi/empty15.C
+++ b/gcc/testsuite/g++.dg/abi/empty15.C
@@ -1,5 +1,5 @@
// PR c++/60336
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-x c" }
// { dg-additional-sources "empty15a.c" }
// { dg-prune-output "command line option" }
diff --git a/gcc/testsuite/g++.dg/abi/empty16.C b/gcc/testsuite/g++.dg/abi/empty16.C
index 42705137475..a4e7870e14b 100644
--- a/gcc/testsuite/g++.dg/abi/empty16.C
+++ b/gcc/testsuite/g++.dg/abi/empty16.C
@@ -1,5 +1,5 @@
// PR c++/60336
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-x c" }
// { dg-additional-sources "empty16a.c" }
// { dg-prune-output "command line option" }
diff --git a/gcc/testsuite/g++.dg/abi/empty17.C b/gcc/testsuite/g++.dg/abi/empty17.C
index 472708365ac..bfcd7c915cd 100644
--- a/gcc/testsuite/g++.dg/abi/empty17.C
+++ b/gcc/testsuite/g++.dg/abi/empty17.C
@@ -1,5 +1,5 @@
// PR c++/60336
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-x c" }
// { dg-additional-sources "empty17a.c" }
// { dg-prune-output "command line option" }
diff --git a/gcc/testsuite/g++.dg/pr60336-1.C b/gcc/testsuite/g++.dg/pr60336-1.C
index af0863887a0..946f8accda2 100644
--- a/gcc/testsuite/g++.dg/pr60336-1.C
+++ b/gcc/testsuite/g++.dg/pr60336-1.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2 -std=c++11 -fno-pic" }
// { dg-require-effective-target fpic }
diff --git a/gcc/testsuite/g++.dg/pr60336-10.C b/gcc/testsuite/g++.dg/pr60336-10.C
index 6c9c990dad6..57707fca749 100644
--- a/gcc/testsuite/g++.dg/pr60336-10.C
+++ b/gcc/testsuite/g++.dg/pr60336-10.C
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
#include <stdarg.h>
diff --git a/gcc/testsuite/g++.dg/pr60336-11.C b/gcc/testsuite/g++.dg/pr60336-11.C
index c92f3d43a5b..32000b2ebe5 100644
--- a/gcc/testsuite/g++.dg/pr60336-11.C
+++ b/gcc/testsuite/g++.dg/pr60336-11.C
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
#include <stdarg.h>
diff --git a/gcc/testsuite/g++.dg/pr60336-12.C b/gcc/testsuite/g++.dg/pr60336-12.C
index 83a7bb0cfa0..febcc6fcf2e 100644
--- a/gcc/testsuite/g++.dg/pr60336-12.C
+++ b/gcc/testsuite/g++.dg/pr60336-12.C
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
#include <stdarg.h>
diff --git a/gcc/testsuite/g++.dg/pr60336-2.C b/gcc/testsuite/g++.dg/pr60336-2.C
index 386c82a68c4..8ec5bae7d77 100644
--- a/gcc/testsuite/g++.dg/pr60336-2.C
+++ b/gcc/testsuite/g++.dg/pr60336-2.C
@@ -1,4 +1,4 @@
-// { dg-do run }
+// { dg-do run { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
#include <stdarg.h>
diff --git a/gcc/testsuite/g++.dg/pr60336-3.C b/gcc/testsuite/g++.dg/pr60336-3.C
index 3afdc8d81ca..d39d84c96d7 100644
--- a/gcc/testsuite/g++.dg/pr60336-3.C
+++ b/gcc/testsuite/g++.dg/pr60336-3.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
struct dummy { struct{}__attribute__((aligned (4))) a[7]; };
diff --git a/gcc/testsuite/g++.dg/pr60336-5.C b/gcc/testsuite/g++.dg/pr60336-5.C
index b0c76ad5aa2..a051f6e6105 100644
--- a/gcc/testsuite/g++.dg/pr60336-5.C
+++ b/gcc/testsuite/g++.dg/pr60336-5.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2 -std=c++11 -fno-pic" }
// { dg-require-effective-target fpic }
diff --git a/gcc/testsuite/g++.dg/pr60336-6.C b/gcc/testsuite/g++.dg/pr60336-6.C
index 58796519334..22728d364fd 100644
--- a/gcc/testsuite/g++.dg/pr60336-6.C
+++ b/gcc/testsuite/g++.dg/pr60336-6.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2 -std=c++11 -fno-pic" }
// { dg-require-effective-target fpic }
diff --git a/gcc/testsuite/g++.dg/pr60336-7.C b/gcc/testsuite/g++.dg/pr60336-7.C
index 0e5d2ef2f11..5fc8320c7de 100644
--- a/gcc/testsuite/g++.dg/pr60336-7.C
+++ b/gcc/testsuite/g++.dg/pr60336-7.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2 -std=c++11 -fno-pic" }
// { dg-require-effective-target fpic }
diff --git a/gcc/testsuite/g++.dg/pr60336-8.C b/gcc/testsuite/g++.dg/pr60336-8.C
index e4487cf8f25..7b02039ef48 100644
--- a/gcc/testsuite/g++.dg/pr60336-8.C
+++ b/gcc/testsuite/g++.dg/pr60336-8.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2" }
struct dummy { struct{} a[7][3]; };
diff --git a/gcc/testsuite/g++.dg/pr60336-9.C b/gcc/testsuite/g++.dg/pr60336-9.C
index 4ad333f6b9c..3d768c06f14 100644
--- a/gcc/testsuite/g++.dg/pr60336-9.C
+++ b/gcc/testsuite/g++.dg/pr60336-9.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2 -std=c++11 -fno-pic" }
// { dg-require-effective-target fpic }
diff --git a/gcc/testsuite/g++.dg/pr68355.C b/gcc/testsuite/g++.dg/pr68355.C
index 1354fc497b5..5c2f0da3fd3 100644
--- a/gcc/testsuite/g++.dg/pr68355.C
+++ b/gcc/testsuite/g++.dg/pr68355.C
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-options "-O2 -std=c++11 -fno-pic" }
// { dg-require-effective-target fpic }