Unverified Commit dca99770 by Enkelmann Committed by GitHub

Fix size computation of implicit subpiece instructions (#263)

parent f45bd69e
...@@ -303,10 +303,13 @@ impl Expression { ...@@ -303,10 +303,13 @@ impl Expression {
} }
Expression::Var(variable) => { Expression::Var(variable) => {
if let Some(register) = register_map.get(&variable.name) { if let Some(register) = register_map.get(&variable.name) {
if variable.name != *register.base_register { // We replace the register with a subpiece if the register itself is not a base register
// or if the expression is an implicit subpiece (identifiable with `variable.size < register.size`).
if variable.name != *register.base_register || variable.size < register.size {
let target_size = variable.size;
self.create_subpiece_from_sub_register( self.create_subpiece_from_sub_register(
register.base_register.clone(), register.base_register.clone(),
register.size, target_size,
register.lsb, register.lsb,
register_map, register_map,
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment