Mercurial > hg > CbC > CbC_gcc
comparison gcc/dse.c @ 19:58ad6c70ea60
update gcc from 4.4.0 to 4.4.1.
author | kent@firefly.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Thu, 24 Sep 2009 13:21:57 +0900 |
parents | a06113de4d67 |
children | 855418dad1a3 |
comparison
equal
deleted
inserted
replaced
18:33936f7f2835 | 19:58ad6c70ea60 |
---|---|
221 cselib_val *cse_base; | 221 cselib_val *cse_base; |
222 | 222 |
223 /* This canonized mem. */ | 223 /* This canonized mem. */ |
224 rtx mem; | 224 rtx mem; |
225 | 225 |
226 /* The result of get_addr on mem. */ | 226 /* Canonized MEM address for use by canon_true_dependence. */ |
227 rtx mem_addr; | 227 rtx mem_addr; |
228 | 228 |
229 /* If this is non-zero, it is the alias set of a spill location. */ | 229 /* If this is non-zero, it is the alias set of a spill location. */ |
230 alias_set_type alias_set; | 230 alias_set_type alias_set; |
231 | 231 |
474 | 474 |
475 /* A mem wrapped around the base pointer for the group in order to | 475 /* A mem wrapped around the base pointer for the group in order to |
476 do read dependency. */ | 476 do read dependency. */ |
477 rtx base_mem; | 477 rtx base_mem; |
478 | 478 |
479 /* Canonized version of base_mem, most likely the same thing. */ | 479 /* Canonized version of base_mem's address. */ |
480 rtx canon_base_mem; | 480 rtx canon_base_addr; |
481 | 481 |
482 /* These two sets of two bitmaps are used to keep track of how many | 482 /* These two sets of two bitmaps are used to keep track of how many |
483 stores are actually referencing that position from this base. We | 483 stores are actually referencing that position from this base. We |
484 only do this for rtx bases as this will be used to assign | 484 only do this for rtx bases as this will be used to assign |
485 positions in the bitmaps for the global problem. Bit N is set in | 485 positions in the bitmaps for the global problem. Bit N is set in |
703 { | 703 { |
704 *slot = gi = (group_info_t) pool_alloc (rtx_group_info_pool); | 704 *slot = gi = (group_info_t) pool_alloc (rtx_group_info_pool); |
705 gi->rtx_base = base; | 705 gi->rtx_base = base; |
706 gi->id = rtx_group_next_id++; | 706 gi->id = rtx_group_next_id++; |
707 gi->base_mem = gen_rtx_MEM (QImode, base); | 707 gi->base_mem = gen_rtx_MEM (QImode, base); |
708 gi->canon_base_mem = canon_rtx (gi->base_mem); | 708 gi->canon_base_addr = canon_rtx (base); |
709 gi->store1_n = BITMAP_ALLOC (NULL); | 709 gi->store1_n = BITMAP_ALLOC (NULL); |
710 gi->store1_p = BITMAP_ALLOC (NULL); | 710 gi->store1_p = BITMAP_ALLOC (NULL); |
711 gi->store2_n = BITMAP_ALLOC (NULL); | 711 gi->store2_n = BITMAP_ALLOC (NULL); |
712 gi->store2_p = BITMAP_ALLOC (NULL); | 712 gi->store2_p = BITMAP_ALLOC (NULL); |
713 gi->group_kill = BITMAP_ALLOC (NULL); | 713 gi->group_kill = BITMAP_ALLOC (NULL); |
1284 local store group if so. */ | 1284 local store group if so. */ |
1285 | 1285 |
1286 static int | 1286 static int |
1287 record_store (rtx body, bb_info_t bb_info) | 1287 record_store (rtx body, bb_info_t bb_info) |
1288 { | 1288 { |
1289 rtx mem, rhs, const_rhs; | 1289 rtx mem, rhs, const_rhs, mem_addr; |
1290 HOST_WIDE_INT offset = 0; | 1290 HOST_WIDE_INT offset = 0; |
1291 HOST_WIDE_INT width = 0; | 1291 HOST_WIDE_INT width = 0; |
1292 alias_set_type spill_alias_set; | 1292 alias_set_type spill_alias_set; |
1293 insn_info_t insn_info = bb_info->last_insn; | 1293 insn_info_t insn_info = bb_info->last_insn; |
1294 store_info_t store_info = NULL; | 1294 store_info_t store_info = NULL; |
1454 /* Check to see if this stores causes some other stores to be | 1454 /* Check to see if this stores causes some other stores to be |
1455 dead. */ | 1455 dead. */ |
1456 ptr = active_local_stores; | 1456 ptr = active_local_stores; |
1457 last = NULL; | 1457 last = NULL; |
1458 redundant_reason = NULL; | 1458 redundant_reason = NULL; |
1459 mem = canon_rtx (mem); | |
1460 /* For alias_set != 0 canon_true_dependence should be never called. */ | |
1461 if (spill_alias_set) | |
1462 mem_addr = NULL_RTX; | |
1463 else | |
1464 { | |
1465 if (group_id < 0) | |
1466 mem_addr = base->val_rtx; | |
1467 else | |
1468 { | |
1469 group_info_t group | |
1470 = VEC_index (group_info_t, rtx_group_vec, group_id); | |
1471 mem_addr = group->canon_base_addr; | |
1472 } | |
1473 if (offset) | |
1474 mem_addr = plus_constant (mem_addr, offset); | |
1475 } | |
1459 | 1476 |
1460 while (ptr) | 1477 while (ptr) |
1461 { | 1478 { |
1462 insn_info_t next = ptr->next_local_store; | 1479 insn_info_t next = ptr->next_local_store; |
1463 store_info_t s_info = ptr->store_rec; | 1480 store_info_t s_info = ptr->store_rec; |
1545 keep it from being used to remove a load. */ | 1562 keep it from being used to remove a load. */ |
1546 { | 1563 { |
1547 if (canon_true_dependence (s_info->mem, | 1564 if (canon_true_dependence (s_info->mem, |
1548 GET_MODE (s_info->mem), | 1565 GET_MODE (s_info->mem), |
1549 s_info->mem_addr, | 1566 s_info->mem_addr, |
1550 mem, rtx_varies_p)) | 1567 mem, mem_addr, rtx_varies_p)) |
1551 { | 1568 { |
1552 s_info->rhs = NULL; | 1569 s_info->rhs = NULL; |
1553 s_info->const_rhs = NULL; | 1570 s_info->const_rhs = NULL; |
1554 } | 1571 } |
1555 } | 1572 } |
1556 | 1573 |
1557 /* An insn can be deleted if every position of every one of | 1574 /* An insn can be deleted if every position of every one of |
1558 its s_infos is zero. */ | 1575 its s_infos is zero. */ |
1559 if (any_positions_needed_p (s_info) | 1576 if (any_positions_needed_p (s_info) |
1560 || ptr->cannot_delete) | 1577 || ptr->cannot_delete) |
1561 del = false; | 1578 del = false; |
1578 } | 1595 } |
1579 | 1596 |
1580 /* Finish filling in the store_info. */ | 1597 /* Finish filling in the store_info. */ |
1581 store_info->next = insn_info->store_rec; | 1598 store_info->next = insn_info->store_rec; |
1582 insn_info->store_rec = store_info; | 1599 insn_info->store_rec = store_info; |
1583 store_info->mem = canon_rtx (mem); | 1600 store_info->mem = mem; |
1584 store_info->alias_set = spill_alias_set; | 1601 store_info->alias_set = spill_alias_set; |
1585 store_info->mem_addr = get_addr (XEXP (mem, 0)); | 1602 store_info->mem_addr = mem_addr; |
1586 store_info->cse_base = base; | 1603 store_info->cse_base = base; |
1587 if (width > HOST_BITS_PER_WIDE_INT) | 1604 if (width > HOST_BITS_PER_WIDE_INT) |
1588 { | 1605 { |
1589 store_info->is_large = true; | 1606 store_info->is_large = true; |
1590 store_info->positions_needed.large.count = 0; | 1607 store_info->positions_needed.large.count = 0; |
2004 appropriate stores that may be active. */ | 2021 appropriate stores that may be active. */ |
2005 | 2022 |
2006 static int | 2023 static int |
2007 check_mem_read_rtx (rtx *loc, void *data) | 2024 check_mem_read_rtx (rtx *loc, void *data) |
2008 { | 2025 { |
2009 rtx mem = *loc; | 2026 rtx mem = *loc, mem_addr; |
2010 bb_info_t bb_info; | 2027 bb_info_t bb_info; |
2011 insn_info_t insn_info; | 2028 insn_info_t insn_info; |
2012 HOST_WIDE_INT offset = 0; | 2029 HOST_WIDE_INT offset = 0; |
2013 HOST_WIDE_INT width = 0; | 2030 HOST_WIDE_INT width = 0; |
2014 alias_set_type spill_alias_set = 0; | 2031 alias_set_type spill_alias_set = 0; |
2056 read_info->alias_set = spill_alias_set; | 2073 read_info->alias_set = spill_alias_set; |
2057 read_info->begin = offset; | 2074 read_info->begin = offset; |
2058 read_info->end = offset + width; | 2075 read_info->end = offset + width; |
2059 read_info->next = insn_info->read_rec; | 2076 read_info->next = insn_info->read_rec; |
2060 insn_info->read_rec = read_info; | 2077 insn_info->read_rec = read_info; |
2078 /* For alias_set != 0 canon_true_dependence should be never called. */ | |
2079 if (spill_alias_set) | |
2080 mem_addr = NULL_RTX; | |
2081 else | |
2082 { | |
2083 if (group_id < 0) | |
2084 mem_addr = base->val_rtx; | |
2085 else | |
2086 { | |
2087 group_info_t group | |
2088 = VEC_index (group_info_t, rtx_group_vec, group_id); | |
2089 mem_addr = group->canon_base_addr; | |
2090 } | |
2091 if (offset) | |
2092 mem_addr = plus_constant (mem_addr, offset); | |
2093 } | |
2061 | 2094 |
2062 /* We ignore the clobbers in store_info. The is mildly aggressive, | 2095 /* We ignore the clobbers in store_info. The is mildly aggressive, |
2063 but there really should not be a clobber followed by a read. */ | 2096 but there really should not be a clobber followed by a read. */ |
2064 | 2097 |
2065 if (spill_alias_set) | 2098 if (spill_alias_set) |
2126 const base. */ | 2159 const base. */ |
2127 remove | 2160 remove |
2128 = canon_true_dependence (store_info->mem, | 2161 = canon_true_dependence (store_info->mem, |
2129 GET_MODE (store_info->mem), | 2162 GET_MODE (store_info->mem), |
2130 store_info->mem_addr, | 2163 store_info->mem_addr, |
2131 mem, rtx_varies_p); | 2164 mem, mem_addr, rtx_varies_p); |
2132 | 2165 |
2133 else if (group_id == store_info->group_id) | 2166 else if (group_id == store_info->group_id) |
2134 { | 2167 { |
2135 /* This is a block mode load. We may get lucky and | 2168 /* This is a block mode load. We may get lucky and |
2136 canon_true_dependence may save the day. */ | 2169 canon_true_dependence may save the day. */ |
2137 if (width == -1) | 2170 if (width == -1) |
2138 remove | 2171 remove |
2139 = canon_true_dependence (store_info->mem, | 2172 = canon_true_dependence (store_info->mem, |
2140 GET_MODE (store_info->mem), | 2173 GET_MODE (store_info->mem), |
2141 store_info->mem_addr, | 2174 store_info->mem_addr, |
2142 mem, rtx_varies_p); | 2175 mem, mem_addr, rtx_varies_p); |
2143 | 2176 |
2144 /* If this read is just reading back something that we just | 2177 /* If this read is just reading back something that we just |
2145 stored, rewrite the read. */ | 2178 stored, rewrite the read. */ |
2146 else | 2179 else |
2147 { | 2180 { |
2210 /* If this read is just reading back something that we just | 2243 /* If this read is just reading back something that we just |
2211 stored, rewrite the read. */ | 2244 stored, rewrite the read. */ |
2212 if (store_info->rhs | 2245 if (store_info->rhs |
2213 && store_info->group_id == -1 | 2246 && store_info->group_id == -1 |
2214 && store_info->cse_base == base | 2247 && store_info->cse_base == base |
2248 && width != -1 | |
2215 && offset >= store_info->begin | 2249 && offset >= store_info->begin |
2216 && offset + width <= store_info->end | 2250 && offset + width <= store_info->end |
2217 && all_positions_needed_p (store_info, | 2251 && all_positions_needed_p (store_info, |
2218 offset - store_info->begin, width) | 2252 offset - store_info->begin, width) |
2219 && replace_read (store_info, i_ptr, read_info, insn_info, loc, | 2253 && replace_read (store_info, i_ptr, read_info, insn_info, loc, |
2222 | 2256 |
2223 if (!store_info->alias_set) | 2257 if (!store_info->alias_set) |
2224 remove = canon_true_dependence (store_info->mem, | 2258 remove = canon_true_dependence (store_info->mem, |
2225 GET_MODE (store_info->mem), | 2259 GET_MODE (store_info->mem), |
2226 store_info->mem_addr, | 2260 store_info->mem_addr, |
2227 mem, rtx_varies_p); | 2261 mem, mem_addr, rtx_varies_p); |
2228 | 2262 |
2229 if (remove) | 2263 if (remove) |
2230 { | 2264 { |
2231 if (dump_file) | 2265 if (dump_file) |
2232 dump_insn_info ("removing from active", i_ptr); | 2266 dump_insn_info ("removing from active", i_ptr); |
3064 something else with a different constant | 3098 something else with a different constant |
3065 base. */ | 3099 base. */ |
3066 if ((read_info->group_id < 0) | 3100 if ((read_info->group_id < 0) |
3067 && canon_true_dependence (group->base_mem, | 3101 && canon_true_dependence (group->base_mem, |
3068 QImode, | 3102 QImode, |
3069 group->canon_base_mem, | 3103 group->canon_base_addr, |
3070 read_info->mem, rtx_varies_p)) | 3104 read_info->mem, NULL_RTX, |
3105 rtx_varies_p)) | |
3071 { | 3106 { |
3072 if (kill) | 3107 if (kill) |
3073 bitmap_ior_into (kill, group->group_kill); | 3108 bitmap_ior_into (kill, group->group_kill); |
3074 bitmap_and_compl_into (gen, group->group_kill); | 3109 bitmap_and_compl_into (gen, group->group_kill); |
3075 } | 3110 } |