aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-26 18:50:15 +0000
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-26 18:50:15 +0000
commit9fcf0efa849aea68d21ce2df3d81c7fa6e9731dc (patch)
tree812a8a9ec4bd14f4044735e752fbb82a24c920e7
parent0402522d37f28b19686271e5e33fefcefb7e6384 (diff)
fortran front end global_trees changes plus some cp files
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype2@220129 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/lex.c4
-rw-r--r--gcc/cp/tree.c32
-rw-r--r--gcc/fortran/gfortran.h1
-rw-r--r--gcc/fortran/trans-types.c43
-rw-r--r--gcc/fortran/trans-types.h2
-rw-r--r--gcc/fortran/trans.h2
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.c4
-rw-r--r--gcc/langhooks.h2
-rw-r--r--gcc/tree-core.h3
-rw-r--r--gcc/tree.c15
-rw-r--r--gcc/tree.h7
13 files changed, 70 insertions, 49 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 3f284811eb8..0b434d50499 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -5617,7 +5617,7 @@ extern tree build_lang_decl_loc (location_t, enum tree_code, tree, tree);
extern void retrofit_lang_decl (tree);
extern tree copy_decl (tree);
extern tree copy_type (tree);
-extern tree cxx_make_type (enum tree_code);
+extern ttype *cxx_make_type (enum tree_code);
extern tree make_class_type (enum tree_code);
extern bool cxx_init (void);
extern void cxx_finish (void);
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 63f9f4dbcec..dc15d8116a4 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -676,10 +676,10 @@ copy_type (tree type)
return copy;
}
-tree
+ttype *
cxx_make_type (enum tree_code code)
{
- tree t = make_node (code);
+ ttype *t = make_type_node (code);
/* Create lang_type structure. */
if (RECORD_OR_UNION_CODE_P (code)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 961182b01b9..2e2a51969df 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -741,22 +741,22 @@ rvalue (tree expr)
struct cplus_array_info
{
- tree type;
+ ttype *type;
tree domain;
};
-struct cplus_array_hasher : ggc_hasher<tree>
+struct cplus_array_hasher : ggc_hasher<ttype *>
{
typedef cplus_array_info *compare_type;
- static hashval_t hash (tree t);
- static bool equal (tree, cplus_array_info *);
+ static hashval_t hash (ttype *t);
+ static bool equal (ttype *, cplus_array_info *);
};
/* Hash an ARRAY_TYPE. K is really of type `tree'. */
hashval_t
-cplus_array_hasher::hash (tree t)
+cplus_array_hasher::hash (ttype *t)
{
hashval_t hash;
@@ -770,9 +770,9 @@ cplus_array_hasher::hash (tree t)
of type `cplus_array_info*'. */
bool
-cplus_array_hasher::equal (tree t1, cplus_array_info *t2)
+cplus_array_hasher::equal (ttype *t1, cplus_array_info *t2)
{
- return (TREE_TYPE (t1) == t2->type && TYPE_DOMAIN (t1) == t2->domain);
+ return (TREE_TTYPE (t1) == t2->type && TYPE_DOMAIN (t1) == t2->domain);
}
/* Hash table containing dependent array types, which are unsuitable for
@@ -781,10 +781,10 @@ static GTY (()) hash_table<cplus_array_hasher> *cplus_array_htab;
/* Build an ARRAY_TYPE without laying it out. */
-static tree
+static ttype *
build_min_array_type (tree elt_type, tree index_type)
{
- tree t = cxx_make_type (ARRAY_TYPE);
+ ttype *t = cxx_make_type (ARRAY_TYPE);
TREE_TYPE (t) = elt_type;
TYPE_DOMAIN (t) = index_type;
return t;
@@ -817,7 +817,7 @@ set_array_type_canon (tree t, tree elt_type, tree index_type)
ttype *
build_cplus_array_type (tree elt_type, tree index_type)
{
- tree t;
+ ttype *t;
if (elt_type == error_mark_node || index_type == error_mark_node)
return error_type_node;
@@ -844,13 +844,13 @@ build_cplus_array_type (tree elt_type, tree index_type)
hash = TYPE_UID (elt_type);
if (index_type)
hash ^= TYPE_UID (index_type);
- cai.type = elt_type;
+ cai.type = TTYPE (elt_type);
cai.domain = index_type;
- tree *e = cplus_array_htab->find_slot_with_hash (&cai, hash, INSERT);
+ ttype **e = cplus_array_htab->find_slot_with_hash (&cai, hash, INSERT);
if (*e)
/* We have found the type: we're done. */
- return TTYPE (*e);
+ return *e;
else
{
/* Build a new array type. */
@@ -871,8 +871,8 @@ build_cplus_array_type (tree elt_type, tree index_type)
/* Now check whether we already have this array variant. */
if (elt_type != TYPE_MAIN_VARIANT (elt_type))
{
- tree m = t;
- for (t = m; t; t = TYPE_NEXT_VARIANT (t))
+ ttype *m = t;
+ for (t = m; t; t = TTYPE (TYPE_NEXT_VARIANT (t)))
if (TREE_TYPE (t) == elt_type
&& TYPE_NAME (t) == NULL_TREE
&& TYPE_ATTRIBUTES (t) == NULL_TREE)
@@ -915,7 +915,7 @@ build_cplus_array_type (tree elt_type, tree index_type)
}
}
- return TTYPE (t);
+ return t;
}
/* Return an ARRAY_TYPE with element type ELT and length N. */
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index cc3051297ea..257851e1eb7 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1480,6 +1480,7 @@ typedef struct gfc_symbol
}
gfc_symbol;
+#define BACKEND_TYPE(SYM) (as_a<ttype *> ((SYM)->backend_decl))
struct gfc_undo_change_set
{
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 030d95aa6a2..fa8f229a11f 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1825,8 +1825,8 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
enum gfc_array_kind akind, bool restricted)
{
char name[8 + 2*GFC_RANK_DIGITS + 1 + GFC_MAX_SYMBOL_LEN];
- tree base_type, arraytype, lower, upper, stride, tmp, rtype;
- ttype *fat_type;
+ tree base_type, lower, upper, stride, tmp, rtype;
+ ttype *fat_type, *arraytype;
const char *type_name;
int n;
@@ -1956,16 +1956,16 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound,
/* Build a pointer type. This function is called from gfc_sym_type(). */
static ttype *
-gfc_build_pointer_type (gfc_symbol * sym, tree type)
+gfc_build_pointer_type (gfc_symbol * sym, ttype *type)
{
/* Array pointer types aren't actually pointers. */
if (sym->attr.dimension)
- return TTYPE (type);
+ return type;
else
return build_pointer_type (type);
}
-static ttype *gfc_nonrestricted_type (tree t);
+static ttype *gfc_nonrestricted_type (ttype *t);
/* Given two record or union type nodes TO and FROM, ensure
that all fields in FROM have a corresponding field in TO,
their type being nonrestrict variants. This accepts a TO
@@ -2004,7 +2004,7 @@ mirror_fields (tree to, tree from)
if (TREE_CODE (ffrom) == FIELD_DECL)
{
- tree elemtype = gfc_nonrestricted_type (TREE_TYPE (ffrom));
+ tree elemtype = gfc_nonrestricted_type (TREE_TTYPE (ffrom));
TREE_TYPE (newfield) = elemtype;
}
}
@@ -2015,9 +2015,9 @@ mirror_fields (tree to, tree from)
except that all types it refers to (recursively) are always
non-restrict qualified types. */
static ttype *
-gfc_nonrestricted_type (tree t)
+gfc_nonrestricted_type (ttype *t)
{
- ttype *ret = TTYPE (t);
+ ttype *ret = t;
/* If the type isn't laid out yet, don't copy it. If something
needs it for real it should wait until the type got finished. */
@@ -2048,7 +2048,7 @@ gfc_nonrestricted_type (tree t)
case POINTER_TYPE:
case REFERENCE_TYPE:
{
- tree totype = gfc_nonrestricted_type (TREE_TYPE (t));
+ tree totype = gfc_nonrestricted_type (TREE_TTYPE (t));
if (totype == TREE_TYPE (t))
;
else if (TREE_CODE (t) == POINTER_TYPE)
@@ -2062,7 +2062,7 @@ gfc_nonrestricted_type (tree t)
case ARRAY_TYPE:
{
- tree elemtype = gfc_nonrestricted_type (TREE_TYPE (t));
+ tree elemtype = gfc_nonrestricted_type (TREE_TTYPE (t));
if (elemtype == TREE_TYPE (t))
;
else
@@ -2072,7 +2072,7 @@ gfc_nonrestricted_type (tree t)
if (TYPE_LANG_SPECIFIC (t)
&& GFC_TYPE_ARRAY_DATAPTR_TYPE (t))
{
- tree dataptr_type = GFC_TYPE_ARRAY_DATAPTR_TYPE (t);
+ ttype *dataptr_type = GFC_TYPE_ARRAY_DATAPTR_TYPE (t);
dataptr_type = gfc_nonrestricted_type (dataptr_type);
if (dataptr_type != GFC_TYPE_ARRAY_DATAPTR_TYPE (t))
{
@@ -2104,7 +2104,7 @@ gfc_nonrestricted_type (tree t)
for (field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL)
{
- tree elemtype = gfc_nonrestricted_type (TREE_TYPE (field));
+ ttype *elemtype = gfc_nonrestricted_type (TREE_TTYPE (field));
if (elemtype != TREE_TYPE (field))
break;
}
@@ -2341,10 +2341,10 @@ gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to,
/* Build a tree node for a procedure pointer component. */
-tree
+ttype *
gfc_get_ppc_type (gfc_component* c)
{
- tree t;
+ ttype *t;
/* Explicit interface. */
if (c->attr.if_source != IFSRC_UNKNOWN && c->ts.interface)
@@ -2368,7 +2368,8 @@ gfc_get_ppc_type (gfc_component* c)
ttype *
gfc_get_derived_type (gfc_symbol * derived)
{
- tree typenode = NULL, field = NULL, field_type = NULL;
+ tree typenode = NULL, field = NULL;
+ ttype *field_type = NULL;
tree canonical = NULL_TREE;
tree *chain = NULL;
bool got_canonical = false;
@@ -2388,7 +2389,7 @@ gfc_get_derived_type (gfc_symbol * derived)
if (derived->attr.is_iso_c == 1 || derived->ts.f90_type == BT_VOID)
{
if (derived->backend_decl)
- return TTYPE (derived->backend_decl);
+ return BACKEND_TYPE (derived);
if (derived->intmod_sym_id == ISOCBINDING_PTR)
derived->backend_decl = ptr_type_node;
@@ -2402,7 +2403,7 @@ gfc_get_derived_type (gfc_symbol * derived)
iso_c_binding derived types. */
derived->ts.f90_type = BT_VOID;
- return TTYPE (derived->backend_decl);
+ return BACKEND_TYPE (derived);
}
/* If use associated, use the module type for this one. */
@@ -2451,7 +2452,7 @@ gfc_get_derived_type (gfc_symbol * derived)
pointer component. */
if (TYPE_FIELDS (derived->backend_decl)
|| derived->attr.proc_pointer_comp)
- return TTYPE (derived->backend_decl);
+ return BACKEND_TYPE (derived);
else
typenode = derived->backend_decl;
}
@@ -2503,7 +2504,7 @@ gfc_get_derived_type (gfc_symbol * derived)
}
if (TYPE_FIELDS (derived->backend_decl))
- return TTYPE (derived->backend_decl);
+ return BACKEND_TYPE (derived);
/* Build the type member list. Install the newly created RECORD_TYPE
node as DECL_CONTEXT of each FIELD_DECL. */
@@ -2512,7 +2513,7 @@ gfc_get_derived_type (gfc_symbol * derived)
if (c->attr.proc_pointer)
field_type = gfc_get_ppc_type (c);
else if (c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS)
- field_type = c->ts.u.derived->backend_decl;
+ field_type = BACKEND_TYPE (c->ts.u.derived);
else
{
if (c->ts.type == BT_CHARACTER && !c->ts.deferred)
@@ -2618,7 +2619,7 @@ copy_derived_types:
for (dt = gfc_derived_types; dt; dt = dt->next)
gfc_copy_dt_decls_ifequal (derived, dt->derived, false);
- return TTYPE (derived->backend_decl);
+ return BACKEND_TYPE (derived);
}
diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h
index 0209fe1d642..55f110178c9 100644
--- a/gcc/fortran/trans-types.h
+++ b/gcc/fortran/trans-types.h
@@ -100,7 +100,7 @@ int gfc_is_nodesc_array (gfc_symbol *);
tree gfc_get_dtype_rank_type (int, tree);
tree gfc_get_dtype (tree);
-tree gfc_get_ppc_type (gfc_component *);
+ttype *gfc_get_ppc_type (gfc_component *);
tree gfc_get_caf_vector_type (int dim);
#endif
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 9d90845fda3..d5836262b5a 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -838,7 +838,7 @@ struct GTY(()) lang_type {
tree size;
tree offset;
tree dtype;
- tree dataptr_type;
+ ttype *dataptr_type;
tree span;
tree base_decl[2];
ttype *nonrestricted_type;
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 303b4b60ee8..adfe8bae6a6 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -140,7 +140,7 @@ extern bool lhd_omp_mappable_type (tree);
/* Tree dump hooks. */
extern bool lhd_tree_dump_dump_tree (void *, tree);
extern int lhd_tree_dump_type_quals (const_tree);
-extern tree lhd_make_node (enum tree_code);
+extern ttype *lhd_make_node (enum tree_code);
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree
#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index f68c81cf8c8..63a66427931 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -499,10 +499,10 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
}
}
-tree
+ttype *
lhd_make_node (enum tree_code code)
{
- return make_node (code);
+ return make_type_node (code);
}
HOST_WIDE_INT
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 17c903f88c6..ee1dd2a2c88 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -60,7 +60,7 @@ struct lang_hooks_for_types
{
/* Return a new type (with the indicated CODE), doing whatever
language-specific processing is required. */
- tree (*make_type) (enum tree_code);
+ ttype *(*make_type) (enum tree_code);
/* Return what kind of RECORD_TYPE this is, mainly for purposes of
debug information. If not defined, record types are assumed to
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 1415e3e8563..3c83c1d24f7 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -1734,6 +1734,9 @@ struct GTY ((ptr_alias (union lang_tree_node), desc("0"), tag("0"))) tree_node {
class GTY((ptr_alias (union lang_tree_node))) ttype : public tree_node {
};
+extern void gt_ggc_mx (class ttype *&);
+extern void gt_pch_nx (class ttype *&);
+
/* Structure describing an attribute and a function to handle it. */
struct attribute_spec {
/* The name of the attribute (without any leading or trailing __),
diff --git a/gcc/tree.c b/gcc/tree.c
index dd22652eb58..0fbc18caa9a 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -12419,4 +12419,19 @@ element_mode (const_tree t)
return TYPE_MODE (t);
}
+void gt_ggc_mx (class ttype *& x)
+{
+// extern void gt_ggc_mx_lang_tree_node (void *);
+ if (x)
+ gt_ggc_mx_lang_tree_node ((void *) x);
+}
+
+void gt_pch_nx (class ttype *& x)
+{
+// extern void gt_pch_nx_lang_tree_node (void *);
+ if (x)
+ gt_pch_nx_lang_tree_node ((void *) x);
+}
+
+
#include "gt-tree.h"
diff --git a/gcc/tree.h b/gcc/tree.h
index 2a6908d07e3..3b330767e26 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4996,10 +4996,11 @@ is_a_helper <ttype *>::test (tree t)
static inline ttype *TTYPE (tree t)
{
- if (t != error_mark_node)
- return as_a <ttype *>(t);
- else
+ if (t == NULL_TREE)
+ return NULL;
+ if (t == error_mark_node)
return error_type_node;
+ return as_a <ttype *>(t);
}
ttype *TTYPE (ttype *t) __attribute__((error(" Fix use of TTYPE(ttype *)"))) ;