diff python/tcodegen.py @ 272:e64bae57cda8

refactor ir
author Windel Bouwman
date Sat, 31 Aug 2013 17:58:54 +0200
parents 5f8c04a8d26b
children ea93e0a7a31e
line wrap: on
line diff
--- a/python/tcodegen.py	Tue Aug 20 18:56:02 2013 +0200
+++ b/python/tcodegen.py	Sat Aug 31 17:58:54 2013 +0200
@@ -11,6 +11,15 @@
 testsrc = """
 package test2;
 
+var int phaa, foo, bar;
+
+function int insanemath(int a, int b)
+{
+  var int c;
+  c = a + b + 1;
+  return c;
+}
+
 function void tesssst(int henkie)
 {
    var int a, b, cee;
@@ -22,7 +31,7 @@
    if (cee + a > b and b - a+b== 3*6-b)
    {
       var int x = a;
-      x = b - a;
+      x = b - a + insanemath(3, 4);
       a = x * (x + a);
    }
    else
@@ -43,7 +52,9 @@
     cga = codegenarm.ArmCodeGenerator(outs)
     cfg_file = open('cfg.gv', 'w')
     ig_file = open('ig.gv', 'w')
-    cga.generate(ir, cfg_file=cfg_file, ig_file=ig_file)
+    ir2 = cga.generate(ir, cfg_file=cfg_file, ig_file=ig_file)
     cfg_file.close()
     ig_file.close()
+    for i in ir2:
+        print(i)