Mercurial > lcfOS
diff ide/compiler/codegenerator.py @ 4:0d5ef85b8698
Improved link between ast viewer and code edit
author | windel-eee |
---|---|
date | Wed, 21 Sep 2011 19:05:18 +0200 |
parents | 92df07bc2081 |
children | 818f80afa78b |
line wrap: on
line diff
--- a/ide/compiler/codegenerator.py Sun Sep 18 21:21:54 2011 +0200 +++ b/ide/compiler/codegenerator.py Wed Sep 21 19:05:18 2011 +0200 @@ -405,12 +405,21 @@ elif type(node) is ForStatement: # Initial load of iterator variable: self.genexprcode(node.begin) - self.storeRegInDesignator(node.begin.reg, node.variable) - self.freereg(node.begin) + self.genexprcode(node.end) + # TODO: link reg with variable so that a register is used instead of a variable + iterreg = node.begin.reg # Get the register used for the loop + #self.addCode(cmpreg64(iterreg, node.endvalue)) rip1 = self.rip self.gencode(node.statements) #self.loadDesignatorInReg(node. #self.addCode( addreg64(node.variable, node.increment) ) + self.addCode(nearjump(0x0)) + fixloc1 = self.rip - 4 + rip2 = self.rip + self.fixCode(fixloc1, imm32(rip1 - rip2)) + + self.freereg(node.begin) # Release register used in loop + self.freereg(node.end) Error('No implementation of FOR statement') elif type(node) is AsmCode: