comparison python/testir.py @ 180:25a0753da4cf

Re-organized files
author Windel Bouwman
date Thu, 09 May 2013 17:35:19 +0200
parents 460db5669efa
children de3a68f677a5
comparison
equal deleted inserted replaced
179:0f3b1adfd416 180:25a0753da4cf
50 """ 50 """
51 51
52 if __name__ == '__main__': 52 if __name__ == '__main__':
53 diag = ppci.DiagnosticsManager() 53 diag = ppci.DiagnosticsManager()
54 builder = c3.Builder(diag) 54 builder = c3.Builder(diag)
55 cgenx86 = x86.X86CodeGen(diag) 55 cgenx86 = x86.X86CodeGenSimple(diag)
56 ir = builder.build(testsrc) 56 ir = builder.build(testsrc)
57 diag.printErrors(testsrc) 57 diag.printErrors(testsrc)
58 #ir.dump() 58 #ir.dump()
59 cf = transform.ConstantFolder() 59 cf = transform.ConstantFolder()
60 dcd = transform.DeadCodeDeleter() 60 dcd = transform.DeadCodeDeleter()
63 ir.check() 63 ir.check()
64 cf.run(ir) 64 cf.run(ir)
65 dcd.run(ir) 65 dcd.run(ir)
66 clr.run(ir) 66 clr.run(ir)
67 m2r.run(ir) 67 m2r.run(ir)
68 for bb in ir.BasicBlocks:
69 bb.dag = x86.Dag(bb)
70 #ir.dump() 68 #ir.dump()
71 69
72 # Dump a graphiz file: 70 # Dump a graphiz file:
73 with open('graaf.gv', 'w') as f: 71 with open('graaf.gv', 'w') as f:
74 ir.dumpgv(f) 72 ir.dumpgv(f)
79 # print(a) 77 # print(a)
80 with open('out.asm', 'w') as f: 78 with open('out.asm', 'w') as f:
81 f.write('BITS 64\n') 79 f.write('BITS 64\n')
82 for a in asm: 80 for a in asm:
83 f.write(str(a) + '\n') 81 f.write(str(a) + '\n')
82 print(a)
83