|
@@ -156,6 +156,11 @@ class ReturnInstruction(VoidInstruction):
|
|
Instruction.__init__(self)
|
|
Instruction.__init__(self)
|
|
self.value = value
|
|
self.value = value
|
|
|
|
|
|
|
|
+ def simplify(self):
|
|
|
|
+ """Applies basic simplification to this instruction and its children."""
|
|
|
|
+
|
|
|
|
+ return LoopInstruction(self.value.simplify())
|
|
|
|
+
|
|
def generate_python_def(self, code_generator):
|
|
def generate_python_def(self, code_generator):
|
|
"""Generates Python code for this instruction."""
|
|
"""Generates Python code for this instruction."""
|
|
|
|
|
|
@@ -171,6 +176,11 @@ class LoopInstruction(VoidInstruction):
|
|
Instruction.__init__(self)
|
|
Instruction.__init__(self)
|
|
self.body = body
|
|
self.body = body
|
|
|
|
|
|
|
|
+ def simplify(self):
|
|
|
|
+ """Applies basic simplification to this instruction and its children."""
|
|
|
|
+
|
|
|
|
+ return LoopInstruction(self.body.simplify())
|
|
|
|
+
|
|
def generate_python_def(self, code_generator):
|
|
def generate_python_def(self, code_generator):
|
|
"""Generates Python code for this instruction."""
|
|
"""Generates Python code for this instruction."""
|
|
|
|
|