OSDN Git Service

PR 49214 fd_gets should return NULL if nothing was read
[pf3gnuchains/gcc-fork.git] / gcc / ira-costs.c
index 4a3083a..f517386 100644 (file)
@@ -1294,7 +1294,8 @@ scan_one_insn (rtx insn)
       && (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != NULL_RTX
       && ((MEM_P (XEXP (note, 0)))
          || (CONSTANT_P (XEXP (note, 0))
-             && LEGITIMATE_CONSTANT_P (XEXP (note, 0))
+             && targetm.legitimate_constant_p (GET_MODE (SET_DEST (set)),
+                                               XEXP (note, 0))
              && REG_N_SETS (REGNO (SET_DEST (set))) == 1)))
     {
       enum reg_class cl = GENERAL_REGS;
@@ -1652,7 +1653,7 @@ find_costs_and_classes (FILE *dump_file)
                        i_costs[k] += add_cost;
                    }
                  add_cost = COSTS (costs, a_num)->mem_cost;
-                 if (add_cost && INT_MAX - add_cost < i_mem_cost)
+                 if (add_cost > 0 && INT_MAX - add_cost < i_mem_cost)
                    i_mem_cost = INT_MAX;
                  else
                    i_mem_cost += add_cost;
@@ -1663,10 +1664,10 @@ find_costs_and_classes (FILE *dump_file)
                }
            }
          if (equiv_savings < 0)
-           temp_costs->mem_cost = -equiv_savings;
+           i_mem_cost = -equiv_savings;
          else if (equiv_savings > 0)
            {
-             temp_costs->mem_cost = 0;
+             i_mem_cost = 0;
              for (k = cost_classes_ptr->num - 1; k >= 0; k--)
                i_costs[k] += equiv_savings;
            }
@@ -1887,7 +1888,7 @@ process_bb_node_for_hard_reg_moves (ira_loop_tree_node_t loop_tree_node)
       ALLOCNO_HARD_REG_COSTS (a)[i] -= cost;
       ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[i] -= cost;
       ALLOCNO_CLASS_COST (a) = MIN (ALLOCNO_CLASS_COST (a),
-                                         ALLOCNO_HARD_REG_COSTS (a)[i]);
+                                   ALLOCNO_HARD_REG_COSTS (a)[i]);
     }
 }
 
@@ -1968,19 +1969,15 @@ free_ira_costs (void)
 {
   int i;
 
-  if (init_cost != NULL)
-    free (init_cost);
+  free (init_cost);
   init_cost = NULL;
   for (i = 0; i < MAX_RECOG_OPERANDS; i++)
     {
-      if (op_costs[i] != NULL)
-       free (op_costs[i]);
-      if (this_op_costs[i] != NULL)
-       free (this_op_costs[i]);
+      free (op_costs[i]);
+      free (this_op_costs[i]);
       op_costs[i] = this_op_costs[i] = NULL;
     }
-  if (temp_costs != NULL)
-    free (temp_costs);
+  free (temp_costs);
   temp_costs = NULL;
 }