Skip to content
Draft
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
153 changes: 56 additions & 97 deletions src/hotspot/share/opto/idealGraphPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ void IdealGraphPrinter::print_prop(const char *name, const char *val) {
tail(PROPERTY_ELEMENT);
}

void IdealGraphPrinter::print_prop_record(const IdealGraphPrintRecord rec[], int size) {
for ( int i = 0; i < size; i++ ) {
if (rec[i].cond != 0) {
if (rec[i].string_value != nullptr) {
print_prop(rec[i].name, rec[i].string_value);
}
else {
print_prop(rec[i].name, rec[i].int_value);
}
}
}
}

void IdealGraphPrinter::print_method(ciMethod *method, int bci, InlineTree *tree) {
begin_head(METHOD_ELEMENT);

Expand Down Expand Up @@ -507,36 +520,19 @@ void IdealGraphPrinter::visit_node(Node* n, bool edges) {
}

const jushort flags = node->flags();
if (flags & Node::Flag_is_Copy) {
print_prop("is_copy", "true");
}
if (flags & Node::Flag_rematerialize) {
print_prop("rematerialize", "true");
}
if (flags & Node::Flag_needs_anti_dependence_check) {
print_prop("needs_anti_dependence_check", "true");
}
if (flags & Node::Flag_is_macro) {
print_prop("is_macro", "true");
}
if (flags & Node::Flag_is_Con) {
print_prop("is_con", "true");
}
if (flags & Node::Flag_is_cisc_alternate) {
print_prop("is_cisc_alternate", "true");
}
if (flags & Node::Flag_is_dead_loop_safe) {
print_prop("is_dead_loop_safe", "true");
}
if (flags & Node::Flag_may_be_short_branch) {
print_prop("may_be_short_branch", "true");
}
if (flags & Node::Flag_has_call) {
print_prop("has_call", "true");
}
if (flags & Node::Flag_has_swapped_edges) {
print_prop("has_swapped_edges", "true");
}
const IdealGraphPrintRecord rec[] = {
{flags & Node::Flag_is_Copy, "is_copy", "true"},
{flags & Node::Flag_rematerialize, "rematerialize", "true"},
{flags & Node::Flag_needs_anti_dependence_check, "needs_anti_dependence_check", "true"},
{flags & Node::Flag_is_macro, "is_macro", "true"},
{flags & Node::Flag_is_Con, "is_con", "true"},
{flags & Node::Flag_is_cisc_alternate, "is_cisc_alternate", "true"},
{flags & Node::Flag_is_dead_loop_safe, "is_dead_loop_safe", "true"},
{flags & Node::Flag_may_be_short_branch, "may_be_short_branch", "true"},
{flags & Node::Flag_has_call, "has_call", "true"},
{flags & Node::Flag_has_swapped_edges, "has_swapped_edges", "true"}
};
print_prop_record(rec,(sizeof(rec)/sizeof(IdealGraphPrintRecord)));

if (C->matcher() != nullptr) {
if (C->matcher()->is_shared(node)) {
Expand Down Expand Up @@ -1082,73 +1078,36 @@ void IdealGraphPrinter::print(const char* name, Node* node, GrowableArray<const
buffer[0] = 0;
stringStream lrg_mask_stream(buffer, sizeof(buffer) - 1);
lrg.mask().dump(&lrg_mask_stream);
print_prop("mask", buffer);
print_prop("mask_size", lrg.mask_size());
if (lrg._degree_valid) {
print_prop("degree", lrg.degree());
}
print_prop("num_regs", lrg.num_regs());
print_prop("reg_pressure", lrg.reg_pressure());
print_prop("cost", lrg._cost);
print_prop("area", lrg._area);
print_prop("score", lrg.score());
if (lrg._risk_bias != 0) {
print_prop("risk_bias", lrg._risk_bias);
}
if (lrg._copy_bias != 0) {
print_prop("copy_bias", lrg._copy_bias);
}
if (lrg.is_singledef()) {
print_prop("is_singledef", TRUE_VALUE);
}
if (lrg.is_multidef()) {
print_prop("is_multidef", TRUE_VALUE);
}
if (lrg._is_oop) {
print_prop("is_oop", TRUE_VALUE);
}
if (lrg._is_float) {
print_prop("is_float", TRUE_VALUE);
}
if (lrg._is_vector) {
print_prop("is_vector", TRUE_VALUE);
}
if (lrg._is_predicate) {
print_prop("is_predicate", TRUE_VALUE);
}
if (lrg._is_scalable) {
print_prop("is_scalable", TRUE_VALUE);
}
if (lrg._was_spilled1) {
print_prop("was_spilled1", TRUE_VALUE);
}
if (lrg._was_spilled2) {
print_prop("was_spilled2", TRUE_VALUE);
}
if (lrg._direct_conflict) {
print_prop("direct_conflict", TRUE_VALUE);
}
if (lrg._fat_proj) {
print_prop("fat_proj", TRUE_VALUE);
}
if (lrg._was_lo) {
print_prop("_was_lo", TRUE_VALUE);
}
if (lrg._has_copy) {
print_prop("has_copy", TRUE_VALUE);
}
if (lrg._at_risk) {
print_prop("at_risk", TRUE_VALUE);
}
if (lrg._must_spill) {
print_prop("must_spill", TRUE_VALUE);
}
if (lrg._is_bound) {
print_prop("is_bound", TRUE_VALUE);
}
if (lrg._msize_valid && lrg._degree_valid && lrg.lo_degree()) {
print_prop("trivial", TRUE_VALUE);
}
IdealGraphPrintRecord rec[] = {
{1, "mask", buffer},
{1, "mask_size", nullptr, lrg.mask_size()},
{(int)lrg._degree_valid, "degree", nullptr, lrg.degree()},
{1, "num_regs", nullptr, lrg.num_regs()},
{1, "reg_pressure", nullptr, lrg.reg_pressure()},
{1, "cost", nullptr, (int)lrg._cost},
{1, "area", nullptr, (int)lrg._area},
{1, "score", nullptr, (int)lrg.score()},
{(int)lrg._risk_bias, "risk_bias", nullptr, (int)lrg._risk_bias},
{(int)lrg._copy_bias, "copy_bias", nullptr, (int)lrg._copy_bias},
{lrg.is_singledef(), "is_singledef", TRUE_VALUE},
{lrg.is_multidef(), "is_multidef", TRUE_VALUE},
{(int)lrg._is_oop, "is_oop", TRUE_VALUE},
{(int)lrg._is_float, "is_float", TRUE_VALUE},
{(int)lrg._is_vector, "is_vector", TRUE_VALUE},
{(int)lrg._is_predicate, "is_predicate", TRUE_VALUE},
{lrg._is_scalable, "is_scalable", TRUE_VALUE},
{lrg._was_spilled1, "was_spilled1", TRUE_VALUE},
{lrg._was_spilled2, "was_spilled2", TRUE_VALUE},
{lrg._direct_conflict, "direct_conflict", TRUE_VALUE},
{lrg._fat_proj, "fat_proj", TRUE_VALUE},
{lrg._was_lo, "_was_lo", TRUE_VALUE},
{lrg._has_copy, "has_copy", TRUE_VALUE},
{lrg._at_risk, "at_risk", TRUE_VALUE},
{lrg._must_spill, "must_spill", TRUE_VALUE},
{lrg._is_bound, "is_bound", TRUE_VALUE},
{lrg._msize_valid && lrg._degree_valid && lrg.lo_degree(), "trivial", TRUE_VALUE}
};
print_prop_record(rec, (sizeof(rec)/sizeof(IdealGraphPrintRecord)));
tail(PROPERTIES_ELEMENT);
tail(LIVE_RANGE_ELEMENT);
}
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/opto/idealGraphPrinter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class IdealGraphPrinter : public CHeapObj<mtCompiler> {
Compile *C;
double _max_freq;
bool _append;
struct IdealGraphPrintRecord { int cond; const char *name; const char *string_value = nullptr; int int_value = -1;};

// Walk the native stack and print relevant C2 frames as IGV properties (if
// graph_name == nullptr) or the graph name based on the highest C2 frame (if
Expand All @@ -138,6 +139,7 @@ class IdealGraphPrinter : public CHeapObj<mtCompiler> {
void print_attr(const char *name, intptr_t val);
void print_prop(const char *name, const char *val);
void print_prop(const char *name, int val);
void print_prop_record(const IdealGraphPrintRecord rec[], int size);
void tail(const char *name);
void head(const char *name);
void text(const char *s);
Expand Down