This patch adds a bit to tree_type_common (which still has plenty
of bits spare) to indicate whether the type has a measurable size
at the language level once fully-defined.

2018-10-15  Richard Sandiford  <richard.sandif...@arm.com>

gcc/
        * tree-core.h (tree_type_common::sizeless): New bitfield.
        (tree_type_common::spare): Reduce size by one bit.
        * tree.h (TYPE_SIZELESS_P): New macro.

gcc/c-family/
        * c-common.h (COMPLETE_TYPE_P): Check TYPE_SIZELESS_P.

Index: gcc/tree-core.h
===================================================================
--- gcc/tree-core.h     2018-10-05 13:46:11.195787561 +0100
+++ gcc/tree-core.h     2018-10-15 14:13:28.592266684 +0100
@@ -1534,7 +1534,8 @@ struct GTY(()) tree_type_common {
   unsigned warn_if_not_align : 6;
   unsigned typeless_storage : 1;
   unsigned empty_flag : 1;
-  unsigned spare : 17;
+  unsigned sizeless : 1;
+  unsigned spare : 16;
 
   alias_set_type alias_set;
   tree pointer_to;
Index: gcc/tree.h
===================================================================
--- gcc/tree.h  2018-10-15 14:13:18.280352163 +0100
+++ gcc/tree.h  2018-10-15 14:13:28.596266651 +0100
@@ -688,6 +688,13 @@ #define TRANSLATION_UNIT_WARN_EMPTY_P(NO
 /* Nonzero if this type is "empty" according to the particular psABI.  */
 #define TYPE_EMPTY_P(NODE) (TYPE_CHECK (NODE)->type_common.empty_flag)
 
+/* True if this type is "sizeless" according to the SVE extensions to
+   C and C++.  Sizeless types have no measurable size or alignment at
+   the language level, even when the types have been fully defined
+   (are "definite").  Size, alignment and layout are instead decided
+   by the ABI.  */
+#define TYPE_SIZELESS_P(NODE) (TYPE_CHECK (NODE)->type_common.sizeless)
+
 /* Used to indicate that this TYPE represents a compiler-generated entity.  */
 #define TYPE_ARTIFICIAL(NODE) (TYPE_CHECK (NODE)->base.nowarning_flag)
 
Index: gcc/c-family/c-common.h
===================================================================
--- gcc/c-family/c-common.h     2018-10-15 14:13:22.880314033 +0100
+++ gcc/c-family/c-common.h     2018-10-15 14:13:28.592266684 +0100
@@ -727,7 +727,8 @@ enum cxx_dialect {
 extern bool done_lexing;
 
 /* Nonzero if this type is a complete type.  */
-#define COMPLETE_TYPE_P(NODE) (TYPE_SIZE (NODE) != NULL_TREE)
+#define COMPLETE_TYPE_P(NODE) \
+  (TYPE_SIZE (NODE) != NULL_TREE && !TYPE_SIZELESS_P (NODE))
 
 /* C types are partitioned into three subsets: object, function, and
    incomplete types.  */

Reply via email to