Commit 6524147c by Ollie Wild Committed by Ollie Wild

varasm.c (compare_constant): Removed call to lang_hooks.expand_constant.

	gcc/
	* varasm.c (compare_constant): Removed call to
	lang_hooks.expand_constant.
	(copy_constants): Removed call to lang_hooks.expand_constant.
	(compute_reloc_for_constant): Removed call to
	lang_hooks.expand_constant.
	(output_addressed_constants): Removed call to
	lang_hooks.expand_constant.
	(constructor_static_from_elts_p): Removed call to
	lang_hooks.expand_constant.
	(output_constant): Removed calls to lang_hooks.expand_constant.
	* langhooks.h (struct lang_hooks): Removed field expand_constant.
	* langhooks-def.h (lhd_return_tree): Removed.
	(LANG_HOOKS_EXPAND_CONSTANT): Removed.
	(LANG_HOOKS_INITIALIZER): Removed LANG_HOOKS_EXPAND_CONSTANT.
	* langhooks.c (lhd_return_tree): Removed.

	gcc/cp/
	* typeck2.c (digest_init): Call cplus_expand_constant after
	convert_for_initialization.
	* cp-objcp-common.h (LANG_HOOKS_EXPAND_CONSTANT): Removed.
	* expr.c (cplus_expand_constant): Updated function description.

	gcc/ada/
	* misc.c (LANG_HOOKS_PUSHDECL): Replaced lhd_return_tree with
	gnat_return_tree.
	(gnat_init_gcc_eh): Replaced gnat_eh_runtime_type with
	gnat_return_tree.
	(gnat_eh_runtime_type): Removed.
	(gnat_return_tree): New function.

