comparison python/ir/instruction.py @ 157:8f3924b6076e

Added some code generator things
author Windel Bouwman
date Sun, 03 Mar 2013 18:14:35 +0100
parents b28a11c01dbe
children 9683a4cd848f
comparison
equal deleted inserted replaced
156:1b4a85bdd99c 157:8f3924b6076e
16 16
17 class BinaryOperator(Instruction): 17 class BinaryOperator(Instruction):
18 def __init__(self, operation, value1, value2): 18 def __init__(self, operation, value1, value2):
19 assert value1 19 assert value1
20 assert value2 20 assert value2
21 print('operation is in binops:', operation in BinOps) 21 #print('operation is in binops:', operation in BinOps)
22 # Check types of the two operands: 22 # Check types of the two operands:
23 self.value1 = value1 23 self.value1 = value1
24 self.value2 = value2 24 self.value2 = value2
25 self.operation = operation 25 self.operation = operation
26 26
27 class LoadInstruction(Instruction): 27 class AddInstruction(BinaryOperator):
28 def __init__(self, ptr, name, insertBefore): 28 def __init__(self, a, b):
29 self.setName(name) 29 super().__init__('add', a, b)
30 30
31 class ImmLoadInstruction(Instruction):
32 def __init__(self, value):
33 self.value = value
34