]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ira-cost.c (copy_cost): Lazilly initialize move_cost if needed.
authorJan Hubicka <jh@suse.cz>
Thu, 18 Dec 2008 13:49:47 +0000 (14:49 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 18 Dec 2008 13:49:47 +0000 (13:49 +0000)
* ira-cost.c (copy_cost): Lazilly initialize move_cost if needed.

Co-Authored-By: Kai Tietz <kai.tietz@onevision.com>
From-SVN: r142811

gcc/ChangeLog
gcc/ira-costs.c

index a798d85f283a02ed755b9c9c5ae359c86beab717..8c10d1a789b049c6e03379d4cb7ad24f90a40541 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-18  Jan Hubicka  <jh@suse.cz>
+           Kai Tietz <kai.tietz@onevision.com>
+
+       * ira-cost.c (copy_cost): Lazilly initialize move_cost if needed.
+
 2008-12-18  Jan Hubicka  <jh@suse.cz>
            Kai Tietz <kai.tietz@onevision.com>
 
index a2df9bde9ae06e0f2da32d87da609cca28a3d2ab..397affd4b1fd71955ef6828f2eb15cffeb40a516 100644 (file)
@@ -142,8 +142,12 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
     ira_init_register_move_cost (mode);
 
   if (secondary_class != NO_REGS)
-    return (move_cost[mode][secondary_class][rclass] + sri.extra_cost
-           + copy_cost (x, mode, secondary_class, to_p, &sri));
+    {
+      if (!move_cost[mode])
+        init_move_cost (mode);
+      return (move_cost[mode][secondary_class][rclass] + sri.extra_cost
+             + copy_cost (x, mode, secondary_class, to_p, &sri));
+    }
 
   /* For memory, use the memory move cost, for (hard) registers, use
      the cost to move between the register classes, and use 2 for
@@ -151,8 +155,11 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
   if (MEM_P (x) || rclass == NO_REGS)
     return sri.extra_cost + ira_memory_move_cost[mode][rclass][to_p != 0];
   else if (REG_P (x))
-    return
-      (sri.extra_cost + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][rclass]);
+    {
+      if (!move_cost[mode])
+        init_move_cost (mode);
+      return (sri.extra_cost + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][rclass]);
+    }
   else
     /* If this is a constant, we may eventually want to call rtx_cost
        here.  */