comparison python/c3/codegenerator.py @ 280:02385f62f250

Rework from str interface to Instruction interface
author Windel Bouwman
date Sat, 02 Nov 2013 10:03:26 +0100
parents 2ccd57b1d78c
children 1c7c1e619be8
comparison
equal deleted inserted replaced
279:2ccd57b1d78c 280:02385f62f250
157 ra = self.genExprCode(expr.a) 157 ra = self.genExprCode(expr.a)
158 assert type(ra) is ir.Mem 158 assert type(ra) is ir.Mem
159 return ra.e 159 return ra.e
160 elif type(expr) is astnodes.VariableUse: 160 elif type(expr) is astnodes.VariableUse:
161 # This returns the dereferenced variable. 161 # This returns the dereferenced variable.
162 return ir.Mem(self.varMap[expr.target]) 162 if expr.target.isParameter:
163 # TODO: now parameters are handled different. Not nice?
164 return self.varMap[expr.target]
165 else:
166 return ir.Mem(self.varMap[expr.target])
163 elif type(expr) is astnodes.Deref: 167 elif type(expr) is astnodes.Deref:
164 # dereference pointer type: 168 # dereference pointer type:
165 addr = self.genExprCode(expr.ptr) 169 addr = self.genExprCode(expr.ptr)
166 return ir.Mem(addr) 170 return ir.Mem(addr)
167 elif type(expr) is astnodes.FieldRef: 171 elif type(expr) is astnodes.FieldRef: