Add a compiler-llvm CompilerFunctionKind for the whole module which can occur with the experimental API for engine-native.

Since it's no longer per-function, rename CompilerFunctionKind to CompilerKind.
This commit is contained in:
Nick Lewycky
2020-08-20 23:28:07 -07:00
parent 91414df670
commit 5d40787856
6 changed files with 29 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
use crate::config::{CompiledFunctionKind, LLVM};
use crate::config::{CompiledKind, LLVM};
use crate::object_file::{load_object_file, CompiledFunction};
use crate::translator::abi::{
func_type_to_llvm, get_vmctx_ptr_param, is_sret, pack_values_for_register_return,
@@ -42,7 +42,7 @@ impl FuncTrampoline {
name: &str,
) -> Result<Module, CompileError> {
// The function type, used for the callbacks.
let function = CompiledFunctionKind::FunctionCallTrampoline(ty.clone());
let function = CompiledKind::FunctionCallTrampoline(ty.clone());
let module = self.ctx.create_module("");
let target_machine = &self.target_machine;
let target_triple = target_machine.get_triple();
@@ -102,7 +102,7 @@ impl FuncTrampoline {
name: &str,
) -> Result<FunctionBody, CompileError> {
let module = self.trampoline_to_module(ty, config, name)?;
let function = CompiledFunctionKind::FunctionCallTrampoline(ty.clone());
let function = CompiledKind::FunctionCallTrampoline(ty.clone());
let target_machine = &self.target_machine;
let memory_buffer = target_machine
@@ -172,7 +172,7 @@ impl FuncTrampoline {
name: &str,
) -> Result<Module, CompileError> {
// The function type, used for the callbacks
let function = CompiledFunctionKind::DynamicFunctionTrampoline(ty.clone());
let function = CompiledKind::DynamicFunctionTrampoline(ty.clone());
let module = self.ctx.create_module("");
let target_machine = &self.target_machine;
let target_triple = target_machine.get_triple();
@@ -222,7 +222,7 @@ impl FuncTrampoline {
config: &LLVM,
name: &str,
) -> Result<FunctionBody, CompileError> {
let function = CompiledFunctionKind::DynamicFunctionTrampoline(ty.clone());
let function = CompiledKind::DynamicFunctionTrampoline(ty.clone());
let target_machine = &self.target_machine;
let module = self.dynamic_trampoline_to_module(ty, config, name)?;