+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.
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) \
#include "real.h"
#include "rtl.h"
#include "tree.h"
+#include "tree-gimple.h"
#include "flags.h"
#include "regs.h"
#include "hard-reg-set.h"
{
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;
}
do
{
if (SSA_VAR_P (t)
+ || TREE_CODE (t) == STRING_CST
+ || TREE_CODE (t) == CONSTRUCTOR
|| TREE_CODE (t) == INDIRECT_REF)
return t;