Mercurial > lcfOS
comparison python/zcc.py @ 219:1fa3e0050b49
Expanded ad hoc code generator
author | Windel Bouwman |
---|---|
date | Sat, 06 Jul 2013 12:38:09 +0200 |
parents | 494828a7adf1 |
children | 81752b0f85a5 |
comparison
equal
deleted
inserted
replaced
218:494828a7adf1 | 219:1fa3e0050b49 |
---|---|
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 import outstream | 7 import outstream |
7 | 8 |
8 # Parse arguments: | 9 # Parse arguments: |
9 parser = argparse.ArgumentParser(description='lcfos Compiler') | 10 parser = argparse.ArgumentParser(description='lcfos Compiler') |
10 parser.add_argument('source', type=argparse.FileType('r'), \ | 11 parser.add_argument('source', type=argparse.FileType('r'), \ |
22 ircode = c3b.build(src) | 23 ircode = c3b.build(src) |
23 if not ircode: | 24 if not ircode: |
24 diag.printErrors(src) | 25 diag.printErrors(src) |
25 sys.exit(1) | 26 sys.exit(1) |
26 | 27 |
28 # Optimization passes: | |
29 cp = CleanPass() | |
30 cp.run(ircode) | |
31 | |
27 if args.dumpir: | 32 if args.dumpir: |
28 ircode.dump() | 33 ircode.dump() |
29 | |
30 # Code generation: | 34 # Code generation: |
31 | 35 |
32 #cg = codegen.CodeGenerator(arm_cm3.armtarget) | 36 #cg = codegen.CodeGenerator(arm_cm3.armtarget) |
33 outs = outstream.TextOutputStream() | 37 outs = outstream.TextOutputStream() |
34 cg = codegenarm.ArmCodeGenerator(outs) | 38 cg = codegenarm.ArmCodeGenerator(outs) |