Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clif-backend: Eliminate FunctionEnvironment construction in feed_event() #615

Merged
merged 2 commits into from
Aug 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions lib/clif-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ impl ModuleCodeGenerator<CraneliftFunctionCodeGenerator, Caller, CodegenError>
func,
func_translator,
next_local: 0,
clif_signatures: self.clif_signatures.clone(),
module_info: Arc::clone(&module_info),
target_config: self.isa.frontend_config().clone(),
position: Position::default(),
func_env: FunctionEnvironment {
module_info: Arc::clone(&module_info),
target_config: self.isa.frontend_config().clone(),
clif_signatures: self.clif_signatures.clone(),
},
};

debug_assert_eq!(func_env.func.dfg.num_ebbs(), 0, "Function must be empty");
Expand Down Expand Up @@ -391,10 +394,9 @@ pub struct CraneliftFunctionCodeGenerator {
func: Function,
func_translator: FuncTranslator,
next_local: usize,
pub clif_signatures: Map<SigIndex, ir::Signature>,
module_info: Arc<RwLock<ModuleInfo>>,
target_config: isa::TargetFrontendConfig,
position: Position,
func_env: FunctionEnvironment,
}

pub struct FunctionEnvironment {
Expand Down Expand Up @@ -1138,11 +1140,6 @@ impl FunctionCodeGenerator<CodegenError> for CraneliftFunctionCodeGenerator {
//let builder = self.builder.as_mut().unwrap();
//let func_environment = FuncEnv::new();
//let state = TranslationState::new();
let mut function_environment = FunctionEnvironment {
module_info: Arc::clone(&self.module_info),
target_config: self.target_config.clone(),
clif_signatures: self.clif_signatures.clone(),
};

if self.func_translator.state.control_stack.is_empty() {
return Ok(());
Expand All @@ -1154,7 +1151,7 @@ impl FunctionCodeGenerator<CodegenError> for CraneliftFunctionCodeGenerator {
&mut self.position,
);
let state = &mut self.func_translator.state;
translate_operator(op, &mut builder, state, &mut function_environment)?;
translate_operator(op, &mut builder, state, &mut self.func_env)?;
Ok(())
}

Expand Down