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.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/trans/codegen.cpp b/src/trans/codegen.cpp
index b2b614a9..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.
@@ -189,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);
}