1.1 --- a/micropython/opt.py Mon Sep 05 00:16:33 2011 +0200
1.2 +++ b/micropython/opt.py Mon Sep 05 00:57:24 2011 +0200
1.3 @@ -422,23 +422,31 @@
1.4 subsequent use.
1.5 """
1.6
1.7 - if self.should_optimise_temp_storage() and \
1.8 - self.have_temp_compatible_access():
1.9 + if self.should_optimise_temp_storage():
1.10 +
1.11 + # Emitted instructions can be obtained.
1.12 +
1.13 + if self.have_temp_compatible_access():
1.14
1.15 - # Remove the active value contributor if possible.
1.16 + # Remove the active value contributor if possible.
1.17
1.18 - removed = self.remove_active_value()
1.19 - if removed is not None:
1.20 + removed = self.remove_active_value()
1.21 + if removed is not None:
1.22 +
1.23 + # Extend the lifetime of any temporary storage location.
1.24
1.25 - # Extend the lifetime of any temporary storage location.
1.26 + self.translation.ensure_temp(removed)
1.27 + return removed
1.28
1.29 - self.translation.ensure_temp(removed)
1.30 - return removed
1.31 + # Otherwise, just leave it in place, but return the instruction.
1.32
1.33 - # Otherwise, just leave it in place, but return the instruction.
1.34 + else:
1.35 + return self.get_active_value()
1.36
1.37 - else:
1.38 - return self.get_active_value()
1.39 + # Or provisional temporary instructions.
1.40 +
1.41 + elif self.saved_value_op is not None:
1.42 + return self.saved_value_op
1.43
1.44 return self.translation.get_temp()
1.45
2.1 --- a/micropython/trans.py Mon Sep 05 00:16:33 2011 +0200
2.2 +++ b/micropython/trans.py Mon Sep 05 00:57:24 2011 +0200
2.3 @@ -745,6 +745,8 @@
2.4
2.5 In addition, the invocation frame will be shifted if 'temp_context'
2.6 indicates a function or a class.
2.7 +
2.8 + NOTE: This should probably be migrated to a native library.
2.9 """
2.10
2.11 adjust_block = self.new_block()