diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-06-16 10:35:30 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-06-16 10:35:30 +0800 |
commit | bbb7023bee036f87b45ba0555e60ce33837460b0 (patch) | |
tree | a1e1210bee4a1da459a3be90fb67dc586e400bb5 /src/mir/dump.cpp | |
parent | 94015a6835ae0d050a83dee1622e1d1b6851f556 (diff) | |
download | mrust-bbb7023bee036f87b45ba0555e60ce33837460b0.tar.gz |
MIR - Unify temporaries and variables
Diffstat (limited to 'src/mir/dump.cpp')
-rw-r--r-- | src/mir/dump.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/mir/dump.cpp b/src/mir/dump.cpp index b4177295..4e53cf5b 100644 --- a/src/mir/dump.cpp +++ b/src/mir/dump.cpp @@ -25,13 +25,9 @@ namespace { void dump_mir(const ::MIR::Function& fcn) { - for(unsigned int i = 0; i < fcn.named_variables.size(); i ++) + for(size_t i = 0; i < fcn.locals.size(); i ++) { - m_os << indent() << "let _#" << i << ": " << fcn.named_variables[i] << ";\n"; - } - for(unsigned int i = 0; i < fcn.temporaries.size(); i ++) - { - m_os << indent() << "let tmp$" << i << ": " << fcn.temporaries[i] << ";\n"; + m_os << indent() << "let _$" << i << ": " << fcn.locals[i] << ";\n"; } for(unsigned int i = 0; i < fcn.drop_flags.size(); i ++) { @@ -102,10 +98,8 @@ namespace { ), (ScopeEnd, m_os << "// Scope End: "; - for(auto idx : e.vars) - m_os << "var$" << idx << ","; - for(auto idx : e.tmps) - m_os << "tmp$" << idx << ","; + for(auto idx : e.slots) + m_os << "_$" << idx << ","; m_os << "\n"; ) ) @@ -165,21 +159,18 @@ namespace { } void fmt_val(::std::ostream& os, const ::MIR::LValue& lval) { TU_MATCHA( (lval), (e), - (Variable, - os << "_#" << e; - ), - (Temporary, - os << "tmp$" << e.idx; + (Return, + os << "RETURN"; ), (Argument, os << "arg$" << e.idx; ), + (Local, + os << "_$" << e; + ), (Static, os << e; ), - (Return, - os << "RETURN"; - ), (Field, os << "("; fmt_val(os, *e.val); |