summaryrefslogtreecommitdiff
path: root/src/mir/dump.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir/dump.cpp')
-rw-r--r--src/mir/dump.cpp65
1 files changed, 39 insertions, 26 deletions
diff --git a/src/mir/dump.cpp b/src/mir/dump.cpp
index bbacbbf3..1342e086 100644
--- a/src/mir/dump.cpp
+++ b/src/mir/dump.cpp
@@ -193,38 +193,51 @@ namespace {
)
)
}
+ void fmt_val(::std::ostream& os, const ::MIR::Constant& e) {
+ TU_MATCHA( (e), (ce),
+ (Int,
+ os << ce;
+ ),
+ (Uint,
+ os << "0x" << ::std::hex << ce << ::std::dec;
+ ),
+ (Float,
+ os << ce;
+ ),
+ (Bool,
+ os << (ce ? "true" : "false");
+ ),
+ (Bytes,
+ os << "b\"" << ce << "\"";
+ ),
+ (StaticString,
+ os << "\"" << ce << "\"";
+ ),
+ (Const,
+ os << ce.p;
+ ),
+ (ItemAddr,
+ os << "addr " << ce;
+ )
+ )
+ }
+ void fmt_val(::std::ostream& os, const ::MIR::Param& param) {
+ TU_MATCHA( (param), (e),
+ (LValue,
+ fmt_val(os, e);
+ ),
+ (Constant,
+ fmt_val(os, e);
+ )
+ )
+ }
void fmt_val(::std::ostream& os, const ::MIR::RValue& rval) {
TU_MATCHA( (rval), (e),
(Use,
fmt_val(os, e);
),
(Constant,
- TU_MATCHA( (e), (ce),
- (Int,
- os << ce;
- ),
- (Uint,
- os << "0x" << ::std::hex << ce << ::std::dec;
- ),
- (Float,
- os << ce;
- ),
- (Bool,
- os << (ce ? "true" : "false");
- ),
- (Bytes,
- os << "b\"" << ce << "\"";
- ),
- (StaticString,
- os << "\"" << ce << "\"";
- ),
- (Const,
- os << ce.p;
- ),
- (ItemAddr,
- os << "addr " << ce;
- )
- )
+ fmt_val(os, e);
),
(SizedArray,
os << "[";