diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mir/mir.cpp | 26 | ||||
-rw-r--r-- | src/mir/mir.hpp | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/mir/mir.cpp b/src/mir/mir.cpp index 6ae5808b..30d94a3d 100644 --- a/src/mir/mir.cpp +++ b/src/mir/mir.cpp @@ -444,6 +444,32 @@ namespace MIR { return os; } + ::std::ostream& operator<<(::std::ostream& os, const Statement& x) + { + TU_MATCHA( (x), (e), + (Assign, + os << e.dst << " = " << e.src; + ), + (Asm, + os << "("; + for(const auto& spec : e.outputs) + os << "\"" << spec.first << "\" : " << spec.second << ", "; + os << ") = asm!(\"\", input=( "; + for(const auto& spec : e.inputs) + os << "\"" << spec.first << "\" : " << spec.second << ", "; + os << "), clobbers=[" << e.clobbers << "], flags=[" << e.flags << "])"; + ), + (SetDropFlag, + ), + (Drop, + os << "drop(" << e.slot; + if(e.kind == ::MIR::eDropKind::SHALLOW) + os << " SHALLOW"; + os << ")"; + ) + ) + return os; + } } ::MIR::LValue MIR::LValue::clone() const diff --git a/src/mir/mir.hpp b/src/mir/mir.hpp index aed7e2fc..f31ede8d 100644 --- a/src/mir/mir.hpp +++ b/src/mir/mir.hpp @@ -271,6 +271,7 @@ TAGGED_UNION(Statement, Assign, unsigned int flag_idx; // Valid if != ~0u }) ); +extern ::std::ostream& operator<<(::std::ostream& os, const Statement& x); struct BasicBlock { |