Mercurial > hg > CbC > CbC_gcc
comparison gcc/bb-reorder.c @ 67:f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author | nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Mar 2011 17:18:12 +0900 |
parents | b7f97abdc517 |
children | 04ced10e8804 |
comparison
equal
deleted
inserted
replaced
65:65488c3d617d | 67:f6334be47118 |
---|---|
80 #include "function.h" | 80 #include "function.h" |
81 #include "tm_p.h" | 81 #include "tm_p.h" |
82 #include "obstack.h" | 82 #include "obstack.h" |
83 #include "expr.h" | 83 #include "expr.h" |
84 #include "params.h" | 84 #include "params.h" |
85 #include "toplev.h" | 85 #include "diagnostic-core.h" |
86 #include "toplev.h" /* user_defined_section_attribute */ | |
86 #include "tree-pass.h" | 87 #include "tree-pass.h" |
87 #include "df.h" | 88 #include "df.h" |
89 #include "bb-reorder.h" | |
88 | 90 |
89 /* The number of rounds. In most cases there will only be 4 rounds, but | 91 /* The number of rounds. In most cases there will only be 4 rounds, but |
90 when partitioning hot and cold basic blocks into separate sections of | 92 when partitioning hot and cold basic blocks into separate sections of |
91 the .o file there will be an extra round.*/ | 93 the .o file there will be an extra round.*/ |
92 #define N_ROUNDS 5 | 94 #define N_ROUNDS 5 |
98 #define HAVE_return 0 | 100 #define HAVE_return 0 |
99 #define gen_return() NULL_RTX | 101 #define gen_return() NULL_RTX |
100 #endif | 102 #endif |
101 | 103 |
102 | 104 |
105 struct target_bb_reorder default_target_bb_reorder; | |
106 #if SWITCHABLE_TARGET | |
107 struct target_bb_reorder *this_target_bb_reorder = &default_target_bb_reorder; | |
108 #endif | |
109 | |
110 #define uncond_jump_length \ | |
111 (this_target_bb_reorder->x_uncond_jump_length) | |
112 | |
103 /* Branch thresholds in thousandths (per mille) of the REG_BR_PROB_BASE. */ | 113 /* Branch thresholds in thousandths (per mille) of the REG_BR_PROB_BASE. */ |
104 static int branch_threshold[N_ROUNDS] = {400, 200, 100, 0, 0}; | 114 static int branch_threshold[N_ROUNDS] = {400, 200, 100, 0, 0}; |
105 | 115 |
106 /* Exec thresholds in thousandths (per mille) of the frequency of bb 0. */ | 116 /* Exec thresholds in thousandths (per mille) of the frequency of bb 0. */ |
107 static int exec_threshold[N_ROUNDS] = {500, 200, 50, 0, 0}; | 117 static int exec_threshold[N_ROUNDS] = {500, 200, 50, 0, 0}; |
108 | 118 |
109 /* If edge frequency is lower than DUPLICATION_THRESHOLD per mille of entry | 119 /* If edge frequency is lower than DUPLICATION_THRESHOLD per mille of entry |
110 block the edge destination is not duplicated while connecting traces. */ | 120 block the edge destination is not duplicated while connecting traces. */ |
111 #define DUPLICATION_THRESHOLD 100 | 121 #define DUPLICATION_THRESHOLD 100 |
112 | |
113 /* Length of unconditional jump instruction. */ | |
114 static int uncond_jump_length; | |
115 | 122 |
116 /* Structure to hold needed information for each basic block. */ | 123 /* Structure to hold needed information for each basic block. */ |
117 typedef struct bbro_basic_block_data_def | 124 typedef struct bbro_basic_block_data_def |
118 { | 125 { |
119 /* Which trace is the bb start of (-1 means it is not a start of a trace). */ | 126 /* Which trace is the bb start of (-1 means it is not a start of a trace). */ |
1290 with a call_insn; this case will be handled in | 1297 with a call_insn; this case will be handled in |
1291 fix_up_fall_thru_edges function. */ | 1298 fix_up_fall_thru_edges function. */ |
1292 | 1299 |
1293 if (src && (src != ENTRY_BLOCK_PTR)) | 1300 if (src && (src != ENTRY_BLOCK_PTR)) |
1294 { | 1301 { |
1295 if (!JUMP_P (BB_END (src)) && !block_ends_with_call_p (src)) | 1302 if (!JUMP_P (BB_END (src)) |
1303 && !block_ends_with_call_p (src) | |
1304 && !can_throw_internal (BB_END (src))) | |
1296 /* bb just falls through. */ | 1305 /* bb just falls through. */ |
1297 { | 1306 { |
1298 /* make sure there's only one successor */ | 1307 /* make sure there's only one successor */ |
1299 gcc_assert (single_succ_p (src)); | 1308 gcc_assert (single_succ_p (src)); |
1300 | 1309 |
1307 JUMP_LABEL (new_jump) = label; | 1316 JUMP_LABEL (new_jump) = label; |
1308 LABEL_NUSES (label) += 1; | 1317 LABEL_NUSES (label) += 1; |
1309 src->il.rtl->footer = unlink_insn_chain (barrier, barrier); | 1318 src->il.rtl->footer = unlink_insn_chain (barrier, barrier); |
1310 /* Mark edge as non-fallthru. */ | 1319 /* Mark edge as non-fallthru. */ |
1311 crossing_edges[i]->flags &= ~EDGE_FALLTHRU; | 1320 crossing_edges[i]->flags &= ~EDGE_FALLTHRU; |
1312 } /* end: 'if (GET_CODE ... ' */ | 1321 } /* end: 'if (!JUMP_P ... ' */ |
1313 } /* end: 'if (src && src->index...' */ | 1322 } /* end: 'if (src && src !=...' */ |
1314 } /* end: 'if (dest && dest->index...' */ | 1323 } /* end: 'if (dest && dest !=...' */ |
1315 } /* end: 'if (crossing_edges[i]...' */ | 1324 } /* end: 'if (crossing_edges[i]...' */ |
1316 } /* end for loop */ | 1325 } /* end for loop */ |
1317 } | 1326 } |
1318 | 1327 |
1319 /* Find any bb's where the fall-through edge is a crossing edge (note that | 1328 /* Find any bb's where the fall-through edge is a crossing edge (note that |
1366 && (succ2->flags & EDGE_FALLTHRU)) | 1375 && (succ2->flags & EDGE_FALLTHRU)) |
1367 { | 1376 { |
1368 fall_thru = succ2; | 1377 fall_thru = succ2; |
1369 cond_jump = succ1; | 1378 cond_jump = succ1; |
1370 } | 1379 } |
1371 else if (!fall_thru && succ1 && block_ends_with_call_p (cur_bb)) | 1380 else if (succ1 |
1372 { | 1381 && (block_ends_with_call_p (cur_bb) |
1373 edge e; | 1382 || can_throw_internal (BB_END (cur_bb)))) |
1374 edge_iterator ei; | 1383 { |
1375 | 1384 edge e; |
1376 /* Find EDGE_CAN_FALLTHRU edge. */ | 1385 edge_iterator ei; |
1377 FOR_EACH_EDGE (e, ei, cur_bb->succs) | 1386 |
1378 if (e->flags & EDGE_CAN_FALLTHRU) | 1387 /* Find EDGE_CAN_FALLTHRU edge. */ |
1379 { | 1388 FOR_EACH_EDGE (e, ei, cur_bb->succs) |
1380 fall_thru = e; | 1389 if (e->flags & EDGE_CAN_FALLTHRU) |
1381 break; | 1390 { |
1382 } | 1391 fall_thru = e; |
1383 } | 1392 break; |
1393 } | |
1394 } | |
1384 | 1395 |
1385 if (fall_thru && (fall_thru->dest != EXIT_BLOCK_PTR)) | 1396 if (fall_thru && (fall_thru->dest != EXIT_BLOCK_PTR)) |
1386 { | 1397 { |
1387 /* Check to see if the fall-thru edge is a crossing edge. */ | 1398 /* Check to see if the fall-thru edge is a crossing edge. */ |
1388 | 1399 |