Mercurial > lcfOS
comparison python/c3/codegenerator.py @ 252:c4370696ccc7
added optimize function
author | Windel Bouwman |
---|---|
date | Tue, 30 Jul 2013 17:57:46 +0200 |
parents | e41e4109addd |
children | 7416c923a02a |
comparison
equal
deleted
inserted
replaced
251:6ed3d3a82a63 | 252:c4370696ccc7 |
---|---|
188 tmp2 = self.builder.newTmp('adr_' + expr.field) | 188 tmp2 = self.builder.newTmp('adr_' + expr.field) |
189 ins = ir.BinaryOperator(tmp2, '+', b, offset) | 189 ins = ir.BinaryOperator(tmp2, '+', b, offset) |
190 self.builder.addIns(ins) | 190 self.builder.addIns(ins) |
191 return self.cast_to_rvalue(expr, tmp2) | 191 return self.cast_to_rvalue(expr, tmp2) |
192 elif type(expr) is astnodes.Literal: | 192 elif type(expr) is astnodes.Literal: |
193 tmp = self.builder.newTmp() | 193 tmp = self.builder.newTmp('const') |
194 ins = ir.ImmLoad(tmp, expr.val) | 194 ins = ir.ImmLoad(tmp, expr.val) |
195 self.builder.addIns(ins) | 195 self.builder.addIns(ins) |
196 return tmp | 196 return tmp |
197 elif type(expr) is astnodes.TypeCast: | 197 elif type(expr) is astnodes.TypeCast: |
198 ar = self.genExprCode(expr.a) | 198 ar = self.genExprCode(expr.a) |