Mercurial > lcfOS
diff python/testir.py @ 176:5fd02aa38b42
Added while loop code generation
author | Windel Bouwman |
---|---|
date | Sat, 20 Apr 2013 12:00:51 +0200 |
parents | a51b3c956386 |
children | 460db5669efa |
line wrap: on
line diff
--- a/python/testir.py Fri Apr 19 22:15:54 2013 +0200 +++ b/python/testir.py Sat Apr 20 12:00:51 2013 +0200 @@ -36,7 +36,11 @@ if (x > 13) { - res = res + 2; + while (y > 1337) + { + res = res + 2; + y = y - 12; + } } return res; } @@ -58,6 +62,12 @@ dcd.run(ir) m2r.run(ir) #ir.dump() + + # Dump a graphiz file: + with open('graaf.gv', 'w') as f: + ir.dumpgv(f) + os.system('dot -Tpdf -ograaf.pdf graaf.gv') + asm = cgenx86.genBin(ir) #for a in asm: # print(a) @@ -65,9 +75,3 @@ f.write('BITS 64\n') for a in asm: f.write(str(a) + '\n') - - # Dump a graphiz file: - with open('graaf.gv', 'w') as f: - ir.dumpgv(f) - os.system('dot -Tpdf -ograaf.pdf graaf.gv') -