comparison python/ppci/c3/codegenerator.py @ 305:0615b5308710

Updated docs
author Windel Bouwman
date Fri, 06 Dec 2013 13:50:38 +0100
parents be7f60545368
children b145f8e6050b
comparison
equal deleted inserted replaced
304:fa99f36fabb5 305:0615b5308710
129 elif expr.op == 'and': 129 elif expr.op == 'and':
130 l2 = self.newBlock() 130 l2 = self.newBlock()
131 self.genCondCode(expr.a, l2, bbfalse) 131 self.genCondCode(expr.a, l2, bbfalse)
132 self.setBlock(l2) 132 self.setBlock(l2)
133 self.genCondCode(expr.b, bbtrue, bbfalse) 133 self.genCondCode(expr.b, bbtrue, bbfalse)
134 elif expr.op in ['==', '>', '<']: 134 elif expr.op in ['==', '>', '<', '!=', '<=', '>=']:
135 ta = self.genExprCode(expr.a) 135 ta = self.genExprCode(expr.a)
136 tb = self.genExprCode(expr.b) 136 tb = self.genExprCode(expr.b)
137 self.emit(ir.CJump(ta, expr.op, tb, bbtrue, bbfalse)) 137 self.emit(ir.CJump(ta, expr.op, tb, bbtrue, bbfalse))
138 else: 138 else:
139 raise NotImplementedError('Unknown condition {}'.format(expr)) 139 raise NotImplementedError('Unknown condition {}'.format(expr))
188 raise Exception() 188 raise Exception()
189 else: 189 else:
190 raise NotImplementedError("not implemented") 190 raise NotImplementedError("not implemented")
191 elif type(expr) is astnodes.FunctionCall: 191 elif type(expr) is astnodes.FunctionCall:
192 args = [self.genExprCode(e) for e in expr.args] 192 args = [self.genExprCode(e) for e in expr.args]
193 fn = self.funcMap[expr.proc] 193 #fn = self.funcMap[expr.proc]
194 fn = expr.proc.name
194 return ir.Call(fn, args) 195 return ir.Call(fn, args)
195 else: 196 else:
196 raise NotImplementedError('Unknown expr {}'.format(expr)) 197 raise NotImplementedError('Unknown expr {}'.format(expr))