Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/hotspot/share/opto/chaitin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ void PhaseChaitin::Register_Allocate() {
live.compute(_lrg_map.max_lrg_id());
_live = &live;
}

C->print_method(PHASE_INITIAL_LIVENESS, 4);

// Create the interference graph using virtual copies
build_ifg_virtual(); // Include stack slots this time

Expand Down Expand Up @@ -464,6 +467,8 @@ void PhaseChaitin::Register_Allocate() {
_live = &live;
}

C->print_method(PHASE_AGGRESSIVE_COALESCING, 4);

// Build physical interference graph
uint must_spill = 0;
must_spill = build_ifg_physical(&live_arena);
Expand Down Expand Up @@ -504,6 +509,9 @@ void PhaseChaitin::Register_Allocate() {
live.compute(_lrg_map.max_lrg_id()); // Compute LIVE
_live = &live;
}

C->print_method(PHASE_INITIAL_SPILLING, 4);

build_ifg_physical(&live_arena);
_ifg->SquareUp();
_ifg->Compute_Effective_Degree();
Expand All @@ -518,6 +526,10 @@ void PhaseChaitin::Register_Allocate() {
}
_lrg_map.compress_uf_map_for_nodes();

if (OptoCoalesce) {
C->print_method(PHASE_CONSERVATIVE_COALESCING, 4);
}

#ifdef ASSERT
verify(&live_arena, true);
#endif
Expand Down Expand Up @@ -580,6 +592,9 @@ void PhaseChaitin::Register_Allocate() {
live.compute(_lrg_map.max_lrg_id());
_live = &live;
}

C->print_method(PHASE_ITERATIVE_SPILLING, 4);

must_spill = build_ifg_physical(&live_arena);
_ifg->SquareUp();
_ifg->Compute_Effective_Degree();
Expand All @@ -593,6 +608,11 @@ void PhaseChaitin::Register_Allocate() {
coalesce.coalesce_driver();
}
_lrg_map.compress_uf_map_for_nodes();

if (OptoCoalesce) {
C->print_method(PHASE_CONSERVATIVE_COALESCING, 4);
}

#ifdef ASSERT
verify(&live_arena, true);
#endif
Expand All @@ -607,16 +627,22 @@ void PhaseChaitin::Register_Allocate() {
spills = Select();
}

C->print_method(PHASE_AFTER_ITERATIVE_SPILLING, 4);

// Count number of Simplify-Select trips per coloring success.
_allocator_attempts += _trip_cnt + 1;
_allocator_successes += 1;

// Peephole remove copies
post_allocate_copy_removal();

C->print_method(PHASE_POST_ALLOCATION_COPY_REMOVAL, 4);

// Merge multidefs if multiple defs representing the same value are used in a single block.
merge_multidefs();

C->print_method(PHASE_MERGE_MULTI_DEFS, 4);

#ifdef ASSERT
// Verify the graph after RA.
verify(&live_arena);
Expand Down Expand Up @@ -645,6 +671,8 @@ void PhaseChaitin::Register_Allocate() {
// Convert CISC spills
fixup_spills();

C->print_method(PHASE_FIX_UP_SPILLS, 4);

// Log regalloc results
CompileLog* log = Compile::current()->log();
if (log != nullptr) {
Expand Down
9 changes: 9 additions & 0 deletions src/hotspot/share/opto/phasetype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@
flags(BEFORE_MATCHING, "Before matching") \
flags(MATCHING, "After matching") \
flags(GLOBAL_CODE_MOTION, "Global code motion") \
flags(INITIAL_LIVENESS, "Initial liveness") \
flags(AGGRESSIVE_COALESCING, "Aggressive coalescing") \
flags(INITIAL_SPILLING, "Initial spilling") \
flags(CONSERVATIVE_COALESCING, "Conservative coalescing") \
flags(ITERATIVE_SPILLING, "Iterative spilling") \
flags(AFTER_ITERATIVE_SPILLING, "After iterative spilling") \
flags(POST_ALLOCATION_COPY_REMOVAL, "Post-allocation copy removal") \
flags(MERGE_MULTI_DEFS, "Merge multiple definitions") \
flags(FIX_UP_SPILLS, "Fix up spills") \
flags(REGISTER_ALLOCATION, "Register Allocation") \
flags(BLOCK_ORDERING, "Block Ordering") \
flags(PEEPHOLE, "Peephole") \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ public enum CompilePhase {
BEFORE_MATCHING("Before matching"),
MATCHING("After matching", RegexType.MACH),
GLOBAL_CODE_MOTION("Global code motion", RegexType.MACH),
INITIAL_LIVENESS("Initial liveness", RegexType.MACH),
AGGRESSIVE_COALESCING("Aggressive coalescing", RegexType.MACH),
INITIAL_SPILLING("Initial spilling", RegexType.MACH),
CONSERVATIVE_COALESCING("Conservative coalescing", RegexType.MACH, ActionOnRepeat.KEEP_FIRST),
ITERATIVE_SPILLING("Iterative spilling", RegexType.MACH, ActionOnRepeat.KEEP_FIRST),
AFTER_ITERATIVE_SPILLING("After iterative spilling", RegexType.MACH),
POST_ALLOCATION_COPY_REMOVAL("Post-allocation copy removal", RegexType.MACH),
MERGE_MULTI_DEFS("Merge multiple definitions", RegexType.MACH),
FIX_UP_SPILLS("Fix up spills", RegexType.MACH),
REGISTER_ALLOCATION("Register Allocation", RegexType.MACH),
BLOCK_ORDERING("Block Ordering", RegexType.MACH),
PEEPHOLE("Peephole", RegexType.MACH),
Expand Down