aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2007-02-06 13:55:01 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2007-02-06 13:55:01 +0000
commit0802f6a2f718f63c240b0f77c319cd94fc9595c9 (patch)
treea09637fe7757ea3fcdd7c1febda3075bf7765788 /gcc
parent427e84f7fea0383ba4bc6f77a014085364896bd3 (diff)
downloadgcc-0802f6a2f718f63c240b0f77c319cd94fc9595c9.zip
gcc-0802f6a2f718f63c240b0f77c319cd94fc9595c9.tar.gz
gcc-0802f6a2f718f63c240b0f77c319cd94fc9595c9.tar.bz2
tree.c (tree_int_map_hash, [...]): Remove prototypes and make them non-static.
gcc: 2007-02-06 Paolo Bonzini <bonzini@gnu.org> * tree.c (tree_int_map_hash, tree_int_map_eq, tree_int_map_marked_p): Remove prototypes and make them non-static. (struct tree_int_map): Remove. * tree.h (struct tree_int_map): Move here, turning TO into an unsigned int. (tree_int_map_hash, tree_int_map_eq, tree_int_map_marked_p): Declare. * tree.h (TREE_COMPLEXITY): Remove. (struct tree_exp): Remove complexity field. * tree.c (build1_stat): Don't set it. gcc/ada: 2007-02-06 Paolo Bonzini <bonzini@gnu.org> * Make-lang.in (ada/decl.o): Add gt-ada-decl.h dependency. * decl.c: Include gt-ada-decl.h. (annotate_value_cache): New. (annotate_value): Use it instead of TREE_COMPLEXITY. From-SVN: r121647
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/Make-lang.in2
-rw-r--r--gcc/ada/decl.c33
-rw-r--r--gcc/tree.c15
-rw-r--r--gcc/tree.h13
6 files changed, 65 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8badc16..a3b07b0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2007-02-06 Paolo Bonzini <bonzini@gnu.org>
+
+ * tree.c (tree_int_map_hash, tree_int_map_eq, tree_int_map_marked_p):
+ Remove prototypes and make them non-static.
+ (struct tree_int_map): Remove.
+ * tree.h (struct tree_int_map): Move here, turning TO into an
+ unsigned int.
+ (tree_int_map_hash, tree_int_map_eq, tree_int_map_marked_p): Declare.
+
+ * tree.h (TREE_COMPLEXITY): Remove.
+ (struct tree_exp): Remove complexity field.
+ * tree.c (build1_stat): Don't set it.
+
2007-02-06 Dorit Nuzman <dorit@il.ibm.com>
Victor Kaplansky <victork@il.ibm.com>
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5641887..c96b7f6 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2007-02-06 Paolo Bonzini <bonzini@gnu.org>
+
+ * Make-lang.in (ada/decl.o): Add gt-ada-decl.h dependency.
+ * decl.c: Include gt-ada-decl.h.
+ (annotate_value_cache): New.
+ (annotate_value): Use it instead of TREE_COMPLEXITY.
+
2007-02-03 Kazu Hirata <kazu@codesourcery.com>
* misc.c, utils2.c: Fix comment typos.
diff --git a/gcc/ada/Make-lang.in b/gcc/ada/Make-lang.in
index 67cb84b..4fada1e 100644
--- a/gcc/ada/Make-lang.in
+++ b/gcc/ada/Make-lang.in
@@ -1073,7 +1073,7 @@ ada/decl.o : ada/decl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(FLAGS_H) toplev.h convert.h $(TARGET_H) ada/ada.h ada/types.h ada/atree.h \
ada/nlists.h ada/elists.h ada/uintp.h ada/sinfo.h ada/einfo.h ada/snames.h \
ada/namet.h ada/stringt.h ada/repinfo.h ada/fe.h $(ADA_TREE_H) ada/gigi.h \
- $(EXPR_H)
+ $(EXPR_H) gt-ada-decl.h
ada/misc.o : ada/misc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(EXPR_H) insn-codes.h insn-flags.h insn-config.h recog.h \
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index a7ee5ce..af0e392 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -50,6 +50,7 @@
#include "fe.h"
#include "sinfo.h"
#include "einfo.h"
+#include "hashtab.h"
#include "ada-tree.h"
#include "gigi.h"
@@ -80,6 +81,10 @@ static struct incomplete
static int defer_debug_level = 0;
static tree defer_debug_incomplete_list;
+/* A hash table used as to cache the result of annotate_value. */
+static GTY ((if_marked ("tree_int_map_marked_p"), param_is (struct tree_int_map)))
+ htab_t annotate_value_cache;
+
static void copy_alias_set (tree, tree);
static tree substitution_list (Entity_Id, Entity_Id, tree, bool);
static bool allocatable_size_p (tree, bool);
@@ -5876,10 +5881,22 @@ annotate_value (tree gnu_size)
Node_Ref_Or_Val ops[3], ret;
int i;
int size;
+ struct tree_int_map **h = NULL;
/* See if we've already saved the value for this node. */
- if (EXPR_P (gnu_size) && TREE_COMPLEXITY (gnu_size))
- return (Node_Ref_Or_Val) TREE_COMPLEXITY (gnu_size);
+ if (EXPR_P (gnu_size))
+ {
+ struct tree_int_map in;
+ if (!annotate_value_cache)
+ annotate_value_cache = htab_create_ggc (512, tree_int_map_hash,
+ tree_int_map_eq, 0);
+ in.from = gnu_size;
+ h = (struct tree_int_map **)
+ htab_find_slot (annotate_value_cache, &in, INSERT);
+
+ if (*h)
+ return (Node_Ref_Or_Val) (*h)->to;
+ }
/* If we do not return inside this switch, TCODE will be set to the
code to use for a Create_Node operand and LEN (set above) will be
@@ -5994,7 +6011,15 @@ annotate_value (tree gnu_size)
}
ret = Create_Node (tcode, ops[0], ops[1], ops[2]);
- TREE_COMPLEXITY (gnu_size) = ret;
+
+ /* Save the result in the cache. */
+ if (h)
+ {
+ *h = ggc_alloc (sizeof (struct tree_int_map));
+ (*h)->from = gnu_size;
+ (*h)->to = ret;
+ }
+
return ret;
}
@@ -6847,3 +6872,5 @@ concat_id_with_name (tree gnu_id, const char *suffix)
strcpy (Name_Buffer + len, suffix);
return get_identifier (Name_Buffer);
}
+
+#include "gt-ada-decl.h"
diff --git a/gcc/tree.c b/gcc/tree.c
index 6824c14..ae20c251 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -150,14 +150,6 @@ static GTY ((if_marked ("tree_int_map_marked_p"), param_is (struct tree_int_map)
static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
htab_t restrict_base_for_decl;
-struct tree_int_map GTY(())
-{
- tree from;
- unsigned short to;
-};
-static unsigned int tree_int_map_hash (const void *);
-static int tree_int_map_eq (const void *, const void *);
-static int tree_int_map_marked_p (const void *);
static void set_type_quals (tree, int);
static int type_hash_eq (const void *, const void *);
static hashval_t type_hash_hash (const void *);
@@ -2931,7 +2923,6 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
#else
SET_EXPR_LOCUS (t, NULL);
#endif
- TREE_COMPLEXITY (t) = 0;
TREE_OPERAND (t, 0) = node;
TREE_BLOCK (t) = NULL_TREE;
if (node && !TYPE_P (node))
@@ -4184,7 +4175,7 @@ tree_map_marked_p (const void *p)
/* Return true if the trees in the tree_int_map *'s VA and VB are equal. */
-static int
+int
tree_int_map_eq (const void *va, const void *vb)
{
const struct tree_int_map *a = va, *b = vb;
@@ -4193,7 +4184,7 @@ tree_int_map_eq (const void *va, const void *vb)
/* Hash a from tree in the tree_int_map * ITEM. */
-static unsigned int
+unsigned int
tree_int_map_hash (const void *item)
{
return htab_hash_pointer (((const struct tree_int_map *)item)->from);
@@ -4203,7 +4194,7 @@ tree_int_map_hash (const void *item)
purposes. We simply return true if the from tree_int_map *P's from tree is marked, so that this
structure goes away when the from tree goes away. */
-static int
+int
tree_int_map_marked_p (const void *p)
{
tree from = ((struct tree_int_map *) p)->from;
diff --git a/gcc/tree.h b/gcc/tree.h
index 688319c..5511780 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1498,7 +1498,6 @@ struct tree_constructor GTY(())
/* In ordinary expression nodes. */
#define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I)
-#define TREE_COMPLEXITY(NODE) (EXPR_CHECK (NODE)->exp.complexity)
/* In gimple statements. */
#define GIMPLE_STMT_OPERAND(NODE, I) GIMPLE_STMT_OPERAND_CHECK (NODE, I)
@@ -1724,7 +1723,6 @@ struct tree_exp GTY(())
{
struct tree_common common;
source_locus locus;
- int complexity;
tree block;
tree GTY ((special ("tree_exp"),
desc ("TREE_CODE ((tree) &%0)")))
@@ -4718,6 +4716,7 @@ extern tree get_base_address (tree t);
/* In tree-vectorizer.c. */
extern void vect_set_verbosity_level (const char *);
+/* In tree.c. */
struct tree_map GTY(())
{
unsigned int hash;
@@ -4729,6 +4728,16 @@ extern unsigned int tree_map_hash (const void *);
extern int tree_map_marked_p (const void *);
extern int tree_map_eq (const void *, const void *);
+struct tree_int_map GTY(())
+{
+ tree from;
+ unsigned int to;
+};
+
+extern unsigned int tree_int_map_hash (const void *);
+extern int tree_int_map_eq (const void *, const void *);
+extern int tree_int_map_marked_p (const void *);
+
/* In tree-ssa-address.c. */
extern tree tree_mem_ref_addr (tree, tree);
extern void copy_mem_ref_info (tree, tree);