Mercurial > lcfOS
comparison python/testir.py @ 172:5a7d37d615ee
Added function to IR
author | Windel Bouwman |
---|---|
date | Thu, 04 Apr 2013 17:58:37 +0200 |
parents | 3eb9b9e2958d |
children | c1d2b6b9f9a7 |
comparison
equal
deleted
inserted
replaced
171:3eb9b9e2958d | 172:5a7d37d615ee |
---|---|
22 } | 22 } |
23 var int y; | 23 var int y; |
24 y = a - b * 53; | 24 y = a - b * 53; |
25 } | 25 } |
26 | 26 |
27 function int add2(int x, int y) | |
28 { | |
29 var int res; | |
30 res = x + y; | |
31 return res; | |
32 } | |
33 | |
27 """ | 34 """ |
28 | 35 |
29 if __name__ == '__main__': | 36 if __name__ == '__main__': |
30 diag = ppci.DiagnosticsManager() | 37 diag = ppci.DiagnosticsManager() |
31 builder = c3.Builder(diag) | 38 builder = c3.Builder(diag) |
32 cgenx86 = x86.X86CodeGen(diag) | 39 cgenx86 = x86.X86CodeGen(diag) |
33 ir = builder.build(testsrc) | 40 ir = builder.build(testsrc) |
41 diag.printErrors(testsrc) | |
34 ir.check() | 42 ir.check() |
35 ir.analyze() | 43 ir.analyze() |
36 #ir.constantProp() | 44 #ir.constantProp() |
37 ir.dump() | 45 ir.dump() |
38 asm = cgenx86.genBin(ir) | 46 asm = cgenx86.genBin(ir) |