aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/ada-tree.h
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-02-27 10:41:10 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-02-27 10:41:10 +0000
commita0b8b1b736253f14044ba9d87cb435426915a90b (patch)
treebf702654748c8ce1cea4e17b381a5fe5c9856517 /gcc/ada/gcc-interface/ada-tree.h
parent184d436af490f910a2cbed4b6f40a4b9bc6b76c2 (diff)
downloadgcc-a0b8b1b736253f14044ba9d87cb435426915a90b.zip
gcc-a0b8b1b736253f14044ba9d87cb435426915a90b.tar.gz
gcc-a0b8b1b736253f14044ba9d87cb435426915a90b.tar.bz2
ada-tree.h (TYPE_PACKED_ARRAY_TYPE_P): Add checking.
* gcc-interface/ada-tree.h (TYPE_PACKED_ARRAY_TYPE_P): Add checking. (TYPE_BY_REFERENCE_P): New flag. (TYPE_IS_BY_REFERENCE_P): New macro. (TYPE_DUMMY_P): Add checking and remove VOID_TYPE. (TYPE_IS_DUMMY_P): Adjust for above change. * gcc-interface/decl.c (gnat_to_gnu_entity): Use TYPE_BY_REFERENCE_P and TYPE_IS_BY_REFERENCE_P instead of TREE_ADDRESSABLE. (gnat_to_gnu_param): Likewise. (maybe_pad_type): Likewise. (make_type_from_size): Use TYPE_IS_PACKED_ARRAY_TYPE_P. * gcc-interface/misc.c (must_pass_by_ref): Use TYPE_IS_BY_REFERENCE_P instead of TREE_ADDRESSABLE. * gcc-interface/trans.c (finalize_nrv): Likewise. (call_to_gnu): Likewise. Do not create a temporary for return values with by-reference type here. (gnat_to_gnu): Test TYPE_IS_DUMMY_P instead of TYPE_DUMMY_P. (gnat_gimplify_expr) <ADDR_EXPR>: Don't do anything for non-constant CONSTRUCTORs and calls. * gcc-interface/utils.c (make_dummy_type): Get the equivalent type of the underlying type and use it throughout. Use TYPE_IS_BY_REFERENCE_P instead of TREE_ADDRESSABLE. * gcc-interface/utils2.c (build_cond_expr): Deal with by-reference types explicitly. From-SVN: r184594
Diffstat (limited to 'gcc/ada/gcc-interface/ada-tree.h')
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index 0c32f21..9a48ed7 100644
--- a/gcc/ada/gcc-interface/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -80,7 +80,8 @@ do { \
/* For integral types and array types, nonzero if this is a packed array type
used for bit-packed types. Such types should not be extended to a larger
size or validated against a specified size. */
-#define TYPE_PACKED_ARRAY_TYPE_P(NODE) TYPE_LANG_FLAG_0 (NODE)
+#define TYPE_PACKED_ARRAY_TYPE_P(NODE) \
+ TYPE_LANG_FLAG_0 (TREE_CHECK2 (NODE, INTEGER_TYPE, ARRAY_TYPE))
#define TYPE_IS_PACKED_ARRAY_TYPE_P(NODE) \
((TREE_CODE (NODE) == INTEGER_TYPE || TREE_CODE (NODE) == ARRAY_TYPE) \
@@ -108,6 +109,21 @@ do { \
front-end. */
#define TYPE_EXTRA_SUBTYPE_P(NODE) TYPE_LANG_FLAG_2 (INTEGER_TYPE_CHECK (NODE))
+/* Nonzero for an aggregate type if this is a by-reference type. We also
+ set this on an ENUMERAL_TYPE that is dummy. */
+#define TYPE_BY_REFERENCE_P(NODE) \
+ TYPE_LANG_FLAG_2 (TREE_CHECK5 (NODE, RECORD_TYPE, UNION_TYPE, \
+ ARRAY_TYPE, UNCONSTRAINED_ARRAY_TYPE, \
+ ENUMERAL_TYPE))
+
+#define TYPE_IS_BY_REFERENCE_P(NODE) \
+ ((TREE_CODE (NODE) == RECORD_TYPE \
+ || TREE_CODE (NODE) == UNION_TYPE \
+ || TREE_CODE (NODE) == ARRAY_TYPE \
+ || TREE_CODE (NODE) == UNCONSTRAINED_ARRAY_TYPE \
+ || TREE_CODE (NODE) == ENUMERAL_TYPE) \
+ && TYPE_BY_REFERENCE_P (NODE))
+
/* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is the
type for an object whose type includes its template in addition to
its value (only true for RECORD_TYPE). */
@@ -144,13 +160,15 @@ do { \
#define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \
TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE))
-/* For VOID_TYPE, ENUMERAL_TYPE, UNION_TYPE, and RECORD_TYPE, nonzero if this
- is a dummy type, made to correspond to a private or incomplete type. */
-#define TYPE_DUMMY_P(NODE) TYPE_LANG_FLAG_4 (NODE)
+/* For RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE, nonzero if this is a dummy
+ type, made to correspond to a private or incomplete type. */
+#define TYPE_DUMMY_P(NODE) \
+ TYPE_LANG_FLAG_4 (TREE_CHECK3 (NODE, RECORD_TYPE, UNION_TYPE, ENUMERAL_TYPE))
-#define TYPE_IS_DUMMY_P(NODE) \
- ((TREE_CODE (NODE) == VOID_TYPE || TREE_CODE (NODE) == RECORD_TYPE \
- || TREE_CODE (NODE) == UNION_TYPE || TREE_CODE (NODE) == ENUMERAL_TYPE) \
+#define TYPE_IS_DUMMY_P(NODE) \
+ ((TREE_CODE (NODE) == RECORD_TYPE \
+ || TREE_CODE (NODE) == UNION_TYPE \
+ || TREE_CODE (NODE) == ENUMERAL_TYPE) \
&& TYPE_DUMMY_P (NODE))
/* For an INTEGER_TYPE, nonzero if TYPE_ACTUAL_BOUNDS is present. */
@@ -167,7 +185,7 @@ do { \
/* True if TYPE can alias any other types. */
#define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE)
-/* In an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
+/* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
template and the object.
??? We also put this on an ENUMERAL_TYPE that is dummy. Technically,