Move backend_id to static str

This commit is contained in:
Syrus
2020-01-13 15:40:09 +01:00
parent cb5cf00442
commit a1d8b9aa5b
6 changed files with 17 additions and 11 deletions

View File

@ -92,7 +92,7 @@ pub trait ModuleCodeGenerator<FCG: FunctionCodeGenerator<E>, RM: RunnableModule,
) -> Self;
/// Returns the backend id associated with this MCG.
fn backend_id() -> String;
fn backend_id() -> &'static str;
/// It sets if the current compiler requires validation before compilation
fn requires_pre_validation() -> bool {
@ -231,7 +231,7 @@ impl<
validate_with_features(wasm, &compiler_config.features)?;
}
let mut mcg = match MCG::backend_id().as_ref() {
let mut mcg = match MCG::backend_id() {
"llvm" => MCG::new_with_target(
compiler_config.triple.clone(),
compiler_config.cpu_name.clone(),

View File

@ -82,7 +82,7 @@ pub fn read_module<
func_assoc: Map::new(),
signatures: Map::new(),
backend: MCG::backend_id(),
backend: MCG::backend_id().to_string(),
namespace_table: StringTable::new(),
name_table: StringTable::new(),