summaryrefslogtreecommitdiff
path: root/src/trans/codegen.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-12-10 09:15:04 +0800
committerJohn Hodge <tpg@mutabah.net>2016-12-10 09:15:04 +0800
commit138104dae328ca5f551d003e9c6c2426d7c58196 (patch)
tree861e71466cce5bdbb7a58c9212e533e19ad22775 /src/trans/codegen.cpp
parent48c1ed15bfd4bd5fcc30c3015483e4336dc05c63 (diff)
downloadmrust-138104dae328ca5f551d003e9c6c2426d7c58196.tar.gz
Trans - Monomorphise static types
Diffstat (limited to 'src/trans/codegen.cpp')
-rw-r--r--src/trans/codegen.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/trans/codegen.cpp b/src/trans/codegen.cpp
index 822d4264..3f6413a1 100644
--- a/src/trans/codegen.cpp
+++ b/src/trans/codegen.cpp
@@ -177,9 +177,12 @@ void Trans_Codegen(const ::std::string& outfile, const ::HIR::Crate& crate, cons
// 1. Emit structure/type definitions.
// - Emit in the order they're needed.
{
+ TRACE_FUNCTION;
+
TypeVisitor tv { *codegen };
for(const auto& ent : list.m_functions)
{
+ TRACE_FUNCTION_F("Enumerate fn " << ent.first);
assert(ent.second->ptr);
const auto& fcn = *ent.second->ptr;
const auto& pp = ent.second->pp;
@@ -199,10 +202,12 @@ void Trans_Codegen(const ::std::string& outfile, const ::HIR::Crate& crate, cons
}
for(const auto& ent : list.m_statics)
{
+ TRACE_FUNCTION_F("Enumerate static " << ent.first);
assert(ent.second->ptr);
const auto& stat = *ent.second->ptr;
+ const auto& pp = ent.second->pp;
- tv.visit_type( stat.m_type );
+ tv.visit_type( pp.monomorph(crate, stat.m_type) );
}
}
@@ -239,7 +244,9 @@ void Trans_Codegen(const ::std::string& outfile, const ::HIR::Crate& crate, cons
// 4. Emit function code
for(const auto& ent : list.m_functions)
{
- if( ent.second->ptr && ent.second->ptr->m_code.m_mir ) {
+ if( ent.second->ptr && ent.second->ptr->m_code.m_mir )
+ {
+ TRACE_FUNCTION_F(ent.first);
DEBUG("FUNCTION CODE " << ent.first);
const auto& fcn = *ent.second->ptr;
// TODO: If this is a provided trait method, it needs to be monomorphised too.