24 |
24 |
25 #include "incls/_precompiled.incl" |
25 #include "incls/_precompiled.incl" |
26 #include "incls/_reg_split.cpp.incl" |
26 #include "incls/_reg_split.cpp.incl" |
27 |
27 |
28 //------------------------------Split-------------------------------------- |
28 //------------------------------Split-------------------------------------- |
29 // Walk the graph in RPO and for each lrg which spills, propogate reaching |
29 // Walk the graph in RPO and for each lrg which spills, propagate reaching |
30 // definitions. During propogation, split the live range around regions of |
30 // definitions. During propagation, split the live range around regions of |
31 // High Register Pressure (HRP). If a Def is in a region of Low Register |
31 // High Register Pressure (HRP). If a Def is in a region of Low Register |
32 // Pressure (LRP), it will not get spilled until we encounter a region of |
32 // Pressure (LRP), it will not get spilled until we encounter a region of |
33 // HRP between it and one of its uses. We will spill at the transition |
33 // HRP between it and one of its uses. We will spill at the transition |
34 // point between LRP and HRP. Uses in the HRP region will use the spilled |
34 // point between LRP and HRP. Uses in the HRP region will use the spilled |
35 // Def. The first Use outside the HRP region will generate a SpillCopy to |
35 // Def. The first Use outside the HRP region will generate a SpillCopy to |
86 } |
86 } |
87 return new (C) MachSpillCopyNode( def, *w_i_mask, *w_o_mask ); |
87 return new (C) MachSpillCopyNode( def, *w_i_mask, *w_o_mask ); |
88 } |
88 } |
89 |
89 |
90 //------------------------------insert_proj------------------------------------ |
90 //------------------------------insert_proj------------------------------------ |
91 // Insert the spill at chosen location. Skip over any interveneing Proj's or |
91 // Insert the spill at chosen location. Skip over any intervening Proj's or |
92 // Phis. Skip over a CatchNode and projs, inserting in the fall-through block |
92 // Phis. Skip over a CatchNode and projs, inserting in the fall-through block |
93 // instead. Update high-pressure indices. Create a new live range. |
93 // instead. Update high-pressure indices. Create a new live range. |
94 void PhaseChaitin::insert_proj( Block *b, uint i, Node *spill, uint maxlrg ) { |
94 void PhaseChaitin::insert_proj( Block *b, uint i, Node *spill, uint maxlrg ) { |
95 // Skip intervening ProjNodes. Do not insert between a ProjNode and |
95 // Skip intervening ProjNodes. Do not insert between a ProjNode and |
96 // its definer. |
96 // its definer. |
123 // the node->live range mapping. |
123 // the node->live range mapping. |
124 new_lrg(spill,maxlrg); |
124 new_lrg(spill,maxlrg); |
125 } |
125 } |
126 |
126 |
127 //------------------------------split_DEF-------------------------------------- |
127 //------------------------------split_DEF-------------------------------------- |
128 // There are four catagories of Split; UP/DOWN x DEF/USE |
128 // There are four categories of Split; UP/DOWN x DEF/USE |
129 // Only three of these really occur as DOWN/USE will always color |
129 // Only three of these really occur as DOWN/USE will always color |
130 // Any Split with a DEF cannot CISC-Spill now. Thus we need |
130 // Any Split with a DEF cannot CISC-Spill now. Thus we need |
131 // two helper routines, one for Split DEFS (insert after instruction), |
131 // two helper routines, one for Split DEFS (insert after instruction), |
132 // one for Split USES (insert before instruction). DEF insertion |
132 // one for Split USES (insert before instruction). DEF insertion |
133 // happens inside Split, where the Leaveblock array is updated. |
133 // happens inside Split, where the Leaveblock array is updated. |
724 !b->_nodes[b->_fhrp_index]->is_Proj(), "" ); |
724 !b->_nodes[b->_fhrp_index]->is_Proj(), "" ); |
725 |
725 |
726 // ********** Handle Crossing HRP Boundry ********** |
726 // ********** Handle Crossing HRP Boundry ********** |
727 if( (insidx == b->_ihrp_index) || (insidx == b->_fhrp_index) ) { |
727 if( (insidx == b->_ihrp_index) || (insidx == b->_fhrp_index) ) { |
728 for( slidx = 0; slidx < spill_cnt; slidx++ ) { |
728 for( slidx = 0; slidx < spill_cnt; slidx++ ) { |
729 // Check for need to split at HRP boundry - split if UP |
729 // Check for need to split at HRP boundary - split if UP |
730 n1 = Reachblock[slidx]; |
730 n1 = Reachblock[slidx]; |
731 // bail out if no reaching DEF |
731 // bail out if no reaching DEF |
732 if( n1 == NULL ) continue; |
732 if( n1 == NULL ) continue; |
733 // bail out if live range is 'isolated' around inner loop |
733 // bail out if live range is 'isolated' around inner loop |
734 uint lidx = lidxs.at(slidx); |
734 uint lidx = lidxs.at(slidx); |