aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
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/ada
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/ada')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/Make-lang.in2
-rw-r--r--gcc/ada/decl.c33
3 files changed, 38 insertions, 4 deletions
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"