Commit f17333e3 by Ian Lance Taylor Committed by Ian Lance Taylor

godump.c (struct godump_container): Add invalid_hash field.

	* godump.c (struct godump_container): Add invalid_hash field.
	(go_format_type): Return false if type is found in invalid_hash.
	(go_output_typedef): Add invalid type to invalid_hash.
	(go_finish): Create and delete invalid_hash.

From-SVN: r174140
parent 235fe6b4
2011-05-24 Ian Lance Taylor <iant@google.com>
* godump.c (struct godump_container): Add invalid_hash field.
(go_format_type): Return false if type is found in invalid_hash.
(go_output_typedef): Add invalid type to invalid_hash.
(go_finish): Create and delete invalid_hash.
2011-05-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com> 2011-05-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
PR tree-optimization/46728 PR tree-optimization/46728
* tree-ssa-math-opts.c (powi_table): New. * tree-ssa-math-opts.c (powi_table): New.
(powi_lookup_cost): New. (powi_lookup_cost): New.
...@@ -9,7 +16,7 @@ ...@@ -9,7 +16,7 @@
(gimple_expand_builtin_powi): New. (gimple_expand_builtin_powi): New.
(execute_cse_sincos): Add switch case for BUILT_IN_POWI. (execute_cse_sincos): Add switch case for BUILT_IN_POWI.
(gate_cse_sincos): Remove sincos/cexp restriction. (gate_cse_sincos): Remove sincos/cexp restriction.
2011-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2011-05-24 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR target/3746 PR target/3746
......
...@@ -464,6 +464,9 @@ struct godump_container ...@@ -464,6 +464,9 @@ struct godump_container
/* Global type definitions. */ /* Global type definitions. */
htab_t type_hash; htab_t type_hash;
/* Invalid types. */
htab_t invalid_hash;
/* Obstack used to write out a type definition. */ /* Obstack used to write out a type definition. */
struct obstack type_obstack; struct obstack type_obstack;
}; };
...@@ -500,20 +503,20 @@ go_format_type (struct godump_container *container, tree type, ...@@ -500,20 +503,20 @@ go_format_type (struct godump_container *container, tree type,
|| TREE_CODE (type) == FUNCTION_TYPE)) || TREE_CODE (type) == FUNCTION_TYPE))
{ {
tree name; tree name;
void **slot;
name = TYPE_NAME (type); name = TYPE_NAME (type);
if (TREE_CODE (name) == IDENTIFIER_NODE) if (TREE_CODE (name) == TYPE_DECL)
{ name = DECL_NAME (name);
obstack_1grow (ob, '_');
go_append_string (ob, name); slot = htab_find_slot (container->invalid_hash, IDENTIFIER_POINTER (name),
return ret; NO_INSERT);
} if (slot != NULL)
else if (TREE_CODE (name) == TYPE_DECL) ret = false;
{
obstack_1grow (ob, '_'); obstack_1grow (ob, '_');
go_append_string (ob, DECL_NAME (name)); go_append_string (ob, name);
return ret; return ret;
}
} }
pointer_set_insert (container->decls_seen, type); pointer_set_insert (container->decls_seen, type);
...@@ -879,7 +882,11 @@ go_output_typedef (struct godump_container *container, tree decl) ...@@ -879,7 +882,11 @@ go_output_typedef (struct godump_container *container, tree decl)
*slot = CONST_CAST (void *, (const void *) type); *slot = CONST_CAST (void *, (const void *) type);
if (!go_format_type (container, TREE_TYPE (decl), false, false)) if (!go_format_type (container, TREE_TYPE (decl), false, false))
fprintf (go_dump_file, "// "); {
fprintf (go_dump_file, "// ");
slot = htab_find_slot (container->invalid_hash, type, INSERT);
*slot = CONST_CAST (void *, (const void *) type);
}
fprintf (go_dump_file, "type _%s ", fprintf (go_dump_file, "type _%s ",
IDENTIFIER_POINTER (DECL_NAME (decl))); IDENTIFIER_POINTER (DECL_NAME (decl)));
go_output_type (container); go_output_type (container);
...@@ -898,7 +905,11 @@ go_output_typedef (struct godump_container *container, tree decl) ...@@ -898,7 +905,11 @@ go_output_typedef (struct godump_container *container, tree decl)
*slot = CONST_CAST (void *, (const void *) type); *slot = CONST_CAST (void *, (const void *) type);
if (!go_format_type (container, TREE_TYPE (decl), false, false)) if (!go_format_type (container, TREE_TYPE (decl), false, false))
fprintf (go_dump_file, "// "); {
fprintf (go_dump_file, "// ");
slot = htab_find_slot (container->invalid_hash, type, INSERT);
*slot = CONST_CAST (void *, (const void *) type);
}
fprintf (go_dump_file, "type _%s ", fprintf (go_dump_file, "type _%s ",
IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl)))); IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))));
go_output_type (container); go_output_type (container);
...@@ -1010,6 +1021,8 @@ go_finish (const char *filename) ...@@ -1010,6 +1021,8 @@ go_finish (const char *filename)
container.pot_dummy_types = pointer_set_create (); container.pot_dummy_types = pointer_set_create ();
container.type_hash = htab_create (100, htab_hash_string, container.type_hash = htab_create (100, htab_hash_string,
string_hash_eq, NULL); string_hash_eq, NULL);
container.invalid_hash = htab_create (10, htab_hash_string,
string_hash_eq, NULL);
container.keyword_hash = htab_create (50, htab_hash_string, container.keyword_hash = htab_create (50, htab_hash_string,
string_hash_eq, NULL); string_hash_eq, NULL);
obstack_init (&container.type_obstack); obstack_init (&container.type_obstack);
...@@ -1044,6 +1057,7 @@ go_finish (const char *filename) ...@@ -1044,6 +1057,7 @@ go_finish (const char *filename)
pointer_set_destroy (container.decls_seen); pointer_set_destroy (container.decls_seen);
pointer_set_destroy (container.pot_dummy_types); pointer_set_destroy (container.pot_dummy_types);
htab_delete (container.type_hash); htab_delete (container.type_hash);
htab_delete (container.invalid_hash);
htab_delete (container.keyword_hash); htab_delete (container.keyword_hash);
obstack_free (&container.type_obstack, NULL); obstack_free (&container.type_obstack, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment