소스 검색

Implement simplify in more IR nodes

jonathanvdc 8 년 전
부모
커밋
9c157185e0
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      kernel/modelverse_jit/ir.py

+ 10 - 0
kernel/modelverse_jit/ir.py

@@ -156,6 +156,11 @@ class ReturnInstruction(VoidInstruction):
         Instruction.__init__(self)
         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):
         """Generates Python code for this instruction."""
 
@@ -171,6 +176,11 @@ class LoopInstruction(VoidInstruction):
         Instruction.__init__(self)
         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):
         """Generates Python code for this instruction."""