Commit 1fed3177 authored by Danylo Boiko's avatar Danylo Boiko Committed by V8 LUCI CQ

[turboshaft] Print OpProperties type to JSON output

Bug: v8:12783
Change-Id: I33f2809b60c894a82c3f00c59e9b848cc9f5036d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3723501
Commit-Queue: Danylo Boiko <danielboyko02@gmail.com>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81350}
parent 49e6633e
......@@ -32,6 +32,7 @@ void JSONTurboshaftGraphWriter::PrintNodes() {
os_ << "{\"id\":" << turboshaft_graph_.Index(op).id() << ",";
os_ << "\"title\":\"" << OpcodeName(op.opcode) << "\",";
os_ << "\"block_id\":\"" << block.index() << "\",";
os_ << "\"op_properties_type\":\"" << op.properties() << "\",";
os_ << "\"properties\":\"";
op.PrintOptions(os_);
os_ << "\"}";
......
......@@ -421,6 +421,25 @@ std::ostream& operator<<(std::ostream& os, const Block* b) {
return os << b->index();
}
std::ostream& operator<<(std::ostream& os, OpProperties opProperties) {
if(opProperties == OpProperties::Pure()) {
os << "Pure";
} else if (opProperties == OpProperties::Reading()) {
os << "Reading";
} else if (opProperties == OpProperties::Writing()) {
os << "Writing";
} else if (opProperties == OpProperties::CanDeopt()) {
os << "CanDeopt";
} else if (opProperties == OpProperties::AnySideEffects()) {
os << "AnySideEffects";
} else if (opProperties == OpProperties::BlockTerminator()) {
os << "BlockTerminator";
} else {
UNREACHABLE();
}
return os;
}
void SwitchOp::PrintOptions(std::ostream& os) const {
os << "[";
for (const Case& c : cases) {
......
......@@ -224,7 +224,14 @@ struct OpProperties {
static constexpr OpProperties BlockTerminator() {
return {false, false, false, true};
}
bool operator==(const OpProperties& other) const {
return can_read == other.can_read &&
can_write == other.can_write &&
can_abort == other.can_abort &&
is_block_terminator == other.is_block_terminator;
}
};
std::ostream& operator<<(std::ostream& os, OpProperties opProperties);
// Baseclass for all Turboshaft operations.
// The `alignas(OpIndex)` is necessary because it is followed by an array of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment