Commit aef0afc4 by Ulrich Weigand Committed by Ulrich Weigand

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
parent a1db9d9c
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> 2004-05-23 Paolo Bonzini <bonzini@gnu.org>
Move libcpp to the toplevel. Move libcpp to the toplevel.
......
...@@ -1766,8 +1766,8 @@ dojump.o : dojump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_ ...@@ -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 \ flags.h function.h $(EXPR_H) $(OPTABS_H) $(INSN_ATTR_H) insn-config.h \
langhooks.h $(GGC_H) gt-dojump.h langhooks.h $(GGC_H) gt-dojump.h
builtins.o : builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_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 \ $(TREE_GIMPLE_H) flags.h $(TARGET_H) function.h $(REGS_H) $(EXPR_H) $(OPTABS_H) \
$(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.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 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 \ 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) \ $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
......
...@@ -27,6 +27,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -27,6 +27,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "real.h" #include "real.h"
#include "rtl.h" #include "rtl.h"
#include "tree.h" #include "tree.h"
#include "tree-gimple.h"
#include "flags.h" #include "flags.h"
#include "regs.h" #include "regs.h"
#include "hard-reg-set.h" #include "hard-reg-set.h"
...@@ -7925,8 +7926,20 @@ readonly_data_expr (tree exp) ...@@ -7925,8 +7926,20 @@ readonly_data_expr (tree exp)
{ {
STRIP_NOPS (exp); STRIP_NOPS (exp);
if (TREE_CODE (exp) == ADDR_EXPR) if (TREE_CODE (exp) != ADDR_EXPR)
return decl_readonly_section (TREE_OPERAND (exp, 0), 0); 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 else
return false; return false;
} }
......
...@@ -574,6 +574,8 @@ get_base_address (tree t) ...@@ -574,6 +574,8 @@ get_base_address (tree t)
do do
{ {
if (SSA_VAR_P (t) if (SSA_VAR_P (t)
|| TREE_CODE (t) == STRING_CST
|| TREE_CODE (t) == CONSTRUCTOR
|| TREE_CODE (t) == INDIRECT_REF) || TREE_CODE (t) == INDIRECT_REF)
return t; return t;
......
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