From 6f312d18d4788838bbd51c409a29b11ad8ccf009 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sat, 22 May 2004 18:16:39 +0000 Subject: [PATCH] [multiple changes] 2004-05-22 Andrew Pinski * c-common.c (c_common_truthvalue_conversion): Handle UNEQ_EXPR, UNLE_EXPR, UNGE_EXPR, UNLT_EXPR, UNGT_EXPR, ORDERED_EXPR, and UNORDERED_EXPR as comparison operators, i.e. set the type to truthvalue_type_node and return. 2004-05-22 Zack Weinberg * tree.h (struct tree_decl): Add possibly_inlined bit. (DECL_POSSIBLY_INLINED): New accessor macro. * cgraph.h: Remove declaration of cgraph_inline_hash. * cgraph.c: Remove definition of cgraph_inline_hash. (hash_node): Revert to hashing DECL_UID. (eq_node): Take two pointers to cgraph_node structures. Compare DECL_UIDs. (cgraph_remove_node): Pass the node directly to htab_find_slot. (cgraph_varpool_hash_node): Rename hash_varpool_node; hash on DECL_UID. (eq_cgraph_varpool_node): Rename eq_varpool_node; take two pointers to cgraph_varpool_node structures; compare DECL_UIDs. (cgraph_node): Allocate a temporary node on the stack, fill in its DECL field, and pass that to htab_find_slot. (cgraph_varpool_node): Likewise. (cgraph_function_possibly_inlined_p): If global info is ready, return the DECL_POSSIBLY_INLINED bit. * cgraphunit.c (cgraph_mark_inline_edge): Set DECL_POSSIBLY_INLINED instead of mucking with cgraph_inline_hash. From-SVN: r82140 --- gcc/ChangeLog | 29 ++++++++++++++++++++++++++++ gcc/c-common.c | 6 ++++-- gcc/cgraph.c | 50 +++++++++++++++++++++--------------------------- gcc/cgraph.h | 2 -- gcc/cgraphunit.c | 9 +-------- gcc/tree.h | 9 ++++++++- 6 files changed, 64 insertions(+), 41 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 722b3cdbb45..2acb431be3d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2004-05-22 Andrew Pinski + + * c-common.c (c_common_truthvalue_conversion): Handle + UNEQ_EXPR, UNLE_EXPR, UNGE_EXPR, UNLT_EXPR, UNGT_EXPR, + ORDERED_EXPR, and UNORDERED_EXPR as comparison operators, + i.e. set the type to truthvalue_type_node and return. + +2004-05-22 Zack Weinberg + + * tree.h (struct tree_decl): Add possibly_inlined bit. + (DECL_POSSIBLY_INLINED): New accessor macro. + * cgraph.h: Remove declaration of cgraph_inline_hash. + * cgraph.c: Remove definition of cgraph_inline_hash. + (hash_node): Revert to hashing DECL_UID. + (eq_node): Take two pointers to cgraph_node structures. + Compare DECL_UIDs. + (cgraph_remove_node): Pass the node directly to htab_find_slot. + (cgraph_varpool_hash_node): Rename hash_varpool_node; + hash on DECL_UID. + (eq_cgraph_varpool_node): Rename eq_varpool_node; take two + pointers to cgraph_varpool_node structures; compare DECL_UIDs. + (cgraph_node): Allocate a temporary node on the stack, fill in + its DECL field, and pass that to htab_find_slot. + (cgraph_varpool_node): Likewise. + (cgraph_function_possibly_inlined_p): If global info is ready, + return the DECL_POSSIBLY_INLINED bit. + * cgraphunit.c (cgraph_mark_inline_edge): Set DECL_POSSIBLY_INLINED + instead of mucking with cgraph_inline_hash. + 2004-05-22 Joseph S. Myers * doc/contrib.texi: Add g77 contributors. diff --git a/gcc/c-common.c b/gcc/c-common.c index 2716707b0aa..afd91827c9d 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2582,8 +2582,10 @@ c_common_truthvalue_conversion (tree expr) switch (TREE_CODE (expr)) { - case EQ_EXPR: - case NE_EXPR: case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR: + case EQ_EXPR: case NE_EXPR: case UNEQ_EXPR: + case LE_EXPR: case GE_EXPR: case LT_EXPR: case GT_EXPR: + case UNLE_EXPR: case UNGE_EXPR: case UNLT_EXPR: case UNGT_EXPR: + case ORDERED_EXPR: case UNORDERED_EXPR: case TRUTH_ANDIF_EXPR: case TRUTH_ORIF_EXPR: case TRUTH_AND_EXPR: diff --git a/gcc/cgraph.c b/gcc/cgraph.c index a1f137af60e..37008e2df7d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -99,11 +99,6 @@ The varpool data structure: /* Hash table used to convert declarations into nodes. */ static GTY((param_is (struct cgraph_node))) htab_t cgraph_hash; -/* We destructively update the callgraph during inlining, thus we need to - keep a separate table with information on whether inlining happened. - ??? Do this with a bit in the DECL instead of a hash table. */ -htab_t cgraph_inline_hash; - /* The linked list of cgraph nodes. */ struct cgraph_node *cgraph_nodes; @@ -139,7 +134,8 @@ static int eq_node (const void *, const void *); static hashval_t hash_node (const void *p) { - return htab_hash_pointer (((struct cgraph_node *) p)->decl); + const struct cgraph_node *n = p; + return (hashval_t) DECL_UID (n->decl); } /* Returns nonzero if P1 and P2 are equal. */ @@ -147,7 +143,8 @@ hash_node (const void *p) static int eq_node (const void *p1, const void *p2) { - return (void *)((struct cgraph_node *) p1)->decl == p2; + const struct cgraph_node *n1 = p1, *n2 = p2; + return DECL_UID (n1->decl) == DECL_UID (n2->decl); } /* Allocate new callgraph node and insert it into basic data structures. */ @@ -171,8 +168,7 @@ cgraph_create_node (void) struct cgraph_node * cgraph_node (tree decl) { - struct cgraph_node *node; - struct cgraph_node **slot; + struct cgraph_node key, *node, **slot; if (TREE_CODE (decl) != FUNCTION_DECL) abort (); @@ -180,9 +176,10 @@ cgraph_node (tree decl) if (!cgraph_hash) cgraph_hash = htab_create_ggc (10, hash_node, eq_node, NULL); - slot = (struct cgraph_node **) - htab_find_slot_with_hash (cgraph_hash, decl, - htab_hash_pointer (decl), INSERT); + key.decl = decl; + + slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT); + if (*slot) return *slot; @@ -323,9 +320,7 @@ cgraph_remove_node (struct cgraph_node *node) cgraph_nodes = node->next; if (node->next) node->next->previous = node->previous; - slot = - htab_find_slot_with_hash (cgraph_hash, node->decl, - htab_hash_pointer (node->decl), NO_INSERT); + slot = htab_find_slot (cgraph_hash, node, NO_INSERT); if (*slot == node) { if (node->next_clone) @@ -526,35 +521,36 @@ dump_cgraph (FILE *f) /* Returns a hash code for P. */ static hashval_t -cgraph_varpool_hash_node (const void *p) +hash_varpool_node (const void *p) { - return htab_hash_pointer (((struct cgraph_varpool_node *) p)->decl); + const struct cgraph_varpool_node *n = p; + return (hashval_t) DECL_UID (n->decl); } /* Returns nonzero if P1 and P2 are equal. */ static int -eq_cgraph_varpool_node (const void *p1, const void *p2) +eq_varpool_node (const void *p1, const void *p2) { - return (void *)((struct cgraph_varpool_node *) p1)->decl == p2; + const struct cgraph_varpool_node *n1 = p1, *n2 = p2; + return DECL_UID (n1->decl) == DECL_UID (n2->decl); } /* Return cgraph_varpool node assigned to DECL. Create new one when needed. */ struct cgraph_varpool_node * cgraph_varpool_node (tree decl) { - struct cgraph_varpool_node *node; - struct cgraph_varpool_node **slot; + struct cgraph_varpool_node key, *node, **slot; if (!DECL_P (decl) || TREE_CODE (decl) == FUNCTION_DECL) abort (); if (!cgraph_varpool_hash) - cgraph_varpool_hash = htab_create_ggc (10, cgraph_varpool_hash_node, - eq_cgraph_varpool_node, NULL); + cgraph_varpool_hash = htab_create_ggc (10, hash_varpool_node, + eq_varpool_node, NULL); + key.decl = decl; slot = (struct cgraph_varpool_node **) - htab_find_slot_with_hash (cgraph_varpool_hash, decl, - htab_hash_pointer (decl), INSERT); + htab_find_slot (cgraph_varpool_hash, &key, INSERT); if (*slot) return *slot; node = ggc_alloc_cleared (sizeof (*node)); @@ -657,9 +653,7 @@ cgraph_function_possibly_inlined_p (tree decl) { if (!cgraph_global_info_ready) return (DECL_INLINE (decl) && !flag_really_no_inline); - if (!cgraph_inline_hash) - return false; - return (htab_find_slot (cgraph_inline_hash, decl, NO_INSERT) != NULL); + return DECL_POSSIBLY_INLINED (decl); } /* Create clone of E in the node N represented by CALL_EXPR the callgraph. */ diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 35302790783..ed114cbbeec 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -151,8 +151,6 @@ extern FILE *cgraph_dump_file; extern GTY(()) int cgraph_varpool_n_nodes; extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue; -extern GTY((param_is (union tree_node))) htab_t cgraph_inline_hash; - /* In cgraph.c */ void dump_cgraph (FILE *); diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index fcd85b49a31..e1fe22f434a 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1071,14 +1071,7 @@ cgraph_mark_inline_edge (struct cgraph_edge *e) e->inline_failed = NULL; if (!e->callee->global.inlined && flag_unit_at_a_time) - { - void **slot; - if (!cgraph_inline_hash) - cgraph_inline_hash = htab_create_ggc (42, htab_hash_pointer, - htab_eq_pointer, NULL); - slot = htab_find_slot (cgraph_inline_hash, e->callee->decl, INSERT); - *slot = e->callee->decl; - } + DECL_POSSIBLY_INLINED (e->callee->decl) = true; e->callee->global.inlined = true; cgraph_clone_inlined_nodes (e, true); diff --git a/gcc/tree.h b/gcc/tree.h index ef33d010657..f667a7974a0 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2212,6 +2212,12 @@ struct tree_type GTY(()) #define DECL_NEEDS_TO_LIVE_IN_MEMORY_INTERNAL(DECL) \ DECL_CHECK (DECL)->decl.needs_to_live_in_memory +/* Nonzero for a decl that cgraph has decided should be inlined into + at least one call site. It is not meaningful to look at this + directly; always use cgraph_function_possibly_inlined_p. */ +#define DECL_POSSIBLY_INLINED(DECL) \ + FUNCTION_DECL_CHECK (DECL)->decl.possibly_inlined + /* Enumerate visibility settings. */ enum symbol_visibility @@ -2276,7 +2282,8 @@ struct tree_decl GTY(()) unsigned lang_flag_7 : 1; unsigned needs_to_live_in_memory : 1; - /* 15 unused bits. */ + unsigned possibly_inlined : 1; + /* 14 unused bits. */ union tree_decl_u1 { /* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is -- 2.30.2