summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/nodes.cc')
-rw-r--r--compiler/optimizing/nodes.cc53
1 files changed, 53 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index d57eaf0b60..e815474b6e 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -17,6 +17,7 @@
#include <algorithm>
#include <cfloat>
+#include <functional>
#include "art_method-inl.h"
#include "base/arena_allocator.h"
@@ -1955,6 +1956,58 @@ std::ostream& operator<<(std::ostream& os, HInstruction::InstructionKind rhs) {
return os;
}
+std::ostream& operator<<(std::ostream& os, const HInstruction::NoArgsDump rhs) {
+ // TODO Really this should be const but that would require const-ifying
+ // graph-visualizer and HGraphVisitor which are tangled up everywhere.
+ return const_cast<HInstruction*>(rhs.ins)->Dump(os, /* dump_args= */ false);
+}
+
+std::ostream& operator<<(std::ostream& os, const HInstruction::ArgsDump rhs) {
+ // TODO Really this should be const but that would require const-ifying
+ // graph-visualizer and HGraphVisitor which are tangled up everywhere.
+ return const_cast<HInstruction*>(rhs.ins)->Dump(os, /* dump_args= */ true);
+}
+
+std::ostream& operator<<(std::ostream& os, const HInstruction& rhs) {
+ return os << rhs.DumpWithoutArgs();
+}
+
+std::ostream& operator<<(std::ostream& os, const HUseList<HInstruction*>& lst) {
+ os << "Instructions[";
+ bool first = true;
+ for (const auto& hi : lst) {
+ if (!first) {
+ os << ", ";
+ }
+ first = false;
+ os << hi.GetUser()->DebugName() << "[id: " << hi.GetUser()->GetId()
+ << ", blk: " << hi.GetUser()->GetBlock()->GetBlockId() << "]@" << hi.GetIndex();
+ }
+ os << "]";
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const HUseList<HEnvironment*>& lst) {
+ os << "Environments[";
+ bool first = true;
+ for (const auto& hi : lst) {
+ if (!first) {
+ os << ", ";
+ }
+ first = false;
+ os << *hi.GetUser()->GetHolder() << "@" << hi.GetIndex();
+ }
+ os << "]";
+ return os;
+}
+
+std::ostream& HGraph::Dump(std::ostream& os,
+ std::optional<std::reference_wrapper<const BlockNamer>> namer) {
+ HGraphVisualizer vis(&os, this, nullptr, namer);
+ vis.DumpGraphDebug();
+ return os;
+}
+
void HInstruction::MoveBefore(HInstruction* cursor, bool do_checks) {
if (do_checks) {
DCHECK(!IsPhi());