Mercurial > lcfOS
comparison python/testir.py @ 177:460db5669efa
Added clean pass for IR
author | Windel Bouwman |
---|---|
date | Mon, 22 Apr 2013 23:54:54 +0200 |
parents | 5fd02aa38b42 |
children | 25a0753da4cf |
comparison
equal
deleted
inserted
replaced
176:5fd02aa38b42 | 177:460db5669efa |
---|---|
32 //if (y < 2) | 32 //if (y < 2) |
33 //{ | 33 //{ |
34 // return y - 33; | 34 // return y - 33; |
35 //} | 35 //} |
36 | 36 |
37 res = res + (x + 2 * y) + (x + 2 * y) + (2*8) + (2*8); | |
38 | |
37 if (x > 13) | 39 if (x > 13) |
38 { | 40 { |
39 while (y > 1337) | 41 while (y > 1337) |
40 { | 42 { |
41 res = res + 2; | 43 res = res + 2; |
55 diag.printErrors(testsrc) | 57 diag.printErrors(testsrc) |
56 #ir.dump() | 58 #ir.dump() |
57 cf = transform.ConstantFolder() | 59 cf = transform.ConstantFolder() |
58 dcd = transform.DeadCodeDeleter() | 60 dcd = transform.DeadCodeDeleter() |
59 m2r = transform.Mem2RegPromotor() | 61 m2r = transform.Mem2RegPromotor() |
62 clr = transform.CleanPass() | |
60 ir.check() | 63 ir.check() |
61 cf.run(ir) | 64 cf.run(ir) |
62 dcd.run(ir) | 65 dcd.run(ir) |
66 clr.run(ir) | |
63 m2r.run(ir) | 67 m2r.run(ir) |
68 for bb in ir.BasicBlocks: | |
69 bb.dag = x86.Dag(bb) | |
64 #ir.dump() | 70 #ir.dump() |
65 | 71 |
66 # Dump a graphiz file: | 72 # Dump a graphiz file: |
67 with open('graaf.gv', 'w') as f: | 73 with open('graaf.gv', 'w') as f: |
68 ir.dumpgv(f) | 74 ir.dumpgv(f) |