Improved Compiler API

This commit is contained in:
Syrus
2020-06-22 14:58:58 -07:00
parent 4ed23c59aa
commit 56c2f52001
3 changed files with 7 additions and 12 deletions

View File

@@ -207,11 +207,6 @@ impl CompilerConfig for Cranelift {
fn push_middleware(&mut self, middleware: Arc<dyn FunctionMiddlewareGenerator>) { fn push_middleware(&mut self, middleware: Arc<dyn FunctionMiddlewareGenerator>) {
self.middlewares.push(middleware); self.middlewares.push(middleware);
} }
/// Gets the default features for this compiler in the given target
fn default_features_for_target(&self, _target: &Target) -> Features {
Features::default()
}
} }
impl Default for Cranelift { impl Default for Cranelift {

View File

@@ -190,11 +190,6 @@ impl CompilerConfig for LLVM {
Box::new(LLVMCompiler::new(&self)) Box::new(LLVMCompiler::new(&self))
} }
/// Gets the default features for this compiler in the given target
fn default_features_for_target(&self, _target: &Target) -> Features {
Features::default()
}
/// Pushes a middleware onto the back of the middleware chain. /// Pushes a middleware onto the back of the middleware chain.
fn push_middleware(&mut self, middleware: Arc<dyn FunctionMiddlewareGenerator>) { fn push_middleware(&mut self, middleware: Arc<dyn FunctionMiddlewareGenerator>) {
self.middlewares.push(middleware); self.middlewares.push(middleware);

View File

@@ -21,13 +21,18 @@ pub trait CompilerConfig {
/// This is required for shared object generation (Native Engine), /// This is required for shared object generation (Native Engine),
/// but will make the JIT Engine to fail, since PIC is not yet /// but will make the JIT Engine to fail, since PIC is not yet
/// supported in the JIT linking phase. /// supported in the JIT linking phase.
fn enable_pic(&mut self); fn enable_pic(&mut self) {
// By default we do nothing, each backend will need to customize this
// in case they do something special for emitting PIC code.
}
/// Gets the custom compiler config /// Gets the custom compiler config
fn compiler(&self) -> Box<dyn Compiler + Send>; fn compiler(&self) -> Box<dyn Compiler + Send>;
/// Gets the default features for this compiler in the given target /// Gets the default features for this compiler in the given target
fn default_features_for_target(&self, target: &Target) -> Features; fn default_features_for_target(&self, target: &Target) -> Features {
Features::default()
}
/// Pushes a middleware onto the back of the middleware chain. /// Pushes a middleware onto the back of the middleware chain.
fn push_middleware(&mut self, middleware: Arc<dyn FunctionMiddlewareGenerator>); fn push_middleware(&mut self, middleware: Arc<dyn FunctionMiddlewareGenerator>);