diff python/testir.py @ 175:a51b3c956386

Added function call in expressions
author Windel Bouwman
date Fri, 19 Apr 2013 22:15:54 +0200
parents 3eb06f5fb987
children 5fd02aa38b42
line wrap: on
line diff
--- a/python/testir.py	Fri Apr 19 19:22:52 2013 +0200
+++ b/python/testir.py	Fri Apr 19 22:15:54 2013 +0200
@@ -4,21 +4,22 @@
 testsrc = """
 package test2;
 
-function void tst()
+function void tesssst(int henkie)
 {
-   var int a, b;
+   var int a, b, cee;
    a = 2 * 33 - 12;
    b = a * 2 + 13;
    a = b + a;
+   cee = a;
    if (a > b and b *3 - a+8*b== 3*6-b)
    {
       var int x = a;
       x = b * 2 - a;
-      a = x * x;
+      a = x * x * add2(x, 22 - a);
    }
    else
    {
-      a = b + a;
+      a = b + a + add2(a, b);
    }
    var int y;
    y = a - b * 53;
@@ -28,6 +29,11 @@
 {
    var int res;
    res = x + y + 2 -  7 + 2;
+   //if (y < 2)
+   //{
+   //   return y - 33;
+   //}
+
    if (x > 13)
    {
       res = res + 2;
@@ -46,14 +52,15 @@
    #ir.dump()
    cf = transform.ConstantFolder()
    dcd = transform.DeadCodeDeleter()
+   m2r = transform.Mem2RegPromotor()
    ir.check()
    cf.run(ir)
-   cf.run(ir)
-   #dcd.run(ir)
-   ir.dump()
+   dcd.run(ir)
+   m2r.run(ir)
+   #ir.dump()
    asm = cgenx86.genBin(ir)
-   for a in asm:
-      print(a)
+   #for a in asm:
+   #   print(a)
    with open('out.asm', 'w') as f:
       f.write('BITS 64\n')
       for a in asm: