aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2004-11-12 21:18:54 -0700
committerJeff Law <law@gcc.gnu.org>2004-11-12 21:18:54 -0700
commit92b6dff30288af56b6373689489a69d7e02f4193 (patch)
treef0bf0eacf8ffa54f821595a192ad4a94667a8d45 /gcc/tree.c
parent2256aa1cff25a0ea9c5b699795a773a93f11f565 (diff)
downloadgcc-92b6dff30288af56b6373689489a69d7e02f4193.zip
gcc-92b6dff30288af56b6373689489a69d7e02f4193.tar.gz
gcc-92b6dff30288af56b6373689489a69d7e02f4193.tar.bz2
tree-cfg.c (hashtab.h): Include.
* tree-cfg.c (hashtab.h): Include. (struct edge_to_case_leader_elt): New structure. (edge_to_case_leader): New. (edge_to_case_leader_hash): New hashtable hasing function. (edge_to_case_leader_eq): New hashtable equality function. (record_switch_edge): New function. (get_case_leader_for_edge, get_case_leader_for_edge): New functions. (make_switch_expr_edges): Build the edge-to-case-leader hash table. Tear down the hash table when we're done. (cleanup_dead_labels): Use CASE_LEADER_OR_LABEL instead of CASE_LABEL. (tree_node_can_be_shared): Allow sharing of CASE_LABEL_EXPR nodes. (tree_redirect_edge_and_branch, case SWITCH_EXPR): Update to use new concept of case leaders to reduce overhead of redirecting outgoing edges from switch statements. * tree.c (get_case_label): New function. * tree.h (CASE_LABEL): Define in terms of get_case_label. (CASE_LEADER_OR_LABEL): Define. From-SVN: r90570
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 97adffa..8774107 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -6061,4 +6061,17 @@ signed_type_for (tree type)
return lang_hooks.types.signed_type (type);
}
+/* Return the LABEL_DECL associated with T, which must be a
+ CASE_LABEL_EXPR. This will walk through any CASE_LABEL_EXPRs
+ appearing in operand 2 until it finds a CASE_LABEL_EXPR with
+ a LABEL_DECL in operand 2. */
+
+tree
+get_case_label (tree t)
+{
+ while (TREE_CODE (CASE_LEADER_OR_LABEL (t)) == CASE_LABEL_EXPR)
+ t = CASE_LEADER_OR_LABEL (t);
+ return CASE_LEADER_OR_LABEL (t);
+}
+
#include "gt-tree.h"