-
Notifications
You must be signed in to change notification settings - Fork 0
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
[VAN-545] extract loop body to separate function before unrolling #52
Conversation
Needed to allow certain fields to be mutated during the run/execute visitor pattern that previously required a borrow on the entire PassMemory object.
…cmp counter also a few minor rust warning fixes and code cleanup
29792e1
to
678c9eb
Compare
add additional test (that happened to need this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think I get the general idea of the algorithms you have been using to do the extraction and looks good to me. I mostly commented about commented out code that we should remove if its no longer useful and a couple minor details.
circuit_passes/src/bucket_interpreter/env/extracted_func_env.rs
Outdated
Show resolved
Hide resolved
circuit_passes/src/bucket_interpreter/env/extracted_func_env.rs
Outdated
Show resolved
Hide resolved
circuit_passes/src/bucket_interpreter/env/extracted_func_env.rs
Outdated
Show resolved
Hide resolved
circuit_passes/src/bucket_interpreter/env/extracted_func_env.rs
Outdated
Show resolved
Hide resolved
circuit_passes/src/bucket_interpreter/env/extracted_func_env.rs
Outdated
Show resolved
Hide resolved
let get_ptr = || { | ||
let arr_ptr = match &self.address_type { | ||
AddressType::Variable => producer.body_ctx().get_variable_array(producer), | ||
AddressType::Signal => producer.template_ctx().get_signal_array(producer), | ||
AddressType::SubcmpSignal { cmp_address, counter_override, .. } => { | ||
let addr = cmp_address.produce_llvm_ir(producer) | ||
.expect("The address of a subcomponent must yield a value!"); | ||
if *counter_override { | ||
return producer.template_ctx().load_subcmp_counter(producer, addr) | ||
} else { | ||
let subcmp = producer.template_ctx().load_subcmp_addr(producer, addr); | ||
create_gep(producer, subcmp, &[zero(producer)]) | ||
} | ||
} | ||
}; | ||
pointer_cast(producer, arr_ptr.into_pointer_value(), array_ptr_ty(producer)) | ||
}; | ||
create_call(producer, name.as_str(), &[get_ptr().into(), index.into()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a closure here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I could do an early return for the counter_override
case :)
And sorry for 29 comments all of a sudden |
No description provided.