Mercurial > lcfOS
comparison python/ppci/ir2tree.py @ 394:988f3fb861e4
c3 code generator rewrite
author | Windel Bouwman |
---|---|
date | Thu, 22 May 2014 08:14:12 +0200 |
parents | c49459768aaa |
children | 5d03c10fe19d |
comparison
equal
deleted
inserted
replaced
393:6ae782a085e0 | 394:988f3fb861e4 |
---|---|
11 f_map[tp] = f | 11 f_map[tp] = f |
12 return f | 12 return f |
13 return reg_f | 13 return reg_f |
14 | 14 |
15 @register(ir.Binop) | 15 @register(ir.Binop) |
16 @register(ir.Add) | |
16 def binop_to_tree(e): | 17 def binop_to_tree(e): |
17 names = {'+':'ADDI32', '-':'SUBI32', '|':'ORI32', '<<':'SHLI32', | 18 names = {'+':'ADDI32', '-':'SUBI32', '|':'ORI32', '<<':'SHLI32', |
18 '*':'MULI32', '&':'ANDI32', '>>':'SHRI32'} | 19 '*':'MULI32', '&':'ANDI32', '>>':'SHRI32'} |
19 op = names[e.operation] | 20 op = names[e.operation] |
20 return Tree(op, makeTree(e.a), makeTree(e.b)) | 21 return Tree(op, makeTree(e.a), makeTree(e.b)) |