summaryrefslogtreecommitdiff
path: root/gcc/tree-complex.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-26 03:55:10 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-26 03:55:10 +0000
commitd34bc37ae29ff2e432a1278981b97abfe65e353d (patch)
treeb02b389d6887174f0ac7668669e2cd531c33602a /gcc/tree-complex.c
parent8224328f365768f264f5abd1641da9dad06231b5 (diff)
downloadgcc-d34bc37ae29ff2e432a1278981b97abfe65e353d.tar.gz
2004-11-25 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17957 * testsuite/gcc.dg/pr17957.c: New test. 2004-11-25 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/17957 * tree-complex.c (vector_inner_type): New variable moved from build_word_mode_vector_type. (vector_last_type): Likewise. (vector_last_nunits): Likewise. (build_word_mode_vector_type): Use the new variables. * Makefile.in (tree-complex.o): Add gt-tree-complex.h $(GGC_H). (GTFILES): Add tree-complex.c. (gt-tree-complex.h): New rule, add it to the rest of the gt-* rules. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91322 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-complex.c')
-rw-r--r--gcc/tree-complex.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index bfd74bdc800..4a4ba62a05b 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -35,6 +35,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tree-iterator.h"
#include "tree-pass.h"
#include "flags.h"
+#include "ggc.h"
/* Extract the real or imaginary part of a complex variable or constant.
@@ -509,25 +510,30 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value)
return ret;
}
+static GTY(()) tree vector_inner_type;
+static GTY(()) tree vector_last_type;
+static GTY(()) int vector_last_nunits;
+
/* Return a suitable vector types made of SUBPARTS units each of mode
"word_mode" (the global variable). */
static tree
build_word_mode_vector_type (int nunits)
{
- static tree innertype;
- static tree last;
- static int last_nunits;
-
- if (!innertype)
- innertype = lang_hooks.types.type_for_mode (word_mode, 1);
- else if (last_nunits == nunits)
- return last;
+ if (!vector_inner_type)
+ vector_inner_type = lang_hooks.types.type_for_mode (word_mode, 1);
+ else if (vector_last_nunits == nunits)
+ {
+ gcc_assert (TREE_CODE (vector_last_type) == VECTOR_TYPE);
+ return vector_last_type;
+ }
/* We build a new type, but we canonicalize it nevertheless,
because it still saves some memory. */
- last_nunits = nunits;
- last = type_hash_canon (nunits, build_vector_type (innertype, nunits));
- return last;
+ vector_last_nunits = nunits;
+ vector_last_type = type_hash_canon (nunits,
+ build_vector_type (vector_inner_type,
+ nunits));
+ return vector_last_type;
}
typedef tree (*elem_op_func) (block_stmt_iterator *,
@@ -953,3 +959,5 @@ struct tree_opt_pass pass_pre_expand =
| TODO_verify_stmts, /* todo_flags_finish */
0 /* letter */
};
+
+#include "gt-tree-complex.h"