comparison python/zcc.py @ 252:c4370696ccc7

added optimize function
author Windel Bouwman
date Tue, 30 Jul 2013 17:57:46 +0200
parents e41e4109addd
children 74c6a20302d5
comparison
equal deleted inserted replaced
251:6ed3d3a82a63 252:c4370696ccc7
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import sys, argparse 3 import sys, argparse
4 import c3, ppci, codegen 4 import c3, ppci, codegen
5 import codegenarm 5 import codegenarm
6 from transform import CleanPass, SameImmLoadDeletePass 6 import transform
7 import outstream 7 import outstream
8 import hexfile 8 import hexfile
9 9
10 # Parse arguments: 10 # Parse arguments:
11 parser = argparse.ArgumentParser(description='lcfos Compiler') 11 parser = argparse.ArgumentParser(description='lcfos Compiler')
21 ircode = c3b.build(src) 21 ircode = c3b.build(src)
22 if not ircode: 22 if not ircode:
23 return 23 return
24 24
25 # Optimization passes: 25 # Optimization passes:
26 ircode.check() 26 transform.optimize(ircode)
27 cp = CleanPass()
28 cp.run(ircode)
29 ircode.check()
30 sidp = SameImmLoadDeletePass()
31 sidp.run(ircode)
32 ircode.check()
33 27
34 if dumpir: 28 if dumpir:
35 ircode.dump() 29 ircode.dump()
36 30
37 # Code generation: 31 # Code generation: