comparison python/zcc.py @ 239:63bb40758066

added check
author Windel Bouwman
date Mon, 22 Jul 2013 17:57:25 +0200
parents 90637d1bbfad
children f254b87258e6
comparison
equal deleted inserted replaced
238:90637d1bbfad 239:63bb40758066
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 6 from transform import CleanPass, SameImmLoadDeletePass
7 import outstream 7 import outstream
8 8
9 # Parse arguments: 9 # Parse arguments:
10 parser = argparse.ArgumentParser(description='lcfos Compiler') 10 parser = argparse.ArgumentParser(description='lcfos Compiler')
11 parser.add_argument('source', type=argparse.FileType('r'), \ 11 parser.add_argument('source', type=argparse.FileType('r'), \
24 if not ircode: 24 if not ircode:
25 diag.printErrors(src) 25 diag.printErrors(src)
26 sys.exit(1) 26 sys.exit(1)
27 27
28 # Optimization passes: 28 # Optimization passes:
29 ircode.check()
29 cp = CleanPass() 30 cp = CleanPass()
30 cp.run(ircode) 31 cp.run(ircode)
32 ircode.check()
33 sidp = SameImmLoadDeletePass()
34 sidp.run(ircode)
35 ircode.check()
31 36
32 if args.dumpir: 37 if args.dumpir:
33 ircode.dump() 38 ircode.dump()
34 # Code generation: 39 # Code generation:
35 40