diff python/tcodegen.py @ 278:9fca39eebe50

First implementation of regalloc with coalsesc
author Windel Bouwman
date Sun, 29 Sep 2013 14:08:15 +0200
parents 6f2423df0675
children 2ccd57b1d78c
line wrap: on
line diff
--- a/python/tcodegen.py	Thu Sep 26 21:14:25 2013 +0200
+++ b/python/tcodegen.py	Sun Sep 29 14:08:15 2013 +0200
@@ -75,6 +75,19 @@
    ab(ab(a, b) + ab(9,b), 0);
 }
 """
+
+testsrc = """
+package test3;
+
+function int ab(int a, int b)
+{
+  var int c;
+  c = 0;
+  c = c + a + b;
+  return c; 
+}
+
+"""
 def dump_cfg(cga, cfg_file):
     print('digraph G {', file=cfg_file)
     #print('edge [constraint=none]', file=cfg_file)
@@ -107,23 +120,23 @@
     if not irc:
         diag.printErrors(testsrc)
     irc.check()
-    irc.dump()
+    #irc.dump()
     with open('ir.gv', 'w') as f:
         ir.dumpgv(irc, f)
     outs = outstream.TextOutputStream()
     cga = codegenarm.ArmCodeGenerator(outs)
     ir2 = cga.generate(irc)
 
-    with open('cfg.gv', 'w') as cfg_file:
-        dump_cfg(cga, cfg_file)
+    #with open('cfg.gv', 'w') as cfg_file:
+    #    dump_cfg(cga, cfg_file)
 
-    with open('ig.gv', 'w') as ig_file:
-        dump_ig(cga, ig_file)
+    #with open('ig.gv', 'w') as ig_file:
+    #    dump_ig(cga, ig_file)
         
-    for f in ir2:
-        print(f)
-        for i in f.instructions:
-            print('   {}'.format(i))
+    #for f in ir2:
+    #    print(f)
+    #    for i in f.instructions:
+    #        print('   {}'.format(i))
 
     outs.dump()