Mercurial > lcfOS
diff python/testc3.py @ 252:c4370696ccc7
added optimize function
author | Windel Bouwman |
---|---|
date | Tue, 30 Jul 2013 17:57:46 +0200 |
parents | 6ed3d3a82a63 |
children | 5ec7580976d9 |
line wrap: on
line diff
--- a/python/testc3.py Mon Jul 29 20:23:13 2013 +0200 +++ b/python/testc3.py Tue Jul 30 17:57:46 2013 +0200 @@ -174,11 +174,11 @@ block_code = """ a0 = alloc b1 = alloc c2 = alloc - t3 = 1 - [a0] = t3 + const3 = 1 + [a0] = const3 t4 = [a0] - t5 = 2 - mul6 = t4 * t5 + const5 = 2 + mul6 = t4 * const5 t7 = [a0] t8 = [a0] mul9 = t7 * t8 @@ -187,8 +187,8 @@ t11 = [b1] t12 = [a0] mul13 = t11 * t12 - t14 = 3 - sub15 = mul13 - t14 + const14 = 3 + sub15 = mul13 - const14 [c2] = sub15 ret """ self.expectIR(snippet, block_code) @@ -286,11 +286,11 @@ """ block_code = """a0 = alloc b1 = alloc - t2 = 2 - [a0] = t2 + const2 = 2 + [a0] = const2 t3 = [a0] - t4 = 2 - add5 = t3 + t4 + const4 = 2 + add5 = t3 + const4 [b1] = add5 ret """ self.expectIR(snippet, block_code) @@ -315,15 +315,15 @@ } """ block_code = """a0 = alloc - t1 = 2 + const1 = 2 off_x2 = 0 adr_x3 = a0 + off_x2 - [adr_x3] = t1 + [adr_x3] = const1 off_x4 = 0 adr_x5 = a0 + off_x4 t6 = [adr_x5] - t7 = 2 - add8 = t6 + t7 + const7 = 2 + add8 = t6 + const7 off_y9 = 4 adr_y10 = a0 + off_y9 [adr_y10] = add8 @@ -382,11 +382,11 @@ } """ block_code = """a0 = alloc - t1 = 40 - [a0] = t1 - t2 = 2 + const1 = 40 + [a0] = const1 + const2 = 2 deref3 = [a0] - [deref3] = t2 + [deref3] = const2 ret """ self.expectIR(snippet, block_code) @@ -403,19 +403,19 @@ } """ block_code = """a0 = alloc - t1 = 40 - [a0] = t1 - t2 = 2 + const1 = 40 + [a0] = const1 + const2 = 2 deref3 = [a0] off_x4 = 0 adr_x5 = deref3 + off_x4 - [adr_x5] = t2 + [adr_x5] = const2 deref6 = [a0] off_x7 = 0 adr_x8 = deref6 + off_x7 t9 = [adr_x8] - t10 = 14 - sub11 = t9 - t10 + const10 = 14 + sub11 = t9 - const10 deref12 = [a0] off_y13 = 4 adr_y14 = deref12 + off_y13