comparison python/ppci/frontends/ks/irgenerator.py @ 106:f2d980eef509

improved code generation
author Windel Bouwman
date Mon, 31 Dec 2012 18:26:56 +0100
parents ed230e947dc6
children 1544e7a4aa98
comparison
equal deleted inserted replaced
105:6a303f835c6d 106:f2d980eef509
40 Error('Unknown Binop {0}'.format(node.op)) 40 Error('Unknown Binop {0}'.format(node.op))
41 41
42 elif type(node) is Unop: 42 elif type(node) is Unop:
43 if node.op == 'INTTOREAL': 43 if node.op == 'INTTOREAL':
44 self.genexprcode(node.a) 44 self.genexprcode(node.a)
45 node.reg = node.a.reg
46 # TODO use 'FILD' instruction
47 freg = 12
48 code.append('Unop inttoreal TODO') 45 code.append('Unop inttoreal TODO')
49 elif node.op == 'ABS': 46 elif node.op == 'ABS':
50 if isType(node.typ, real): 47 if isType(node.typ, real):
51 code = [0xD9, 0xE1] # st(0) = fabs st(0)
52 Error('ABS error integer') 48 Error('ABS error integer')
53 elif isType(node.typ, integer): 49 elif isType(node.typ, integer):
54 code = [] 50 code = []
55 Error('ABS error integer') 51 Error('ABS error integer')
56 else: 52 else: