equal
deleted
inserted
replaced
33 #include "opto/phase.hpp" |
33 #include "opto/phase.hpp" |
34 #include "opto/regalloc.hpp" |
34 #include "opto/regalloc.hpp" |
35 #include "opto/regmask.hpp" |
35 #include "opto/regmask.hpp" |
36 #include "opto/machnode.hpp" |
36 #include "opto/machnode.hpp" |
37 |
37 |
38 class LoopTree; |
|
39 class Matcher; |
38 class Matcher; |
40 class PhaseCFG; |
39 class PhaseCFG; |
41 class PhaseLive; |
40 class PhaseLive; |
42 class PhaseRegAlloc; |
41 class PhaseRegAlloc; |
43 class PhaseChaitin; |
42 class PhaseChaitin; |
44 |
43 |
45 #define OPTO_DEBUG_SPLIT_FREQ BLOCK_FREQUENCY(0.001) |
44 #define OPTO_DEBUG_SPLIT_FREQ BLOCK_FREQUENCY(0.001) |
46 #define OPTO_LRG_HIGH_FREQ BLOCK_FREQUENCY(0.25) |
45 #define OPTO_LRG_HIGH_FREQ BLOCK_FREQUENCY(0.25) |
47 |
46 |
48 //------------------------------LRG-------------------------------------------- |
47 //------------------------------LRG-------------------------------------------- |
134 void Clear() { _mask.Clear() ; debug_only(_msize_valid=1); _mask_size = 0; } |
133 void Clear() { _mask.Clear() ; debug_only(_msize_valid=1); _mask_size = 0; } |
135 void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; } |
134 void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; } |
136 |
135 |
137 void Insert( OptoReg::Name reg ) { _mask.Insert(reg); debug_only(_msize_valid=0;) } |
136 void Insert( OptoReg::Name reg ) { _mask.Insert(reg); debug_only(_msize_valid=0;) } |
138 void Remove( OptoReg::Name reg ) { _mask.Remove(reg); debug_only(_msize_valid=0;) } |
137 void Remove( OptoReg::Name reg ) { _mask.Remove(reg); debug_only(_msize_valid=0;) } |
139 void clear_to_pairs() { _mask.clear_to_pairs(); debug_only(_msize_valid=0;) } |
|
140 void clear_to_sets() { _mask.clear_to_sets(_num_regs); debug_only(_msize_valid=0;) } |
138 void clear_to_sets() { _mask.clear_to_sets(_num_regs); debug_only(_msize_valid=0;) } |
141 |
139 |
142 // Number of registers this live range uses when it colors |
140 // Number of registers this live range uses when it colors |
143 private: |
141 private: |
144 uint16_t _num_regs; // 2 for Longs and Doubles, 1 for all else |
142 uint16_t _num_regs; // 2 for Longs and Doubles, 1 for all else |
235 void init( uint maxlrg ); |
233 void init( uint maxlrg ); |
236 |
234 |
237 // Add edge between a and b. Returns true if actually addded. |
235 // Add edge between a and b. Returns true if actually addded. |
238 int add_edge( uint a, uint b ); |
236 int add_edge( uint a, uint b ); |
239 |
237 |
240 // Add edge between a and everything in the vector |
|
241 void add_vector( uint a, IndexSet *vec ); |
|
242 |
|
243 // Test for edge existance |
238 // Test for edge existance |
244 int test_edge( uint a, uint b ) const; |
239 int test_edge( uint a, uint b ) const; |
245 |
240 |
246 // Square-up matrix for faster Union |
241 // Square-up matrix for faster Union |
247 void SquareUp(); |
242 void SquareUp(); |
399 int _trip_cnt; |
394 int _trip_cnt; |
400 int _alternate; |
395 int _alternate; |
401 |
396 |
402 PhaseLive *_live; // Liveness, used in the interference graph |
397 PhaseLive *_live; // Liveness, used in the interference graph |
403 PhaseIFG *_ifg; // Interference graph (for original chunk) |
398 PhaseIFG *_ifg; // Interference graph (for original chunk) |
404 Node_List **_lrg_nodes; // Array of node; lists for lrgs which spill |
|
405 VectorSet _spilled_once; // Nodes that have been spilled |
399 VectorSet _spilled_once; // Nodes that have been spilled |
406 VectorSet _spilled_twice; // Nodes that have been spilled twice |
400 VectorSet _spilled_twice; // Nodes that have been spilled twice |
407 |
401 |
408 // Combine the Live Range Indices for these 2 Nodes into a single live |
402 // Combine the Live Range Indices for these 2 Nodes into a single live |
409 // range. Future requests for any Node in either live range will |
403 // range. Future requests for any Node in either live range will |
494 // all inputs to a PhiNode, effectively coalescing live ranges. Insert |
488 // all inputs to a PhiNode, effectively coalescing live ranges. Insert |
495 // copies as needed. |
489 // copies as needed. |
496 void de_ssa(); |
490 void de_ssa(); |
497 |
491 |
498 // Add edge between reg and everything in the vector. |
492 // Add edge between reg and everything in the vector. |
499 // Same as _ifg->add_vector(reg,live) EXCEPT use the RegMask |
493 // Use the RegMask information to trim the set of interferences. Return the |
500 // information to trim the set of interferences. Return the |
|
501 // count of edges added. |
494 // count of edges added. |
502 void interfere_with_live(uint lid, IndexSet* liveout); |
495 void interfere_with_live(uint lid, IndexSet* liveout); |
503 #ifdef ASSERT |
496 #ifdef ASSERT |
504 // Count register pressure for asserts |
497 // Count register pressure for asserts |
505 uint count_int_pressure(IndexSet* liveout); |
498 uint count_int_pressure(IndexSet* liveout); |
664 // Set the was-lo-degree bit. Conservative coalescing should not change the |
657 // Set the was-lo-degree bit. Conservative coalescing should not change the |
665 // colorability of the graph. If any live range was of low-degree before |
658 // colorability of the graph. If any live range was of low-degree before |
666 // coalescing, it should Simplify. This call sets the was-lo-degree bit. |
659 // coalescing, it should Simplify. This call sets the was-lo-degree bit. |
667 void set_was_low(); |
660 void set_was_low(); |
668 |
661 |
669 // Split live-ranges that must spill due to register conflicts (as opposed |
|
670 // to capacity spills). Typically these are things def'd in a register |
|
671 // and used on the stack or vice-versa. |
|
672 void pre_spill(); |
|
673 |
|
674 // Init LRG caching of degree, numregs. Init lo_degree list. |
662 // Init LRG caching of degree, numregs. Init lo_degree list. |
675 void cache_lrg_info( ); |
663 void cache_lrg_info( ); |
676 |
|
677 // Simplify the IFG by removing LRGs of low degree with no copies |
|
678 void Pre_Simplify(); |
|
679 |
664 |
680 // Simplify the IFG by removing LRGs of low degree |
665 // Simplify the IFG by removing LRGs of low degree |
681 void Simplify(); |
666 void Simplify(); |
682 |
667 |
683 // Select colors by re-inserting edges into the IFG. |
668 // Select colors by re-inserting edges into the IFG. |
690 |
675 |
691 // Split uncolorable live ranges |
676 // Split uncolorable live ranges |
692 // Return new number of live ranges |
677 // Return new number of live ranges |
693 uint Split(uint maxlrg, ResourceArea* split_arena); |
678 uint Split(uint maxlrg, ResourceArea* split_arena); |
694 |
679 |
695 // Copy 'was_spilled'-edness from one Node to another. |
|
696 void copy_was_spilled( Node *src, Node *dst ); |
|
697 // Set the 'spilled_once' or 'spilled_twice' flag on a node. |
680 // Set the 'spilled_once' or 'spilled_twice' flag on a node. |
698 void set_was_spilled( Node *n ); |
681 void set_was_spilled( Node *n ); |
699 |
682 |
700 // Convert ideal spill-nodes into machine loads & stores |
683 // Convert ideal spill-nodes into machine loads & stores |
701 // Set C->failing when fixup spills could not complete, node limit exceeded. |
684 // Set C->failing when fixup spills could not complete, node limit exceeded. |