1.1 --- a/micropython/ast.py Sun Sep 07 00:35:03 2008 +0200
1.2 +++ b/micropython/ast.py Sun Sep 07 00:47:20 2008 +0200
1.3 @@ -31,8 +31,7 @@
1.4
1.5 supported_optimisations = [
1.6 "constant_storage", "source_storage", "known_target", "self_access",
1.7 - "temp_storage", "load_operations", "no_operations", "unused_results",
1.8 - "superfluous_temp_operations"
1.9 + "temp_storage", "load_operations", "no_operations", "unused_results"
1.10 ]
1.11
1.12 def __init__(self, translation, optimisations=None):
1.13 @@ -69,9 +68,6 @@
1.14 def should_optimise_away_no_operations(self):
1.15 return "no_operations" in self.optimisations
1.16
1.17 - def should_optimise_away_superfluous_temp_operations(self):
1.18 - return "superfluous_temp_operations" in self.optimisations
1.19 -
1.20 def should_optimise_unused_results(self):
1.21 return "unused_results" in self.optimisations
1.22
1.23 @@ -132,18 +128,6 @@
1.24 isinstance(instruction.input, LoadResult) and isinstance(instruction, StoreResult)
1.25 )
1.26
1.27 - def is_superfluous_temp_operation(self, instruction):
1.28 -
1.29 - """
1.30 - Return whether 'instruction' merely loads its input from a recent
1.31 - temporary storage operation.
1.32 - """
1.33 -
1.34 - return (
1.35 - isinstance(instruction.source, LoadTemp) and isinstance(self.translation.active_source, StoreTemp) and
1.36 - instruction.source.attr == self.translation.active_source.attr
1.37 - )
1.38 -
1.39 def is_input(self, instruction):
1.40
1.41 "Return whether 'instruction' provides an input."
1.42 @@ -377,20 +361,6 @@
1.43 else:
1.44 return 0
1.45
1.46 - def optimise_away_superfluous_temp_operations(self, instruction):
1.47 -
1.48 - """
1.49 - Optimise away operations which just store temporary values for
1.50 - immediate retrieval.
1.51 - """
1.52 -
1.53 - if self.should_optimise_away_superfluous_temp_operations() and \
1.54 - self.is_superfluous_temp_operation(instruction) and \
1.55 - self.translation.active_source == self.translation.active:
1.56 -
1.57 - instruction.source = self.translation.active_source.input
1.58 - self.translation.remove_op()
1.59 -
1.60 def optimise_unused_results(self):
1.61
1.62 "Discard results which will not be used."
1.63 @@ -701,7 +671,6 @@
1.64 self.optimiser.optimise_load_operations(op)
1.65 if self.optimiser.optimise_away_no_operations(op):
1.66 return
1.67 - self.optimiser.optimise_away_superfluous_temp_operations(op)
1.68
1.69 self.code.append(op)
1.70 self.active = op