diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-06-22 12:05:13 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-06-22 12:05:13 +0800 |
commit | 239b7826470dab3effc703b33d4d7a2a761c461e (patch) | |
tree | 7654b12ec446685d9696dad6916c8f4197331139 /src/mir/from_hir.hpp | |
parent | c7f4248191dce493cd43fecd808cf15015271408 (diff) | |
download | mrust-239b7826470dab3effc703b33d4d7a2a761c461e.tar.gz |
MIR Gen - Remove arguments that are just assigned from arguments
Diffstat (limited to 'src/mir/from_hir.hpp')
-rw-r--r-- | src/mir/from_hir.hpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mir/from_hir.hpp b/src/mir/from_hir.hpp index 2730631f..ce310945 100644 --- a/src/mir/from_hir.hpp +++ b/src/mir/from_hir.hpp @@ -135,6 +135,8 @@ class MirBuilder ::std::vector<VarState> m_slot_states; size_t m_first_temp_idx; + ::std::map<unsigned,unsigned> m_var_arg_mappings; + struct ScopeDef { const Span& span; @@ -173,6 +175,9 @@ public: // - Values ::MIR::LValue get_variable(const Span& sp, unsigned idx) const { + auto it = m_var_arg_mappings.find(idx); + if(it != m_var_arg_mappings.end()) + return ::MIR::LValue::make_Argument({ it->second }); return ::MIR::LValue::make_Local( idx ); } ::MIR::LValue new_temporary(const ::HIR::TypeRef& ty); |