OSDN Git Service

* tree-ssa-loop-ivopts.c: Include target.h.
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Mar 2007 21:39:57 +0000 (21:39 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Mar 2007 21:39:57 +0000 (21:39 +0000)
        (produce_memory_decl_rtl): Pass the rtx through encode_section_info.
        (get_address_cost): Force SYMBOL_FLAG_LOCAL set.
        (force_expr_to_var_cost): Use produce_memory_decl_rtl.
        * Makefile.in (tree-ssa-loop-ivopts.o): Depend on TARGET_H.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123371 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/Makefile.in
gcc/tree-ssa-loop-ivopts.c

index 05fb4ee..2b97b21 100644 (file)
@@ -2136,7 +2136,7 @@ tree-ssa-loop-ivopts.o : tree-ssa-loop-ivopts.c $(TREE_FLOW_H) $(CONFIG_H) \
    output.h $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
    tree-pass.h $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H) \
    $(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) hard-reg-set.h \
-   tree-chrec.h $(VARRAY_H) tree-affine.h pointer-set.h
+   tree-chrec.h $(VARRAY_H) tree-affine.h pointer-set.h $(TARGET_H)
 tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) \
    $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) \
    output.h $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(TREE_DUMP_H)
index 8223fac..6e952af 100644 (file)
@@ -91,6 +91,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 #include "params.h"
 #include "langhooks.h"
 #include "tree-affine.h"
+#include "target.h"
 
 /* The infinite cost.  */
 #define INFTY 10000000
@@ -2380,11 +2381,17 @@ produce_memory_decl_rtl (tree obj, int *regno)
     {
       const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (obj));
       x = gen_rtx_SYMBOL_REF (Pmode, name);
+      SET_SYMBOL_REF_DECL (x, obj);
+      x = gen_rtx_MEM (DECL_MODE (obj), x);
+      targetm.encode_section_info (obj, x, true);
     }
   else
-    x = gen_raw_REG (Pmode, (*regno)++);
+    {
+      x = gen_raw_REG (Pmode, (*regno)++);
+      x = gen_rtx_MEM (DECL_MODE (obj), x);
+    }
 
-  return gen_rtx_MEM (DECL_MODE (obj), x);
+  return x;
 }
 
 /* Prepares decl_rtl for variables referred in *EXPR_P.  Callback for
@@ -2943,6 +2950,12 @@ get_address_cost (bool symbol_present, bool var_present,
          if (sym_p)
            {
              base = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (""));
+             /* ??? We can run into trouble with some backends by presenting
+                it with symbols which havn't been properly passed through
+                targetm.encode_section_info.  By setting the local bit, we
+                enhance the probability of things working.  */
+             SYMBOL_REF_FLAGS (base) = SYMBOL_FLAG_LOCAL;
+
              if (off_p)
                base = gen_rtx_fmt_e (CONST, Pmode,
                                      gen_rtx_fmt_ee (PLUS, Pmode,
@@ -3070,17 +3083,18 @@ force_expr_to_var_cost (tree expr)
 
   if (!costs_initialized)
     {
-      tree var = create_tmp_var_raw (integer_type_node, "test_var");
-      rtx x = gen_rtx_MEM (DECL_MODE (var),
-                          gen_rtx_SYMBOL_REF (Pmode, "test_var"));
-      tree addr;
       tree type = build_pointer_type (integer_type_node);
+      tree var, addr;
+      rtx x;
+
+      var = create_tmp_var_raw (integer_type_node, "test_var");
+      TREE_STATIC (var) = 1;
+      x = produce_memory_decl_rtl (var, NULL);
+      SET_DECL_RTL (var, x);
 
       integer_cost = computation_cost (build_int_cst (integer_type_node,
                                                      2000));
 
-      SET_DECL_RTL (var, x);
-      TREE_STATIC (var) = 1;
       addr = build1 (ADDR_EXPR, type, var);
       symbol_cost = computation_cost (addr) + 1;