summaryrefslogtreecommitdiff
path: root/src/hir/serialise.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-06-02 11:55:02 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-06-02 11:55:02 +0800
commitdab72ad78160ecd2a4d1759174cee837a5bedcbc (patch)
treed7b6f4a34435a163390150476e8fa532f9f2bdfb /src/hir/serialise.cpp
parent599ed0a4cdaf7e05a1c8623c015a593106ea31ec (diff)
downloadmrust-dab72ad78160ecd2a4d1759174cee837a5bedcbc.tar.gz
MIR - Refactor LValue to reduce size and linked-list-ness (seems to have had a ~10% reduction in memory usage)
Diffstat (limited to 'src/hir/serialise.cpp')
-rw-r--r--src/hir/serialise.cpp41
1 files changed, 12 insertions, 29 deletions
diff --git a/src/hir/serialise.cpp b/src/hir/serialise.cpp
index c15630d9..fc53e245 100644
--- a/src/hir/serialise.cpp
+++ b/src/hir/serialise.cpp
@@ -722,35 +722,18 @@
void serialise(const ::MIR::LValue& lv)
{
TRACE_FUNCTION_F("LValue = "<<lv);
- m_out.write_tag( static_cast<int>(lv.tag()) );
- TU_MATCHA( (lv), (e),
- (Return,
- ),
- (Argument,
- m_out.write_count(e.idx);
- ),
- (Local,
- m_out.write_count(e);
- ),
- (Static,
- serialise_path(*e);
- ),
- (Field,
- serialise(e.val);
- m_out.write_count(e.field_index);
- ),
- (Deref,
- serialise(e.val);
- ),
- (Index,
- serialise(e.val);
- serialise(e.idx);
- ),
- (Downcast,
- serialise(e.val);
- m_out.write_count(e.variant_index);
- )
- )
+ if( lv.m_root.is_Static() ) {
+ m_out.write_count(3);
+ serialise_path(lv.m_root.as_Static());
+ }
+ else {
+ m_out.write_count( lv.m_root.get_inner() );
+ }
+ serialise_vec(lv.m_wrappers);
+ }
+ void serialise(const ::MIR::LValue::Wrapper& w)
+ {
+ m_out.write_count(w.get_inner());
}
void serialise(const ::MIR::RValue& val)
{