From-SVN: r129133
parent a222efd8
2007-10-08 Ollie Wild <aaw@google.com>
* varasm.c (compare_constant): Removed call to
lang_hooks.expand_constant.
(copy_constants): Removed call to lang_hooks.expand_constant.
(compute_reloc_for_constant): Removed call to
lang_hooks.expand_constant.
(output_addressed_constants): Removed call to
lang_hooks.expand_constant.
(constructor_static_from_elts_p): Removed call to
lang_hooks.expand_constant.
(output_constant): Removed calls to lang_hooks.expand_constant.
* langhooks.h (struct lang_hooks): Removed field expand_constant.
* langhooks-def.h (lhd_return_tree): Removed.
(LANG_HOOKS_EXPAND_CONSTANT): Removed.
(LANG_HOOKS_INITIALIZER): Removed LANG_HOOKS_EXPAND_CONSTANT.
* langhooks.c (lhd_return_tree): Removed.
2007-10-08 Mark Shinwell <shinwell@codesourcery.com> 2007-10-08 Mark Shinwell <shinwell@codesourcery.com>
* combine.c (setup_incoming_promotions): Ensure that * combine.c (setup_incoming_promotions): Ensure that
2007-10-08 Ollie Wild <aaw@google.com>
* misc.c (LANG_HOOKS_PUSHDECL): Replaced lhd_return_tree with
gnat_return_tree.
(gnat_init_gcc_eh): Replaced gnat_eh_runtime_type with
gnat_return_tree.
(gnat_eh_runtime_type): Removed.
(gnat_return_tree): New function.
2007-10-08 Ben Elliston <bje@au.ibm.com> 2007-10-08 Ben Elliston <bje@au.ibm.com>
PR ada/33454 PR ada/33454
...@@ -95,7 +95,7 @@ static void gnat_print_decl (FILE *, tree, int); ...@@ -95,7 +95,7 @@ static void gnat_print_decl (FILE *, tree, int);
static void gnat_print_type (FILE *, tree, int); static void gnat_print_type (FILE *, tree, int);
static const char *gnat_printable_name (tree, int); static const char *gnat_printable_name (tree, int);
static const char *gnat_dwarf_name (tree, int); static const char *gnat_dwarf_name (tree, int);
static tree gnat_eh_runtime_type (tree); static tree gnat_return_tree (tree);
static int gnat_eh_type_covers (tree, tree); static int gnat_eh_type_covers (tree, tree);
static void gnat_parse_file (int); static void gnat_parse_file (int);
static rtx gnat_expand_expr (tree, rtx, enum machine_mode, int, static rtx gnat_expand_expr (tree, rtx, enum machine_mode, int,
...@@ -125,7 +125,7 @@ static tree gnat_type_max_size (const_tree); ...@@ -125,7 +125,7 @@ static tree gnat_type_max_size (const_tree);
#undef LANG_HOOKS_GETDECLS #undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
#undef LANG_HOOKS_PUSHDECL #undef LANG_HOOKS_PUSHDECL
#define LANG_HOOKS_PUSHDECL lhd_return_tree #define LANG_HOOKS_PUSHDECL gnat_return_tree
#undef LANG_HOOKS_WRITE_GLOBALS #undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations #define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
...@@ -512,7 +512,7 @@ gnat_init_gcc_eh (void) ...@@ -512,7 +512,7 @@ gnat_init_gcc_eh (void)
? "__gnat_eh_personality_sj" ? "__gnat_eh_personality_sj"
: "__gnat_eh_personality"); : "__gnat_eh_personality");
lang_eh_type_covers = gnat_eh_type_covers; lang_eh_type_covers = gnat_eh_type_covers;
lang_eh_runtime_type = gnat_eh_runtime_type; lang_eh_runtime_type = gnat_return_tree;
default_init_unwind_resume_libfunc (); default_init_unwind_resume_libfunc ();
/* Turn on -fexceptions and -fnon-call-exceptions. The first one triggers /* Turn on -fexceptions and -fnon-call-exceptions. The first one triggers
...@@ -703,15 +703,13 @@ gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED) ...@@ -703,15 +703,13 @@ gnat_adjust_rli (record_layout_info rli ATTRIBUTE_UNUSED)
rli->record_align = record_align; rli->record_align = record_align;
#endif #endif
} }
/* These routines are used in conjunction with GCC exception handling. */
/* Map compile-time to run-time tree for GCC exception handling scheme. */ /* Do nothing (return the tree node passed). */
static tree static tree
gnat_eh_runtime_type (tree type) gnat_return_tree (tree t)
{ {
return type; return t;
} }
/* Return true if type A catches type B. Callback for flow analysis from /* Return true if type A catches type B. Callback for flow analysis from
......
2007-10-08 Ollie Wild <aaw@google.com>
* typeck2.c (digest_init): Call cplus_expand_constant after
convert_for_initialization.
* cp-objcp-common.h (LANG_HOOKS_EXPAND_CONSTANT): Removed.
* expr.c (cplus_expand_constant): Updated function description.
2007-10-04 Jason Merrill <jason@redhat.com> 2007-10-04 Jason Merrill <jason@redhat.com>
PR c++/20416 PR c++/20416
......
...@@ -50,8 +50,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t, ...@@ -50,8 +50,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
#define LANG_HOOKS_POST_OPTIONS c_common_post_options #define LANG_HOOKS_POST_OPTIONS c_common_post_options
#undef LANG_HOOKS_GET_ALIAS_SET #undef LANG_HOOKS_GET_ALIAS_SET
#define LANG_HOOKS_GET_ALIAS_SET cxx_get_alias_set #define LANG_HOOKS_GET_ALIAS_SET cxx_get_alias_set
#undef LANG_HOOKS_EXPAND_CONSTANT
#define LANG_HOOKS_EXPAND_CONSTANT cplus_expand_constant
#undef LANG_HOOKS_EXPAND_EXPR #undef LANG_HOOKS_EXPAND_EXPR
#define LANG_HOOKS_EXPAND_EXPR cxx_expand_expr #define LANG_HOOKS_EXPAND_EXPR cxx_expand_expr
#undef LANG_HOOKS_EXPAND_DECL #undef LANG_HOOKS_EXPAND_DECL
......
...@@ -33,8 +33,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -33,8 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h" #include "except.h"
#include "tm_p.h" #include "tm_p.h"
/* Hook used by output_constant to expand language-specific /* Expand C++-specific constants. Currently, this means PTRMEM_CST. */
constants. */
tree tree
cplus_expand_constant (tree cst) cplus_expand_constant (tree cst)
......
...@@ -703,8 +703,23 @@ digest_init (tree type, tree init) ...@@ -703,8 +703,23 @@ digest_init (tree type, tree init)
/* Handle scalar types (including conversions) and references. */ /* Handle scalar types (including conversions) and references. */
if (TREE_CODE (type) != COMPLEX_TYPE if (TREE_CODE (type) != COMPLEX_TYPE
&& (SCALAR_TYPE_P (type) || code == REFERENCE_TYPE)) && (SCALAR_TYPE_P (type) || code == REFERENCE_TYPE))
return convert_for_initialization (0, type, init, LOOKUP_NORMAL, {
"initialization", NULL_TREE, 0); tree *exp;
init = convert_for_initialization (0, type, init, LOOKUP_NORMAL,
"initialization", NULL_TREE, 0);
exp = &init;
/* Skip any conversions since we'll be outputting the underlying
constant. */
while (TREE_CODE (*exp) == NOP_EXPR || TREE_CODE (*exp) == CONVERT_EXPR
|| TREE_CODE (*exp) == NON_LVALUE_EXPR)
exp = &TREE_OPERAND (*exp, 0);
*exp = cplus_expand_constant (*exp);
return init;
}
/* Come here only for aggregates: records, arrays, unions, complex numbers /* Come here only for aggregates: records, arrays, unions, complex numbers
and vectors. */ and vectors. */
......
...@@ -41,7 +41,6 @@ extern void lhd_do_nothing_i (int); ...@@ -41,7 +41,6 @@ extern void lhd_do_nothing_i (int);
extern void lhd_do_nothing_f (struct function *); extern void lhd_do_nothing_f (struct function *);
extern bool lhd_post_options (const char **); extern bool lhd_post_options (const char **);
extern alias_set_type lhd_get_alias_set (tree); extern alias_set_type lhd_get_alias_set (tree);
extern tree lhd_return_tree (tree);
extern tree lhd_return_null_tree_v (void); extern tree lhd_return_null_tree_v (void);
extern tree lhd_return_null_tree (tree); extern tree lhd_return_null_tree (tree);
extern tree lhd_return_null_const_tree (const_tree); extern tree lhd_return_null_const_tree (const_tree);
...@@ -93,7 +92,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, ...@@ -93,7 +92,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_MISSING_ARGUMENT hook_bool_constcharptr_size_t_false #define LANG_HOOKS_MISSING_ARGUMENT hook_bool_constcharptr_size_t_false
#define LANG_HOOKS_POST_OPTIONS lhd_post_options #define LANG_HOOKS_POST_OPTIONS lhd_post_options
#define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set #define LANG_HOOKS_GET_ALIAS_SET lhd_get_alias_set
#define LANG_HOOKS_EXPAND_CONSTANT lhd_return_tree
#define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr #define LANG_HOOKS_EXPAND_EXPR lhd_expand_expr
#define LANG_HOOKS_EXPAND_DECL lhd_expand_decl #define LANG_HOOKS_EXPAND_DECL lhd_expand_decl
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t #define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t
...@@ -250,7 +248,6 @@ extern tree lhd_make_node (enum tree_code); ...@@ -250,7 +248,6 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_PARSE_FILE, \ LANG_HOOKS_PARSE_FILE, \
LANG_HOOKS_CLEAR_BINDING_STACK, \ LANG_HOOKS_CLEAR_BINDING_STACK, \
LANG_HOOKS_GET_ALIAS_SET, \ LANG_HOOKS_GET_ALIAS_SET, \
LANG_HOOKS_EXPAND_CONSTANT, \
LANG_HOOKS_EXPAND_EXPR, \ LANG_HOOKS_EXPAND_EXPR, \
LANG_HOOKS_EXPAND_DECL, \ LANG_HOOKS_EXPAND_DECL, \
LANG_HOOKS_FINISH_INCOMPLETE_DECL, \ LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
......
...@@ -76,14 +76,6 @@ lhd_do_nothing_f (struct function * ARG_UNUSED (f)) ...@@ -76,14 +76,6 @@ lhd_do_nothing_f (struct function * ARG_UNUSED (f))
{ {
} }
/* Do nothing (return the tree node passed). */
tree
lhd_return_tree (tree t)
{
return t;
}
/* Do nothing (return NULL_TREE). */ /* Do nothing (return NULL_TREE). */
tree tree
......
...@@ -287,11 +287,6 @@ struct lang_hooks ...@@ -287,11 +287,6 @@ struct lang_hooks
Returns -1 if the language does nothing special for it. */ Returns -1 if the language does nothing special for it. */
alias_set_type (*get_alias_set) (tree); alias_set_type (*get_alias_set) (tree);
/* Called with an expression that is to be processed as a constant.
Returns either the same expression or a language-independent
constant equivalent to its input. */
tree (*expand_constant) (tree);
/* Called by expand_expr for language-specific tree codes. /* Called by expand_expr for language-specific tree codes.
Fourth argument is actually an enum expand_modifier. */ Fourth argument is actually an enum expand_modifier. */
rtx (*expand_expr) (tree, rtx, enum machine_mode, int, rtx *); rtx (*expand_expr) (tree, rtx, enum machine_mode, int, rtx *);
......
...@@ -2985,15 +2985,7 @@ compare_constant (const tree t1, const tree t2) ...@@ -2985,15 +2985,7 @@ compare_constant (const tree t1, const tree t2)
return compare_constant (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)); return compare_constant (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
default: default:
{ return 0;
tree nt1, nt2;
nt1 = lang_hooks.expand_constant (t1);
nt2 = lang_hooks.expand_constant (t2);
if (nt1 != t1 || nt2 != t2)
return compare_constant (nt1, nt2);
else
return 0;
}
} }
gcc_unreachable (); gcc_unreachable ();
...@@ -3061,12 +3053,7 @@ copy_constant (tree exp) ...@@ -3061,12 +3053,7 @@ copy_constant (tree exp)
} }
default: default:
{ gcc_unreachable ();
tree t = lang_hooks.expand_constant (exp);
gcc_assert (t != exp);
return copy_constant (t);
}
} }
} }
...@@ -3910,10 +3897,6 @@ compute_reloc_for_constant (tree exp) ...@@ -3910,10 +3897,6 @@ compute_reloc_for_constant (tree exp)
int reloc = 0, reloc2; int reloc = 0, reloc2;
tree tem; tree tem;
/* Give the front-end a chance to convert VALUE to something that
looks more like a constant to the back-end. */
exp = lang_hooks.expand_constant (exp);
switch (TREE_CODE (exp)) switch (TREE_CODE (exp))
{ {
case ADDR_EXPR: case ADDR_EXPR:
...@@ -3978,10 +3961,6 @@ output_addressed_constants (tree exp) ...@@ -3978,10 +3961,6 @@ output_addressed_constants (tree exp)
{ {
tree tem; tree tem;
/* Give the front-end a chance to convert VALUE to something that
looks more like a constant to the back-end. */
exp = lang_hooks.expand_constant (exp);
switch (TREE_CODE (exp)) switch (TREE_CODE (exp))
{ {
case ADDR_EXPR: case ADDR_EXPR:
...@@ -4055,10 +4034,6 @@ constructor_static_from_elts_p (const_tree ctor) ...@@ -4055,10 +4034,6 @@ constructor_static_from_elts_p (const_tree ctor)
tree tree
initializer_constant_valid_p (tree value, tree endtype) initializer_constant_valid_p (tree value, tree endtype)
{ {
/* Give the front-end a chance to convert VALUE to something that
looks more like a constant to the back-end. */
value = lang_hooks.expand_constant (value);
switch (TREE_CODE (value)) switch (TREE_CODE (value))
{ {
case CONSTRUCTOR: case CONSTRUCTOR:
...@@ -4317,11 +4292,6 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) ...@@ -4317,11 +4292,6 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
enum tree_code code; enum tree_code code;
unsigned HOST_WIDE_INT thissize; unsigned HOST_WIDE_INT thissize;
/* Some front-ends use constants other than the standard language-independent
varieties, but which may still be output directly. Give the front-end a
chance to convert EXP to a language-independent representation. */
exp = lang_hooks.expand_constant (exp);
if (size == 0 || flag_syntax_only) if (size == 0 || flag_syntax_only)
return; return;
...@@ -4378,9 +4348,6 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) ...@@ -4378,9 +4348,6 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align)
code = TREE_CODE (TREE_TYPE (exp)); code = TREE_CODE (TREE_TYPE (exp));
thissize = int_size_in_bytes (TREE_TYPE (exp)); thissize = int_size_in_bytes (TREE_TYPE (exp));
/* Give the front end another chance to expand constants. */
exp = lang_hooks.expand_constant (exp);
/* Allow a constructor with no elements for any data type. /* Allow a constructor with no elements for any data type.
This means to fill the space with zeros. */ This means to fill the space with zeros. */
if (TREE_CODE (exp) == CONSTRUCTOR if (TREE_CODE (exp) == CONSTRUCTOR
......
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