+/* Return true if the debug information for the given type should be
+ emitted as a subrange type. */
+
+static inline bool
+is_ada_subrange_type (type)
+ tree type;
+{
+ /* We do this for INTEGER_TYPEs that have names, parent types, and when
+ we are compiling Ada code. */
+ return (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_NAME (type) != 0 && TREE_TYPE (type) != 0
+ && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE
+ && TREE_UNSIGNED (TREE_TYPE (type)) && is_ada ());
+}
+
+/* Given a pointer to a tree node for a subrange type, return a pointer
+ to a DIE that describes the given type. */
+
+static dw_die_ref
+subrange_type_die (type)
+ tree type;
+{
+ dw_die_ref subtype_die;
+ dw_die_ref subrange_die;
+ tree name = TYPE_NAME (type);
+
+ subtype_die = base_type_die (TREE_TYPE (type));
+
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+
+ subrange_die = new_die (DW_TAG_subrange_type, comp_unit_die, type);
+ add_name_attribute (subrange_die, IDENTIFIER_POINTER (name));
+ if (TYPE_MIN_VALUE (type) != NULL)
+ add_bound_info (subrange_die, DW_AT_lower_bound,
+ TYPE_MIN_VALUE (type));
+ if (TYPE_MAX_VALUE (type) != NULL)
+ add_bound_info (subrange_die, DW_AT_upper_bound,
+ TYPE_MAX_VALUE (type));
+ add_AT_die_ref (subrange_die, DW_AT_type, subtype_die);
+
+ return subrange_die;
+}
+