Mercurial > lcfOS
diff python/ir.py @ 279:2ccd57b1d78c
Fix register allocator to do burn2 OK
author | Windel Bouwman |
---|---|
date | Sat, 12 Oct 2013 09:56:23 +0200 |
parents | 046017431c6a |
children | 02385f62f250 |
line wrap: on
line diff
--- a/python/ir.py Sun Sep 29 14:08:15 2013 +0200 +++ b/python/ir.py Sat Oct 12 09:56:23 2013 +0200 @@ -274,6 +274,14 @@ """ Convenience call """ return Binop(a, '+', b) +def Sub(a, b): + return Binop(a, '-', b) + +def Mul(a, b): + return Binop(a, '*', b) + +def Div(a, b): + return Binop(a, '/', b) class Eseq(Expression): """ Sequence of instructions where the last is an expression """ @@ -397,6 +405,8 @@ return 'IF {} {} {} THEN {} ELSE {}'.format(self.a, self.cond, self.b, self.lab_yes, self.lab_no) +# Constructing IR: + class NamedClassGenerator: def __init__(self, prefix, cls): self.prefix = prefix