diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-07-31 23:51:41 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-08-01 00:00:45 +0200 |
| commit | 92e55ff555ea3705dfa03b62a72c22dded722389 (patch) | |
| tree | 7775e4912804783918f955fbe787ba44da0d87f8 /test/ir/reduce_graph.py | |
| parent | 7acc9f00489f0f9444b8fa2e5068317c0de90f38 (diff) | |
| download | miasm-92e55ff555ea3705dfa03b62a72c22dded722389.tar.gz miasm-92e55ff555ea3705dfa03b62a72c22dded722389.zip | |
Test: add reduce graph test (infinite loop)
Diffstat (limited to 'test/ir/reduce_graph.py')
| -rw-r--r-- | test/ir/reduce_graph.py | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/test/ir/reduce_graph.py b/test/ir/reduce_graph.py index d8b78c90..03674600 100644 --- a/test/ir/reduce_graph.py +++ b/test/ir/reduce_graph.py @@ -507,6 +507,66 @@ for irb in [G6_RES_IRB0, G6_RES_IRB2, G6_RES_IRB3 ]: + +########## G7 ########## +# Input + +G7 = IRA.new_ircfg() + +G7_IRB0 = gen_irblock( + LBL0, + [ + [ + ExprAff(A, C), + ExprAff(IRDst, ExprLoc(LBL1, 32)), + ] + ] +) + +G7_IRB1 = gen_irblock( + LBL1, + [ + [ + ExprAff(IRDst, ExprLoc(LBL1, 32)), + ] + ] +) + + +for irb in [G7_IRB0, G7_IRB1]: + G7.add_irblock(irb) + + +# Result +G7_RES = IRA.new_ircfg() + + + +G7_RES_IRB0 = gen_irblock( + LBL0, + [ + [ + ExprAff(A, C), + ExprAff(IRDst, ExprLoc(LBL1, 32)), + ] + ] +) + +G7_RES_IRB1 = gen_irblock( + LBL1, + [ + [ + ExprAff(IRDst, ExprLoc(LBL1, 32)), + ] + ] +) + + +for irb in [G7_RES_IRB0, G7_RES_IRB1]: + G7_RES.add_irblock(irb) + + + ################# Tests @@ -518,14 +578,15 @@ for i, (g_test, g_ref) in enumerate( (G4, G4_RES), (G5, G5_RES), (G6, G6_RES), + (G7, G7_RES), ], 1): heads = g_test.heads() print '*'*10, 'Test', i, "*"*10 open('test_in_%d.dot' % i, 'w').write(g_test.dot()) + open('test_ref_%d.dot' % i, 'w').write(g_ref.dot()) merge_blocks(g_test, heads) open('test_out_%d.dot' % i, 'w').write(g_test.dot()) - open('test_ref_%d.dot' % i, 'w').write(g_ref.dot()) cmp_ir_graph(g_test, g_ref) print '\t', 'OK' |