Mercurial > lcfOS
comparison python/tcodegen.py @ 279:2ccd57b1d78c
Fix register allocator to do burn2 OK
author | Windel Bouwman |
---|---|
date | Sat, 12 Oct 2013 09:56:23 +0200 |
parents | 9fca39eebe50 |
children |
comparison
equal
deleted
inserted
replaced
278:9fca39eebe50 | 279:2ccd57b1d78c |
---|---|
80 package test3; | 80 package test3; |
81 | 81 |
82 function int ab(int a, int b) | 82 function int ab(int a, int b) |
83 { | 83 { |
84 var int c; | 84 var int c; |
85 var int *a2; | |
86 a2 = cast<int*>(2); | |
87 *a2 = 2; | |
88 *a2 = *a2 + 2; | |
85 c = 0; | 89 c = 0; |
86 c = c + a + b; | 90 c = c + a + b; |
87 return c; | 91 return c; |
88 } | 92 } |
89 | 93 |
125 ir.dumpgv(irc, f) | 129 ir.dumpgv(irc, f) |
126 outs = outstream.TextOutputStream() | 130 outs = outstream.TextOutputStream() |
127 cga = codegenarm.ArmCodeGenerator(outs) | 131 cga = codegenarm.ArmCodeGenerator(outs) |
128 ir2 = cga.generate(irc) | 132 ir2 = cga.generate(irc) |
129 | 133 |
130 #with open('cfg.gv', 'w') as cfg_file: | 134 with open('cfg.gv', 'w') as cfg_file: |
131 # dump_cfg(cga, cfg_file) | 135 dump_cfg(cga, cfg_file) |
132 | 136 |
133 #with open('ig.gv', 'w') as ig_file: | 137 with open('ig.gv', 'w') as ig_file: |
134 # dump_ig(cga, ig_file) | 138 dump_ig(cga, ig_file) |
135 | 139 |
136 #for f in ir2: | |
137 # print(f) | |
138 # for i in f.instructions: | |
139 # print(' {}'.format(i)) | |
140 | |
141 outs.dump() | 140 outs.dump() |
142 | 141 |