diff options
Diffstat (limited to 'gcc/et-forest.c')
-rw-r--r-- | gcc/et-forest.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/et-forest.c b/gcc/et-forest.c index b8e55274109..b9dacc9b3e3 100644 --- a/gcc/et-forest.c +++ b/gcc/et-forest.c @@ -747,3 +747,20 @@ et_below (struct et_node *down, struct et_node *up) return !d->next || d->next->min + d->depth >= 0; } + +/* Returns the root of the tree that contains NODE. */ + +struct et_node * +et_root (struct et_node *node) +{ + struct et_occ *occ = node->rightmost_occ, *r; + + /* The root of the tree corresponds to the rightmost occurence in the + represented path. */ + et_splay (occ); + for (r = occ; r->next; r = r->next) + continue; + et_splay (r); + + return r->of; +} |