re PR tree-optimization/14197 (Wrong code for bcopy/memmove (string-asm-2.c))

PR tree-optimization/14197
	* builtins.c: Include "tree-gimple.h"
	(readonly_data_expr): Use get_base_address.  Make sure to call
	decl_readonly_section only on trees it can handle.
	* tree-gimple.c (get_base_address): Accept STRING_CST and
	CONSTRUCTOR expressions.
	* Makefile.in: Update dependencies.

From-SVN: r82209
This commit is contained in:
Ulrich Weigand 2004-05-24 16:37:17 +00:00 committed by Ulrich Weigand
parent a1db9d9c61
commit aef0afc4f4
4 changed files with 29 additions and 4 deletions

View File

@ -1,3 +1,13 @@
2004-05-24 Ulrich Weigand <uweigand@de.ibm.com>
PR tree-optimization/14197
* builtins.c: Include "tree-gimple.h"
(readonly_data_expr): Use get_base_address. Make sure to call
decl_readonly_section only on trees it can handle.
* tree-gimple.c (get_base_address): Accept STRING_CST and
CONSTRUCTOR expressions.
* Makefile.in: Update dependencies.
2004-05-23 Paolo Bonzini <bonzini@gnu.org>
Move libcpp to the toplevel.

View File

@ -1766,8 +1766,8 @@ dojump.o : dojump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_
flags.h function.h $(EXPR_H) $(OPTABS_H) $(INSN_ATTR_H) insn-config.h \
langhooks.h $(GGC_H) gt-dojump.h
builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H)\
flags.h $(TARGET_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) insn-config.h \
$(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
$(TREE_GIMPLE_H) flags.h $(TARGET_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) \
insn-config.h $(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
except.h $(TM_P_H) $(PREDICT_H) libfuncs.h real.h langhooks.h
calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) flags.h \
$(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \

View File

@ -27,6 +27,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "real.h"
#include "rtl.h"
#include "tree.h"
#include "tree-gimple.h"
#include "flags.h"
#include "regs.h"
#include "hard-reg-set.h"
@ -7925,8 +7926,20 @@ readonly_data_expr (tree exp)
{
STRIP_NOPS (exp);
if (TREE_CODE (exp) == ADDR_EXPR)
return decl_readonly_section (TREE_OPERAND (exp, 0), 0);
if (TREE_CODE (exp) != ADDR_EXPR)
return false;
exp = get_base_address (TREE_OPERAND (exp, 0));
if (!exp)
return false;
/* Make sure we call decl_readonly_section only for trees it
can handle (since it returns true for everything it doesn't
understand). */
if (TREE_CODE (exp) == STRING_CST
|| TREE_CODE (exp) == CONSTRUCTOR
|| (TREE_CODE (exp) == VAR_DECL && TREE_STATIC (exp)))
return decl_readonly_section (exp, 0);
else
return false;
}

View File

@ -574,6 +574,8 @@ get_base_address (tree t)
do
{
if (SSA_VAR_P (t)
|| TREE_CODE (t) == STRING_CST
|| TREE_CODE (t) == CONSTRUCTOR
|| TREE_CODE (t) == INDIRECT_REF)
return t;