Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8283692: Add PrintIdealPhase that includes block scheduling #7960

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 10 additions & 2 deletions src/hotspot/share/opto/compile.cpp
Original file line number Diff line number Diff line change
@@ -548,7 +548,13 @@ void Compile::print_ideal_ir(const char* phase_name) {
is_osr_compilation() ? " compile_kind='osr'" : "",
phase_name);
}
root()->dump(9999);
if (_output == nullptr) {
root()->dump(9999);
} else {
// Dump the node blockwise if we have a scheduling
_output->print_scheduling();
}

if (xtty != NULL) {
xtty->tail("ideal");
}
@@ -624,7 +630,8 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
_replay_inline_data(NULL),
_java_calls(0),
_inner_loops(0),
_interpreter_frame_size(0)
_interpreter_frame_size(0),
_output(NULL)
#ifndef PRODUCT
, _in_dump_cnt(0)
#endif
@@ -898,6 +905,7 @@ Compile::Compile( ciEnv* ci_env,
_java_calls(0),
_inner_loops(0),
_interpreter_frame_size(0),
_output(NULL),
#ifndef PRODUCT
_in_dump_cnt(0),
#endif
29 changes: 19 additions & 10 deletions src/hotspot/share/opto/output.cpp
Original file line number Diff line number Diff line change
@@ -324,6 +324,8 @@ void PhaseOutput::perform_mach_node_analysis() {
bs->late_barrier_analysis();

pd_perform_mach_node_analysis();

C->print_method(CompilerPhaseType::PHASE_MACHANALYSIS, 4);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to go with an underscore as mentioned in the PR description:
PHASE_MACH_ANALYSIS.

}

// Convert Nodes to instruction bits and pass off to the VM
@@ -2117,20 +2119,27 @@ void PhaseOutput::ScheduleAndBundle() {
#ifndef PRODUCT
if (C->trace_opto_output()) {
tty->print("\n---- After ScheduleAndBundle ----\n");
for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {
tty->print("\nBB#%03d:\n", i);
Block* block = C->cfg()->get_block(i);
for (uint j = 0; j < block->number_of_nodes(); j++) {
Node* n = block->get_node(j);
OptoReg::Name reg = C->regalloc()->get_reg_first(n);
tty->print(" %-6s ", reg >= 0 && reg < REG_COUNT ? Matcher::regName[reg] : "");
n->dump();
}
}
print_scheduling();
}
#endif
}

#ifndef PRODUCT
// Separated out so that it can be called directly from debugger
void PhaseOutput::print_scheduling() {
for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) {
tty->print("\nBB#%03d:\n", i);
Block* block = C->cfg()->get_block(i);
for (uint j = 0; j < block->number_of_nodes(); j++) {
Node* n = block->get_node(j);
OptoReg::Name reg = C->regalloc()->get_reg_first(n);
tty->print(" %-6s ", reg >= 0 && reg < REG_COUNT ? Matcher::regName[reg] : "");
n->dump();
}
}
}
#endif

// See if this node fits into the present instruction bundle
bool Scheduling::NodeFitsInBundle(Node *n) {
uint n_idx = n->_idx;
1 change: 1 addition & 0 deletions src/hotspot/share/opto/output.hpp
Original file line number Diff line number Diff line change
@@ -263,6 +263,7 @@ class PhaseOutput : public Phase {
void BuildOopMaps();

#ifndef PRODUCT
void print_scheduling();
static void print_statistics();
#endif
};
1 change: 1 addition & 0 deletions src/hotspot/share/opto/phasetype.hpp
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@
flags(AFTER_BEAUTIFY_LOOPS, "After beautify loops") \
flags(BEFORE_MATCHING, "Before matching") \
flags(MATCHING, "After matching") \
flags(MACHANALYSIS, "After mach analysis") \
flags(INCREMENTAL_INLINE, "Incremental Inline") \
flags(INCREMENTAL_INLINE_STEP, "Incremental Inline Step") \
flags(INCREMENTAL_INLINE_CLEANUP, "Incremental Inline Cleanup") \