8283692: Add PrintIdealPhase that includes block scheduling

Reviewed-by: kvn, chagedorn
This commit is contained in:
Nils Eliasson 2022-03-29 15:32:52 +00:00
parent ab17f88f6c
commit fe670ff403
4 changed files with 31 additions and 12 deletions

View file

@ -548,7 +548,13 @@ void Compile::print_ideal_ir(const char* phase_name) {
is_osr_compilation() ? " compile_kind='osr'" : "", is_osr_compilation() ? " compile_kind='osr'" : "",
phase_name); 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) { if (xtty != NULL) {
xtty->tail("ideal"); xtty->tail("ideal");
} }
@ -624,7 +630,8 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
_replay_inline_data(NULL), _replay_inline_data(NULL),
_java_calls(0), _java_calls(0),
_inner_loops(0), _inner_loops(0),
_interpreter_frame_size(0) _interpreter_frame_size(0),
_output(NULL)
#ifndef PRODUCT #ifndef PRODUCT
, _in_dump_cnt(0) , _in_dump_cnt(0)
#endif #endif
@ -898,6 +905,7 @@ Compile::Compile( ciEnv* ci_env,
_java_calls(0), _java_calls(0),
_inner_loops(0), _inner_loops(0),
_interpreter_frame_size(0), _interpreter_frame_size(0),
_output(NULL),
#ifndef PRODUCT #ifndef PRODUCT
_in_dump_cnt(0), _in_dump_cnt(0),
#endif #endif

View file

@ -324,6 +324,8 @@ void PhaseOutput::perform_mach_node_analysis() {
bs->late_barrier_analysis(); bs->late_barrier_analysis();
pd_perform_mach_node_analysis(); pd_perform_mach_node_analysis();
C->print_method(CompilerPhaseType::PHASE_MACHANALYSIS, 4);
} }
// Convert Nodes to instruction bits and pass off to the VM // Convert Nodes to instruction bits and pass off to the VM
@ -2117,20 +2119,27 @@ void PhaseOutput::ScheduleAndBundle() {
#ifndef PRODUCT #ifndef PRODUCT
if (C->trace_opto_output()) { if (C->trace_opto_output()) {
tty->print("\n---- After ScheduleAndBundle ----\n"); tty->print("\n---- After ScheduleAndBundle ----\n");
for (uint i = 0; i < C->cfg()->number_of_blocks(); i++) { print_scheduling();
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 #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 // See if this node fits into the present instruction bundle
bool Scheduling::NodeFitsInBundle(Node *n) { bool Scheduling::NodeFitsInBundle(Node *n) {
uint n_idx = n->_idx; uint n_idx = n->_idx;

View file

@ -263,6 +263,7 @@ public:
void BuildOopMaps(); void BuildOopMaps();
#ifndef PRODUCT #ifndef PRODUCT
void print_scheduling();
static void print_statistics(); static void print_statistics();
#endif #endif
}; };

View file

@ -57,6 +57,7 @@
flags(AFTER_BEAUTIFY_LOOPS, "After beautify loops") \ flags(AFTER_BEAUTIFY_LOOPS, "After beautify loops") \
flags(BEFORE_MATCHING, "Before matching") \ flags(BEFORE_MATCHING, "Before matching") \
flags(MATCHING, "After matching") \ flags(MATCHING, "After matching") \
flags(MACHANALYSIS, "After mach analysis") \
flags(INCREMENTAL_INLINE, "Incremental Inline") \ flags(INCREMENTAL_INLINE, "Incremental Inline") \
flags(INCREMENTAL_INLINE_STEP, "Incremental Inline Step") \ flags(INCREMENTAL_INLINE_STEP, "Incremental Inline Step") \
flags(INCREMENTAL_INLINE_CLEANUP, "Incremental Inline Cleanup") \ flags(INCREMENTAL_INLINE_CLEANUP, "Incremental Inline Cleanup") \