comparison python/target.py @ 277:046017431c6a

Started register allocator
author Windel Bouwman
date Thu, 26 Sep 2013 21:14:25 +0200
parents 6f2423df0675
children 02385f62f250
comparison
equal deleted inserted replaced
276:56d37ed4b4d2 277:046017431c6a
182 if ic.mnemonic.upper() == vi.mnemonic.upper() and len(ic.operands) == len(vi.operands): 182 if ic.mnemonic.upper() == vi.mnemonic.upper() and len(ic.operands) == len(vi.operands):
183 # Try to map operands to the correct operand types: 183 # Try to map operands to the correct operand types:
184 rops = [roptype.Create(vop) for roptype, vop in zip(ic.operands, vi.operands)] 184 rops = [roptype.Create(vop) for roptype, vop in zip(ic.operands, vi.operands)]
185 185
186 # Check if we succeeded: 186 # Check if we succeeded:
187 optypes = tuple(map(type, rops)) 187 if all(isinstance(rop, optype) for rop, optype in zip(rops, ic.operands)):
188 if ic.operands == optypes:
189 return ic(*rops) 188 return ic(*rops)
190 raise CompilerError('No suitable instruction found for "{0}"'.format(vi)) 189 raise CompilerError('No suitable instruction found for "{0}"'.format(vi))
191 190