diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-02-14 16:32:54 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-03-13 13:56:26 +0100 |
| commit | b9c87b0e9167940fbbadf0f642e07ee9d7a678e5 (patch) | |
| tree | 44af3f4626074209c650e2efee9e003e11346422 /test/analysis/depgraph.py | |
| parent | d8cbc059655bd275b5e178b2339b931d9f0b126a (diff) | |
| download | miasm-b9c87b0e9167940fbbadf0f642e07ee9d7a678e5.tar.gz miasm-b9c87b0e9167940fbbadf0f642e07ee9d7a678e5.zip | |
IR/ir: rename irbloc to IRBlock
Diffstat (limited to 'test/analysis/depgraph.py')
| -rw-r--r-- | test/analysis/depgraph.py | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/test/analysis/depgraph.py b/test/analysis/depgraph.py index 0b8d97b6..e0407fdb 100644 --- a/test/analysis/depgraph.py +++ b/test/analysis/depgraph.py @@ -3,7 +3,7 @@ from miasm2.expression.expression import ExprId, ExprInt32, ExprAff, ExprCond, \ ExprInt from miasm2.core.asmbloc import asm_label from miasm2.ir.analysis import ira -from miasm2.ir.ir import ir, irbloc, AssignBlock +from miasm2.ir.ir import ir, IRBlock, AssignBlock from miasm2.core.graph import DiGraph from miasm2.analysis.depgraph import DependencyNode, DependencyGraph from itertools import count @@ -50,7 +50,7 @@ LBL4 = asm_label("lbl4") LBL5 = asm_label("lbl5") LBL6 = asm_label("lbl6") -def gen_irbloc(label, exprs_list): +def gen_irblock(label, exprs_list): """ Returns an IRBlock with empty lines. Used only for tests purpose """ @@ -62,7 +62,7 @@ def gen_irbloc(label, exprs_list): else: irs.append(AssignBlock(exprs)) - irbl = irbloc(label, irs, lines) + irbl = IRBlock(label, irs, lines) return irbl @@ -232,9 +232,9 @@ DNC3 = DependencyNode(LBL1, C, 0) G1_IRA = IRATest() -G1_IRB0 = gen_irbloc(LBL0, [[ExprAff(C, CST1)]]) -G1_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, C)]]) -G1_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, B)]]) +G1_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) +G1_IRB1 = gen_irblock(LBL1, [[ExprAff(B, C)]]) +G1_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) G1_IRA.graph.add_uniq_edge(G1_IRB0.label, G1_IRB1.label) G1_IRA.graph.add_uniq_edge(G1_IRB1.label, G1_IRB2.label) @@ -245,9 +245,9 @@ G1_IRA.blocs = dict([(irb.label, irb) for irb in [G1_IRB0, G1_IRB1, G1_IRB2]]) G2_IRA = IRATest() -G2_IRB0 = gen_irbloc(LBL0, [[ExprAff(C, CST1)]]) -G2_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, CST2)]]) -G2_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, B + C)]]) +G2_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) +G2_IRB1 = gen_irblock(LBL1, [[ExprAff(B, CST2)]]) +G2_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B + C)]]) G2_IRA.graph.add_uniq_edge(G2_IRB0.label, G2_IRB1.label) G2_IRA.graph.add_uniq_edge(G2_IRB1.label, G2_IRB2.label) @@ -259,10 +259,10 @@ G2_IRA.blocs = dict([(irb.label, irb) for irb in [G2_IRB0, G2_IRB1, G2_IRB2]]) G3_IRA = IRATest() -G3_IRB0 = gen_irbloc(LBL0, [[ExprAff(C, CST1)]]) -G3_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, CST2)]]) -G3_IRB2 = gen_irbloc(LBL2, [[ExprAff(B, CST3)]]) -G3_IRB3 = gen_irbloc(LBL3, [[ExprAff(A, B + C)]]) +G3_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) +G3_IRB1 = gen_irblock(LBL1, [[ExprAff(B, CST2)]]) +G3_IRB2 = gen_irblock(LBL2, [[ExprAff(B, CST3)]]) +G3_IRB3 = gen_irblock(LBL3, [[ExprAff(A, B + C)]]) G3_IRA.graph.add_uniq_edge(G3_IRB0.label, G3_IRB1.label) G3_IRA.graph.add_uniq_edge(G3_IRB0.label, G3_IRB2.label) @@ -276,13 +276,13 @@ G3_IRA.blocs = dict([(irb.label, irb) for irb in [G3_IRB0, G3_IRB1, G4_IRA = IRATest() -G4_IRB0 = gen_irbloc(LBL0, [[ExprAff(C, CST1)]]) -G4_IRB1 = gen_irbloc(LBL1, [[ExprAff(C, C + CST2)], - [ExprAff(G4_IRA.IRDst, - ExprCond(C, ExprId(LBL2), - ExprId(LBL1)))]]) +G4_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) +G4_IRB1 = gen_irblock(LBL1, [[ExprAff(C, C + CST2)], + [ExprAff(G4_IRA.IRDst, + ExprCond(C, ExprId(LBL2), + ExprId(LBL1)))]]) -G4_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, B)]]) +G4_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) G4_IRA.graph.add_uniq_edge(G4_IRB0.label, G4_IRB1.label) G4_IRA.graph.add_uniq_edge(G4_IRB1.label, G4_IRB2.label) @@ -295,13 +295,13 @@ G4_IRA.blocs = dict([(irb.label, irb) for irb in [G4_IRB0, G4_IRB1, G4_IRB2]]) G5_IRA = IRATest() -G5_IRB0 = gen_irbloc(LBL0, [[ExprAff(B, CST1)]]) -G5_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, B + CST2)], - [ExprAff(G5_IRA.IRDst, - ExprCond(B, ExprId(LBL2), - ExprId(LBL1)))]]) +G5_IRB0 = gen_irblock(LBL0, [[ExprAff(B, CST1)]]) +G5_IRB1 = gen_irblock(LBL1, [[ExprAff(B, B + CST2)], + [ExprAff(G5_IRA.IRDst, + ExprCond(B, ExprId(LBL2), + ExprId(LBL1)))]]) -G5_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, B)]]) +G5_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) G5_IRA.graph.add_uniq_edge(G5_IRB0.label, G5_IRB1.label) G5_IRA.graph.add_uniq_edge(G5_IRB1.label, G5_IRB2.label) @@ -313,8 +313,8 @@ G5_IRA.blocs = dict([(irb.label, irb) for irb in [G5_IRB0, G5_IRB1, G5_IRB2]]) G6_IRA = IRATest() -G6_IRB0 = gen_irbloc(LBL0, [[ExprAff(B, CST1)]]) -G6_IRB1 = gen_irbloc(LBL1, [[ExprAff(A, B)]]) +G6_IRB0 = gen_irblock(LBL0, [[ExprAff(B, CST1)]]) +G6_IRB1 = gen_irblock(LBL1, [[ExprAff(A, B)]]) G6_IRA.graph.add_uniq_edge(G6_IRB0.label, G6_IRB1.label) G6_IRA.graph.add_uniq_edge(G6_IRB1.label, G6_IRB1.label) @@ -325,9 +325,9 @@ G6_IRA.blocs = dict([(irb.label, irb) for irb in [G6_IRB0, G6_IRB1]]) G7_IRA = IRATest() -G7_IRB0 = gen_irbloc(LBL0, [[ExprAff(C, CST1)]]) -G7_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, C)], [ExprAff(A, B)]]) -G7_IRB2 = gen_irbloc(LBL2, [[ExprAff(D, A)]]) +G7_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) +G7_IRB1 = gen_irblock(LBL1, [[ExprAff(B, C)], [ExprAff(A, B)]]) +G7_IRB2 = gen_irblock(LBL2, [[ExprAff(D, A)]]) G7_IRA.graph.add_uniq_edge(G7_IRB0.label, G7_IRB1.label) G7_IRA.graph.add_uniq_edge(G7_IRB1.label, G7_IRB1.label) @@ -339,9 +339,9 @@ G7_IRA.blocs = dict([(irb.label, irb) for irb in [G7_IRB0, G7_IRB1, G7_IRB2]]) G8_IRA = IRATest() -G8_IRB0 = gen_irbloc(LBL0, [[ExprAff(C, CST1)]]) -G8_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, C)], [ExprAff(C, D)]]) -G8_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, B)]]) +G8_IRB0 = gen_irblock(LBL0, [[ExprAff(C, CST1)]]) +G8_IRB1 = gen_irblock(LBL1, [[ExprAff(B, C)], [ExprAff(C, D)]]) +G8_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) G8_IRA.graph.add_uniq_edge(G8_IRB0.label, G8_IRB1.label) G8_IRA.graph.add_uniq_edge(G8_IRB1.label, G8_IRB1.label) @@ -355,8 +355,8 @@ G8_IRA.blocs = dict([(irb.label, irb) for irb in [G8_IRB0, G8_IRB1, G8_IRB2]]) G10_IRA = IRATest() -G10_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, B + CST2)]]) -G10_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, B)]]) +G10_IRB1 = gen_irblock(LBL1, [[ExprAff(B, B + CST2)]]) +G10_IRB2 = gen_irblock(LBL2, [[ExprAff(A, B)]]) G10_IRA.graph.add_uniq_edge(G10_IRB1.label, G10_IRB2.label) G10_IRA.graph.add_uniq_edge(G10_IRB1.label, G10_IRB1.label) @@ -367,11 +367,11 @@ G10_IRA.blocs = dict([(irb.label, irb) for irb in [G10_IRB1, G10_IRB2]]) G11_IRA = IRATest() -G11_IRB0 = gen_irbloc(LBL0, [[ExprAff(A, CST1), - ExprAff(B, CST2)]]) -G11_IRB1 = gen_irbloc(LBL1, [[ExprAff(A, B), - ExprAff(B, A)]]) -G11_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, A - B)]]) +G11_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1), + ExprAff(B, CST2)]]) +G11_IRB1 = gen_irblock(LBL1, [[ExprAff(A, B), + ExprAff(B, A)]]) +G11_IRB2 = gen_irblock(LBL2, [[ExprAff(A, A - B)]]) G11_IRA.graph.add_uniq_edge(G11_IRB0.label, G11_IRB1.label) G11_IRA.graph.add_uniq_edge(G11_IRB1.label, G11_IRB2.label) @@ -383,9 +383,9 @@ G11_IRA.blocs = dict([(irb.label, irb) G12_IRA = IRATest() -G12_IRB0 = gen_irbloc(LBL0, [[ExprAff(B, CST1)]]) -G12_IRB1 = gen_irbloc(LBL1, [[ExprAff(A, B)], [ExprAff(B, B + CST2)]]) -G12_IRB2 = gen_irbloc(LBL2, [[ExprAff(B, A)]]) +G12_IRB0 = gen_irblock(LBL0, [[ExprAff(B, CST1)]]) +G12_IRB1 = gen_irblock(LBL1, [[ExprAff(A, B)], [ExprAff(B, B + CST2)]]) +G12_IRB2 = gen_irblock(LBL2, [[ExprAff(B, A)]]) G12_IRA.graph.add_uniq_edge(G12_IRB0.label, G12_IRB1.label) G12_IRA.graph.add_uniq_edge(G12_IRB1.label, G12_IRB2.label) @@ -399,21 +399,21 @@ G12_IRA.blocs = dict([(irb.label, irb) for irb in [G12_IRB0, G12_IRB1, G13_IRA = IRATest() -G13_IRB0 = gen_irbloc(LBL0, [[ExprAff(A, CST1)], - #[ExprAff(B, A)], - [ExprAff(G13_IRA.IRDst, - ExprId(LBL1))]]) -G13_IRB1 = gen_irbloc(LBL1, [[ExprAff(C, A)], - #[ExprAff(A, A + CST1)], - [ExprAff(G13_IRA.IRDst, - ExprCond(R, ExprId(LBL2), - ExprId(LBL1)))]]) +G13_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)], + #[ExprAff(B, A)], + [ExprAff(G13_IRA.IRDst, + ExprId(LBL1))]]) +G13_IRB1 = gen_irblock(LBL1, [[ExprAff(C, A)], + #[ExprAff(A, A + CST1)], + [ExprAff(G13_IRA.IRDst, + ExprCond(R, ExprId(LBL2), + ExprId(LBL1)))]]) -G13_IRB2 = gen_irbloc(LBL2, [[ExprAff(B, A + CST3)], [ExprAff(A, B + CST3)], - [ExprAff(G13_IRA.IRDst, - ExprId(LBL1))]]) +G13_IRB2 = gen_irblock(LBL2, [[ExprAff(B, A + CST3)], [ExprAff(A, B + CST3)], + [ExprAff(G13_IRA.IRDst, + ExprId(LBL1))]]) -G13_IRB3 = gen_irbloc(LBL3, [[ExprAff(R, C)]]) +G13_IRB3 = gen_irblock(LBL3, [[ExprAff(R, C)]]) G13_IRA.graph.add_uniq_edge(G13_IRB0.label, G13_IRB1.label) G13_IRA.graph.add_uniq_edge(G13_IRB1.label, G13_IRB2.label) @@ -427,23 +427,23 @@ G13_IRA.blocs = dict([(irb.label, irb) for irb in [G13_IRB0, G13_IRB1, G14_IRA = IRATest() -G14_IRB0 = gen_irbloc(LBL0, [[ExprAff(A, CST1)], - [ExprAff(G14_IRA.IRDst, - ExprId(LBL1))] +G14_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)], + [ExprAff(G14_IRA.IRDst, + ExprId(LBL1))] ]) -G14_IRB1 = gen_irbloc(LBL1, [[ExprAff(B, A)], - [ExprAff(G14_IRA.IRDst, - ExprCond(C, ExprId(LBL2), - ExprId(LBL3)))] +G14_IRB1 = gen_irblock(LBL1, [[ExprAff(B, A)], + [ExprAff(G14_IRA.IRDst, + ExprCond(C, ExprId(LBL2), + ExprId(LBL3)))] ]) -G14_IRB2 = gen_irbloc(LBL2, [[ExprAff(D, A)], - [ExprAff(A, D + CST1)], - [ExprAff(G14_IRA.IRDst, - ExprId(LBL1))] +G14_IRB2 = gen_irblock(LBL2, [[ExprAff(D, A)], + [ExprAff(A, D + CST1)], + [ExprAff(G14_IRA.IRDst, + ExprId(LBL1))] ]) -G14_IRB3 = gen_irbloc(LBL3, [[ExprAff(R, D + B)]]) +G14_IRB3 = gen_irblock(LBL3, [[ExprAff(R, D + B)]]) G14_IRA.graph.add_uniq_edge(G14_IRB0.label, G14_IRB1.label) G14_IRA.graph.add_uniq_edge(G14_IRB1.label, G14_IRB2.label) @@ -457,11 +457,11 @@ G14_IRA.blocs = dict([(irb.label, irb) for irb in [G14_IRB0, G14_IRB1, G15_IRA = IRATest() -G15_IRB0 = gen_irbloc(LBL0, [[ExprAff(A, CST1)]]) -G15_IRB1 = gen_irbloc(LBL1, [[ExprAff(D, A + B)], - [ExprAff(C, D)], - [ExprAff(B, C)]]) -G15_IRB2 = gen_irbloc(LBL2, [[ExprAff(R, B)]]) +G15_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)]]) +G15_IRB1 = gen_irblock(LBL1, [[ExprAff(D, A + B)], + [ExprAff(C, D)], + [ExprAff(B, C)]]) +G15_IRB2 = gen_irblock(LBL2, [[ExprAff(R, B)]]) G15_IRA.graph.add_uniq_edge(G15_IRB0.label, G15_IRB1.label) G15_IRA.graph.add_uniq_edge(G15_IRB1.label, G15_IRB2.label) @@ -474,12 +474,12 @@ G15_IRA.blocs = dict([(irb.label, irb) for irb in [G15_IRB0, G15_IRB1, G16_IRA = IRATest() -G16_IRB0 = gen_irbloc(LBL0, [[ExprAff(A, CST1)]]) -G16_IRB1 = gen_irbloc(LBL1, [[ExprAff(R, D)]]) -G16_IRB2 = gen_irbloc(LBL2, [[ExprAff(D, A)]]) -G16_IRB3 = gen_irbloc(LBL3, [[ExprAff(R, D)]]) -G16_IRB4 = gen_irbloc(LBL4, [[ExprAff(R, A)]]) -G16_IRB5 = gen_irbloc(LBL5, [[ExprAff(R, A)]]) +G16_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1)]]) +G16_IRB1 = gen_irblock(LBL1, [[ExprAff(R, D)]]) +G16_IRB2 = gen_irblock(LBL2, [[ExprAff(D, A)]]) +G16_IRB3 = gen_irblock(LBL3, [[ExprAff(R, D)]]) +G16_IRB4 = gen_irblock(LBL4, [[ExprAff(R, A)]]) +G16_IRB5 = gen_irblock(LBL5, [[ExprAff(R, A)]]) G16_IRA.graph.add_uniq_edge(G16_IRB0.label, G16_IRB1.label) G16_IRA.graph.add_uniq_edge(G16_IRB1.label, G16_IRB2.label) @@ -498,11 +498,11 @@ G16_IRA.blocs = dict([(irb.label, irb) for irb in [G16_IRB0, G16_IRB1, G17_IRA = IRATest() -G17_IRB0 = gen_irbloc(LBL0, [[ExprAff(A, CST1), - ExprAff(D, CST2)]]) -G17_IRB1 = gen_irbloc(LBL1, [[ExprAff(A, D), - ExprAff(B, D)]]) -G17_IRB2 = gen_irbloc(LBL2, [[ExprAff(A, A - B)]]) +G17_IRB0 = gen_irblock(LBL0, [[ExprAff(A, CST1), + ExprAff(D, CST2)]]) +G17_IRB1 = gen_irblock(LBL1, [[ExprAff(A, D), + ExprAff(B, D)]]) +G17_IRB2 = gen_irblock(LBL2, [[ExprAff(A, A - B)]]) G17_IRA.graph.add_uniq_edge(G17_IRB0.label, G17_IRB1.label) G17_IRA.graph.add_uniq_edge(G17_IRB1.label, G17_IRB2.label) |