48 // |
48 // |
49 // As a side effect, unlink from (hence make dead) coalesced copies. |
49 // As a side effect, unlink from (hence make dead) coalesced copies. |
50 // |
50 // |
51 |
51 |
52 static const char out_of_nodes[] = "out of nodes during split"; |
52 static const char out_of_nodes[] = "out of nodes during split"; |
53 |
|
54 static bool contains_no_live_range_input(const Node* def) { |
|
55 for (uint i = 1; i < def->req(); ++i) { |
|
56 if (def->in(i) != NULL && def->in_RegMask(i).is_NotEmpty()) { |
|
57 return false; |
|
58 } |
|
59 } |
|
60 return true; |
|
61 } |
|
62 |
53 |
63 //------------------------------get_spillcopy_wide----------------------------- |
54 //------------------------------get_spillcopy_wide----------------------------- |
64 // Get a SpillCopy node with wide-enough masks. Use the 'wide-mask', the |
55 // Get a SpillCopy node with wide-enough masks. Use the 'wide-mask', the |
65 // wide ideal-register spill-mask if possible. If the 'wide-mask' does |
56 // wide ideal-register spill-mask if possible. If the 'wide-mask' does |
66 // not cover the input (or output), use the input (or output) mask instead. |
57 // not cover the input (or output), use the input (or output) mask instead. |
324 // same time - a definite no-no. Split out private copies of |
315 // same time - a definite no-no. Split out private copies of |
325 // the inputs. |
316 // the inputs. |
326 if( def->req() > 1 ) { |
317 if( def->req() > 1 ) { |
327 for( uint i = 1; i < def->req(); i++ ) { |
318 for( uint i = 1; i < def->req(); i++ ) { |
328 Node *in = def->in(i); |
319 Node *in = def->in(i); |
329 // Check for single-def (LRG cannot redefined) |
|
330 uint lidx = _lrg_map.live_range_id(in); |
320 uint lidx = _lrg_map.live_range_id(in); |
331 if (lidx >= _lrg_map.max_lrg_id()) { |
321 // We do not need this for live ranges that are only defined once. |
332 continue; // Value is a recent spill-copy |
322 // However, this is not true for spill copies that are added in this |
333 } |
323 // Split() pass, since they might get coalesced later on in this pass. |
334 if (lrgs(lidx).is_singledef()) { |
324 if (lidx < _lrg_map.max_lrg_id() && lrgs(lidx).is_singledef()) { |
335 continue; |
325 continue; |
336 } |
326 } |
337 |
327 |
338 Block *b_def = _cfg.get_block_for_node(def); |
328 Block *b_def = _cfg.get_block_for_node(def); |
339 int idx_def = b_def->find_node(def); |
329 int idx_def = b_def->find_node(def); |
1325 pidx = pred->_pre_order; |
1315 pidx = pred->_pre_order; |
1326 // Grab reaching def |
1316 // Grab reaching def |
1327 Node *def = Reaches[pidx][slidx]; |
1317 Node *def = Reaches[pidx][slidx]; |
1328 assert( def, "must have reaching def" ); |
1318 assert( def, "must have reaching def" ); |
1329 // If input up/down sense and reg-pressure DISagree |
1319 // If input up/down sense and reg-pressure DISagree |
1330 if (def->rematerialize() && contains_no_live_range_input(def)) { |
1320 if (def->rematerialize()) { |
1331 // Place the rematerialized node above any MSCs created during |
1321 // Place the rematerialized node above any MSCs created during |
1332 // phi node splitting. end_idx points at the insertion point |
1322 // phi node splitting. end_idx points at the insertion point |
1333 // so look at the node before it. |
1323 // so look at the node before it. |
1334 int insert = pred->end_idx(); |
1324 int insert = pred->end_idx(); |
1335 while (insert >= 1 && |
1325 while (insert >= 1 && |