summaryrefslogtreecommitdiff
path: root/src/mir/mir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-20 14:31:27 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-20 14:31:27 +0800
commit2d10f135e8c6455feab799dedc38e2b3b70fe89c (patch)
tree3786928de068ce3f0788e764708b39a58c71cbea /src/mir/mir.cpp
parentcdd3562534e16e8e6678f841958cdcf0c26b267c (diff)
downloadmrust-2d10f135e8c6455feab799dedc38e2b3b70fe89c.tar.gz
MIR Gen - Add logging
Diffstat (limited to 'src/mir/mir.cpp')
-rw-r--r--src/mir/mir.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/mir/mir.cpp b/src/mir/mir.cpp
index 8789abce..df6e1cde 100644
--- a/src/mir/mir.cpp
+++ b/src/mir/mir.cpp
@@ -35,6 +35,49 @@ namespace MIR {
)
return os;
}
+
+ ::std::ostream& operator<<(::std::ostream& os, const LValue& x)
+ {
+ return os;
+ }
+
+ ::std::ostream& operator<<(::std::ostream& os, const Terminator& x)
+ {
+ TU_MATCHA( (x), (e),
+ (Incomplete,
+ os << "Invalid";
+ ),
+ (Return,
+ os << "Return";
+ ),
+ (Diverge,
+ os << "Diverge";
+ ),
+ (Goto,
+ os << "Goto(" << e << ")";
+ ),
+ (Panic,
+ os << "Panic(" << e.dst << ";)";
+ ),
+ (If,
+ os << "If( ? : " << e.bb0 << ", " << e.bb1 << ")";
+ ),
+ (Switch,
+ os << "Switch( ? : ";
+ for(unsigned int j = 0; j < e.targets.size(); j ++)
+ os << j << " => bb" << e.targets[j] << ", ";
+ os << ")";
+ ),
+ (Call,
+ os << "Call( ? = ?( ";
+ for(const auto& arg : e.args)
+ os << arg << ", ";
+ os << "), bb" << e.ret_block << ", bb" << e.panic_block << ")";
+ )
+ )
+
+ return os;
+ }
}
::MIR::LValue MIR::LValue::clone() const