comparison gcc/ira-build.c @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children b7f97abdc517
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
56 56
57 /* All nodes representing loops are referred through the following 57 /* All nodes representing loops are referred through the following
58 array. */ 58 array. */
59 ira_loop_tree_node_t ira_loop_nodes; 59 ira_loop_tree_node_t ira_loop_nodes;
60 60
61 /* Map regno -> allocnos with given regno (see comments for 61 /* Map regno -> allocnos with given regno (see comments for
62 allocno member `next_regno_allocno'). */ 62 allocno member `next_regno_allocno'). */
63 ira_allocno_t *ira_regno_allocno_map; 63 ira_allocno_t *ira_regno_allocno_map;
64 64
65 /* Array of references to all allocnos. The order number of the 65 /* Array of references to all allocnos. The order number of the
66 allocno corresponds to the index in the array. Removed allocnos 66 allocno corresponds to the index in the array. Removed allocnos
466 ALLOCNO_COPIES (a) = NULL; 466 ALLOCNO_COPIES (a) = NULL;
467 ALLOCNO_HARD_REG_COSTS (a) = NULL; 467 ALLOCNO_HARD_REG_COSTS (a) = NULL;
468 ALLOCNO_CONFLICT_HARD_REG_COSTS (a) = NULL; 468 ALLOCNO_CONFLICT_HARD_REG_COSTS (a) = NULL;
469 ALLOCNO_UPDATED_HARD_REG_COSTS (a) = NULL; 469 ALLOCNO_UPDATED_HARD_REG_COSTS (a) = NULL;
470 ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) = NULL; 470 ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) = NULL;
471 ALLOCNO_LEFT_CONFLICTS_NUM (a) = -1; 471 ALLOCNO_LEFT_CONFLICTS_SIZE (a) = -1;
472 ALLOCNO_COVER_CLASS (a) = NO_REGS; 472 ALLOCNO_COVER_CLASS (a) = NO_REGS;
473 ALLOCNO_UPDATED_COVER_CLASS_COST (a) = 0; 473 ALLOCNO_UPDATED_COVER_CLASS_COST (a) = 0;
474 ALLOCNO_COVER_CLASS_COST (a) = 0; 474 ALLOCNO_COVER_CLASS_COST (a) = 0;
475 ALLOCNO_MEMORY_COST (a) = 0; 475 ALLOCNO_MEMORY_COST (a) = 0;
476 ALLOCNO_UPDATED_MEMORY_COST (a) = 0; 476 ALLOCNO_UPDATED_MEMORY_COST (a) = 0;
846 } 846 }
847 847
848 /* Merge ranges R1 and R2 and returns the result. The function 848 /* Merge ranges R1 and R2 and returns the result. The function
849 maintains the order of ranges and tries to minimize number of the 849 maintains the order of ranges and tries to minimize number of the
850 result ranges. */ 850 result ranges. */
851 allocno_live_range_t 851 allocno_live_range_t
852 ira_merge_allocno_live_ranges (allocno_live_range_t r1, 852 ira_merge_allocno_live_ranges (allocno_live_range_t r1,
853 allocno_live_range_t r2) 853 allocno_live_range_t r2)
854 { 854 {
855 allocno_live_range_t first, last, temp; 855 allocno_live_range_t first, last, temp;
856 856
1377 ira_curr_loop_tree_node = loop_node; 1377 ira_curr_loop_tree_node = loop_node;
1378 ira_curr_regno_allocno_map = ira_curr_loop_tree_node->regno_allocno_map; 1378 ira_curr_regno_allocno_map = ira_curr_loop_tree_node->regno_allocno_map;
1379 1379
1380 if (preorder_func != NULL) 1380 if (preorder_func != NULL)
1381 (*preorder_func) (loop_node); 1381 (*preorder_func) (loop_node);
1382 1382
1383 if (bb_p) 1383 if (bb_p)
1384 for (subloop_node = loop_node->children; 1384 for (subloop_node = loop_node->children;
1385 subloop_node != NULL; 1385 subloop_node != NULL;
1386 subloop_node = subloop_node->next) 1386 subloop_node = subloop_node->next)
1387 if (subloop_node->bb != NULL) 1387 if (subloop_node->bb != NULL)
1388 { 1388 {
1389 if (preorder_func != NULL) 1389 if (preorder_func != NULL)
1390 (*preorder_func) (subloop_node); 1390 (*preorder_func) (subloop_node);
1391 1391
1392 if (postorder_func != NULL) 1392 if (postorder_func != NULL)
1393 (*postorder_func) (subloop_node); 1393 (*postorder_func) (subloop_node);
1394 } 1394 }
1395 1395
1396 for (subloop_node = loop_node->subloops; 1396 for (subloop_node = loop_node->subloops;
1397 subloop_node != NULL; 1397 subloop_node != NULL;
1398 subloop_node = subloop_node->subloop_next) 1398 subloop_node = subloop_node->subloop_next)
1399 { 1399 {
1400 ira_assert (subloop_node->bb == NULL); 1400 ira_assert (subloop_node->bb == NULL);
1432 { 1432 {
1433 ira_allocno_t a; 1433 ira_allocno_t a;
1434 1434
1435 if ((a = ira_curr_regno_allocno_map[regno]) == NULL) 1435 if ((a = ira_curr_regno_allocno_map[regno]) == NULL)
1436 a = ira_create_allocno (regno, false, ira_curr_loop_tree_node); 1436 a = ira_create_allocno (regno, false, ira_curr_loop_tree_node);
1437 1437
1438 ALLOCNO_NREFS (a)++; 1438 ALLOCNO_NREFS (a)++;
1439 ALLOCNO_FREQ (a) += REG_FREQ_FROM_BB (curr_bb); 1439 ALLOCNO_FREQ (a) += REG_FREQ_FROM_BB (curr_bb);
1440 if (output_p) 1440 if (output_p)
1441 bitmap_set_bit (ira_curr_loop_tree_node->modified_regnos, regno); 1441 bitmap_set_bit (ira_curr_loop_tree_node->modified_regnos, regno);
1442 } 1442 }
1456 else if (code == MEM) 1456 else if (code == MEM)
1457 { 1457 {
1458 create_insn_allocnos (XEXP (x, 0), false); 1458 create_insn_allocnos (XEXP (x, 0), false);
1459 return; 1459 return;
1460 } 1460 }
1461 else if (code == PRE_DEC || code == POST_DEC || code == PRE_INC || 1461 else if (code == PRE_DEC || code == POST_DEC || code == PRE_INC ||
1462 code == POST_INC || code == POST_MODIFY || code == PRE_MODIFY) 1462 code == POST_INC || code == POST_MODIFY || code == PRE_MODIFY)
1463 { 1463 {
1464 create_insn_allocnos (XEXP (x, 0), true); 1464 create_insn_allocnos (XEXP (x, 0), true);
1465 create_insn_allocnos (XEXP (x, 0), false); 1465 create_insn_allocnos (XEXP (x, 0), false);
1466 return; 1466 return;
1489 bitmap_iterator bi; 1489 bitmap_iterator bi;
1490 1490
1491 curr_bb = bb = bb_node->bb; 1491 curr_bb = bb = bb_node->bb;
1492 ira_assert (bb != NULL); 1492 ira_assert (bb != NULL);
1493 FOR_BB_INSNS_REVERSE (bb, insn) 1493 FOR_BB_INSNS_REVERSE (bb, insn)
1494 if (INSN_P (insn)) 1494 if (NONDEBUG_INSN_P (insn))
1495 create_insn_allocnos (PATTERN (insn), false); 1495 create_insn_allocnos (PATTERN (insn), false);
1496 /* It might be a allocno living through from one subloop to 1496 /* It might be a allocno living through from one subloop to
1497 another. */ 1497 another. */
1498 EXECUTE_IF_SET_IN_REG_SET (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, i, bi) 1498 EXECUTE_IF_SET_IN_REG_SET (DF_LR_IN (bb), FIRST_PSEUDO_REGISTER, i, bi)
1499 if (ira_curr_regno_allocno_map[i] == NULL) 1499 if (ira_curr_regno_allocno_map[i] == NULL)
1547 VEC (edge, heap) *edges; 1547 VEC (edge, heap) *edges;
1548 1548
1549 FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds) 1549 FOR_EACH_EDGE (e, ei, loop_node->loop->header->preds)
1550 if (e->src != loop_node->loop->latch) 1550 if (e->src != loop_node->loop->latch)
1551 create_loop_allocnos (e); 1551 create_loop_allocnos (e);
1552 1552
1553 edges = get_loop_exit_edges (loop_node->loop); 1553 edges = get_loop_exit_edges (loop_node->loop);
1554 for (i = 0; VEC_iterate (edge, edges, i, e); i++) 1554 for (i = 0; VEC_iterate (edge, edges, i, e); i++)
1555 create_loop_allocnos (e); 1555 create_loop_allocnos (e);
1556 VEC_free (edge, heap, edges); 1556 VEC_free (edge, heap, edges);
1557 } 1557 }
1661 static bool 1661 static bool
1662 low_pressure_loop_node_p (ira_loop_tree_node_t node) 1662 low_pressure_loop_node_p (ira_loop_tree_node_t node)
1663 { 1663 {
1664 int i; 1664 int i;
1665 enum reg_class cover_class; 1665 enum reg_class cover_class;
1666 1666
1667 if (node->bb != NULL) 1667 if (node->bb != NULL)
1668 return false; 1668 return false;
1669 1669
1670 for (i = 0; i < ira_reg_class_cover_size; i++) 1670 for (i = 0; i < ira_reg_class_cover_size; i++)
1671 { 1671 {
1672 cover_class = ira_reg_class_cover[i]; 1672 cover_class = ira_reg_class_cover[i];
1673 if (node->reg_pressure[cover_class] 1673 if (node->reg_pressure[cover_class]
1674 > ira_available_class_regs[cover_class]) 1674 > ira_available_class_regs[cover_class])
1871 for (n = 0, a = ira_regno_allocno_map[regno]; 1871 for (n = 0, a = ira_regno_allocno_map[regno];
1872 a != NULL; 1872 a != NULL;
1873 a = ALLOCNO_NEXT_REGNO_ALLOCNO (a)) 1873 a = ALLOCNO_NEXT_REGNO_ALLOCNO (a))
1874 regno_allocnos[n++] = a; 1874 regno_allocnos[n++] = a;
1875 ira_assert (n > 0); 1875 ira_assert (n > 0);
1876 qsort (regno_allocnos, n, sizeof (ira_allocno_t), 1876 qsort (regno_allocnos, n, sizeof (ira_allocno_t),
1877 regno_allocno_order_compare_func); 1877 regno_allocno_order_compare_func);
1878 for (i = 1; i < n; i++) 1878 for (i = 1; i < n; i++)
1879 ALLOCNO_NEXT_REGNO_ALLOCNO (regno_allocnos[i - 1]) = regno_allocnos[i]; 1879 ALLOCNO_NEXT_REGNO_ALLOCNO (regno_allocnos[i - 1]) = regno_allocnos[i];
1880 ALLOCNO_NEXT_REGNO_ALLOCNO (regno_allocnos[n - 1]) = NULL; 1880 ALLOCNO_NEXT_REGNO_ALLOCNO (regno_allocnos[n - 1]) = NULL;
1881 ira_regno_allocno_map[regno] = regno_allocnos[0]; 1881 ira_regno_allocno_map[regno] = regno_allocnos[0];
2300 while (first_not_finished < i 2300 while (first_not_finished < i
2301 && start > ALLOCNO_MAX (ira_conflict_id_allocno_map 2301 && start > ALLOCNO_MAX (ira_conflict_id_allocno_map
2302 [first_not_finished])) 2302 [first_not_finished]))
2303 first_not_finished++; 2303 first_not_finished++;
2304 min = first_not_finished; 2304 min = first_not_finished;
2305 } 2305 }
2306 if (min == i) 2306 if (min == i)
2307 /* We could increase min further in this case but it is good 2307 /* We could increase min further in this case but it is good
2308 enough. */ 2308 enough. */
2309 min++; 2309 min++;
2310 live_range_min[i] = ALLOCNO_MIN (a); 2310 live_range_min[i] = ALLOCNO_MIN (a);
2392 removed stores at a loop exit. Return true if we copied live 2392 removed stores at a loop exit. Return true if we copied live
2393 ranges. */ 2393 ranges. */
2394 static bool 2394 static bool
2395 copy_info_to_removed_store_destinations (int regno) 2395 copy_info_to_removed_store_destinations (int regno)
2396 { 2396 {
2397 ira_allocno_t a, parent_a; 2397 ira_allocno_t a;
2398 ira_allocno_t parent_a = NULL;
2398 ira_loop_tree_node_t parent; 2399 ira_loop_tree_node_t parent;
2399 allocno_live_range_t r; 2400 allocno_live_range_t r;
2400 bool merged_p; 2401 bool merged_p;
2401 2402
2402 merged_p = false; 2403 merged_p = false;
2509 ALLOCNO_COPIES (a) = NULL; 2510 ALLOCNO_COPIES (a) = NULL;
2510 regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] = a; 2511 regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))] = a;
2511 continue; 2512 continue;
2512 } 2513 }
2513 ira_assert (ALLOCNO_CAP_MEMBER (parent_a) == NULL); 2514 ira_assert (ALLOCNO_CAP_MEMBER (parent_a) == NULL);
2514 2515
2515 if (ALLOCNO_MEM_OPTIMIZED_DEST (a) != NULL) 2516 if (ALLOCNO_MEM_OPTIMIZED_DEST (a) != NULL)
2516 mem_dest_p = true; 2517 mem_dest_p = true;
2517 if (REGNO (ALLOCNO_REG (a)) == REGNO (ALLOCNO_REG (parent_a))) 2518 if (REGNO (ALLOCNO_REG (a)) == REGNO (ALLOCNO_REG (parent_a)))
2518 { 2519 {
2519 IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (parent_a), 2520 IOR_HARD_REG_SET (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (parent_a),
2620 /* Don't set up conflict for the allocno with itself. */ 2621 /* Don't set up conflict for the allocno with itself. */
2621 && num != (int) n) 2622 && num != (int) n)
2622 ira_add_allocno_conflict (a, live_a); 2623 ira_add_allocno_conflict (a, live_a);
2623 } 2624 }
2624 } 2625 }
2625 2626
2626 for (r = ira_finish_point_ranges[i]; r != NULL; r = r->finish_next) 2627 for (r = ira_finish_point_ranges[i]; r != NULL; r = r->finish_next)
2627 sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (r->allocno)); 2628 sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (r->allocno));
2628 } 2629 }
2629 sparseset_free (allocnos_live); 2630 sparseset_free (allocnos_live);
2630 compress_conflict_vecs (); 2631 compress_conflict_vecs ();