aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Macleod <amacleod@redhat.com>2016-03-31 20:01:59 +0000
committerAndrew Macleod <amacleod@redhat.com>2016-03-31 20:01:59 +0000
commit651cc68a462733deb0801cbf31e3cc7a66e41a0d (patch)
tree4712b913c32e70dcd4cea7b9813ccfc88ad836da
parent7f101c18706e49ed734c343e84e961330918b17e (diff)
inline some *_TYPE_P checking routines to help identify ttype uses.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype-pro@234651 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ttype.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/gcc/ttype.h b/gcc/ttype.h
index f26b98e690c..3ffd6448978 100644
--- a/gcc/ttype.h
+++ b/gcc/ttype.h
@@ -244,5 +244,91 @@ any_integral_ttype_check (const ttype *__t, const char *__f, int __l,
#define DECL_BIT_FIELD_TYPE(NODE) \
(FIELD_DECL_CHECK (NODE)->u.field_decl_ttype.bit_field_type)
+/* ------------------------------------------------------------------------ */
+/* The remaining routines are simply macors that are redefined to be inline
+ functions which should only be called on types, so do the typechecking. */
+/* ------------------------------------------------------------------------ */
+#undef POINTER_TYPE_P
+inline bool
+POINTER_TYPE_P (const ttype *t)
+{
+ enum tree_code code = TREE_CODE (t);
+ return (code == POINTER_TYPE || code == REFERENCE_TYPE);
+}
+
+#undef FUNC_OR_METHOD_TYPE_P
+inline bool
+FUNC_OR_METHOD_TYPE_P (const ttype *t)
+{
+ enum tree_code code = TREE_CODE (t);
+ return (code == FUNCTION_TYPE || code == METHOD_TYPE);
+}
+
+#undef RECORD_OR_UNION_TYPE_P
+inline bool
+RECORD_OR_UNION_TYPE_P (const ttype *t)
+{
+ enum tree_code code = TREE_CODE (t);
+ return (code == RECORD_TYPE || code == UNION_TYPE || code == QUAL_UNION_TYPE);
+}
+
+#undef SCALAR_FLOAT_TYPE_P
+inline bool
+SCALAR_FLOAT_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == REAL_TYPE);
+}
+
+#undef FIXED_POINT_TYPE_P
+inline bool
+FIXED_POINT_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == FIXED_POINT_TYPE);
+}
+
+#undef VECTOR_TYPE_P
+inline bool
+VECTOR_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == VECTOR_TYPE);
+}
+
+#undef INTEGRAL_TYPE_P
+inline bool
+INTEGRAL_TYPE_P (const ttype *t)
+{
+ enum tree_code code = TREE_CODE (t);
+ return (code == ENUMERAL_TYPE || code == BOOLEAN_TYPE
+ || code == INTEGER_TYPE);
+}
+
+#undef COMPLEX_FLOAT_TYPE_P
+inline bool
+COMPLEX_FLOAT_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == COMPLEX_TYPE && SCALAR_FLOAT_TYPE_P (TREE_TYPE (t)));
+}
+
+#undef POINTER_BOUNDS_TYPE_P
+inline bool
+POINTER_BOUNDS_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == POINTER_BOUNDS_TYPE);
+}
+
+#undef VOID_TYPE_P
+inline bool
+VOID_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == VOID_TYPE);
+}
+
+#undef VECTOR_BOOLEAN_TYPE_P
+inline bool
+VECTOR_BOOLEAN_TYPE_P (const ttype *t)
+{
+ return (TREE_CODE (t) == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (t)) == BOOLEAN_TYPE);
+}
#endif