summaryrefslogtreecommitdiff
path: root/src/trans/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trans/codegen.cpp')
-rw-r--r--src/trans/codegen.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/trans/codegen.cpp b/src/trans/codegen.cpp
index 9e93caba..3a75e623 100644
--- a/src/trans/codegen.cpp
+++ b/src/trans/codegen.cpp
@@ -15,19 +15,23 @@
#include "codegen.hpp"
#include "monomorphise.hpp"
-void Trans_Codegen(const ::std::string& outfile, const TransOptions& opt, const ::HIR::Crate& crate, const TransList& list, bool is_executable)
+void Trans_Codegen(const ::std::string& outfile, CodegenOutput out_ty, const TransOptions& opt, const ::HIR::Crate& crate, const TransList& list, const ::std::string& hir_file)
{
static Span sp;
- ::std::unique_ptr<CodeGenerator> codegen;
+ ::std::unique_ptr<CodeGenerator> codegen;
if( opt.mode == "monomir" )
{
codegen = Trans_Codegen_GetGenerator_MonoMir(crate, outfile);
}
- else
+ else if( opt.mode == "c" )
{
codegen = Trans_Codegen_GetGeneratorC(crate, outfile);
}
+ else
+ {
+ BUG(sp, "Unknown codegen mode '" << opt.mode << "'");
+ }
// 1. Emit structure/type definitions.
// - Emit in the order they're needed.
@@ -43,6 +47,9 @@ void Trans_Codegen(const ::std::string& outfile, const TransOptions& opt, const
TU_MATCHA( (te.binding), (tpb),
(Unbound, throw ""; ),
(Opaque, throw ""; ),
+ (ExternType,
+ //codegen->emit_extern_type(sp, te.path.m_data.as_Generic(), *tpb);
+ ),
(Struct,
codegen->emit_struct(sp, te.path.m_data.as_Generic(), *tpb);
),
@@ -186,6 +193,6 @@ void Trans_Codegen(const ::std::string& outfile, const TransOptions& opt, const
}
}
- codegen->finalise(is_executable, opt);
+ codegen->finalise(opt, out_ty, hir_file);
}