|
| loc_db = LocationDB() |
|
| a = ExprId("a", 32) |
|
| b = ExprId("b", 32) |
|
| c = ExprId("c", 32) |
|
| d = ExprId("d", 32) |
|
| r = ExprId("r", 32) |
|
| a_init = ExprId("a_init", 32) |
|
| b_init = ExprId("b_init", 32) |
|
| c_init = ExprId("c_init", 32) |
|
| d_init = ExprId("d_init", 32) |
|
| r_init = ExprId("r_init", 32) |
|
| pc = ExprId("pc", 32) |
|
| sp = ExprId("sp", 32) |
|
| CST1 = ExprInt(0x11, 32) |
|
| CST2 = ExprInt(0x12, 32) |
|
| CST3 = ExprInt(0x13, 32) |
|
| LBL0 = loc_db.add_location("lbl0", 0) |
|
| LBL1 = loc_db.add_location("lbl1", 1) |
|
| LBL2 = loc_db.add_location("lbl2", 2) |
|
| LBL3 = loc_db.add_location("lbl3", 3) |
|
| LBL4 = loc_db.add_location("lbl4", 4) |
|
| LBL5 = loc_db.add_location("lbl5", 5) |
|
| LBL6 = loc_db.add_location("lbl6", 6) |
|
| IRDst = ExprId('IRDst', 32) |
|
| dummy = ExprId('dummy', 32) |
|
| IRA = IRATest(loc_db) |
|
| deadrm = DeadRemoval(IRA) |
|
| G1_IRA = IRA.new_ircfg() |
|
def | G1_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(b, CST2)]]) |
|
def | G1_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, b)]]) |
|
def | G1_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)]]) |
|
| G1_EXP_IRA = IRA.new_ircfg() |
|
def | G1_EXP_IRB0 = gen_irblock(LBL0, [[], [ExprAssign(b, CST2)]]) |
|
def | G1_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, b)]]) |
|
def | G1_EXP_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)]]) |
|
| G2_IRA = IRA.new_ircfg() |
|
def | G2_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(r, CST1)]]) |
|
def | G2_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)]]) |
|
def | G2_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, r)]]) |
|
| G2_EXP_IRA = IRA.new_ircfg() |
|
def | G2_EXP_IRB0 = gen_irblock(LBL0, [[], [ExprAssign(r, CST1)]]) |
|
def | G2_EXP_IRB1 = gen_irblock(LBL1, [[]]) |
|
def | G2_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
| G3_IRA = IRA.new_ircfg() |
|
def | G3_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)]]) |
|
def | G3_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)]]) |
|
def | G3_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)]]) |
|
| G3_EXP_IRA = IRA.new_ircfg() |
|
def | G3_EXP_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)]]) |
|
def | G3_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)]]) |
|
def | G3_EXP_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)]]) |
|
| G4_IRA = IRA.new_ircfg() |
|
def | G4_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)]]) |
|
def | G4_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)]]) |
|
def | G4_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, a+CST2)]]) |
|
def | G4_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, CST3)], [ExprAssign(r, a)]]) |
|
| G4_EXP_IRA = IRA.new_ircfg() |
|
def | G4_EXP_IRB0 = gen_irblock(LBL0, [[]]) |
|
def | G4_EXP_IRB1 = gen_irblock(LBL1, [[]]) |
|
def | G4_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
def | G4_EXP_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, CST3)], [ExprAssign(r, a)]]) |
|
| G5_IRA = IRA.new_ircfg() |
|
def | G5_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)]]) |
|
def | G5_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, CST2)]]) |
|
def | G5_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, a+CST2)]]) |
|
def | G5_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, a+CST3)]]) |
|
def | G5_IRB4 = gen_irblock(LBL4, [[ExprAssign(a, a+CST1)]]) |
|
def | G5_IRB5 = gen_irblock(LBL5, [[ExprAssign(a, r)]]) |
|
| G5_EXP_IRA = IRA.new_ircfg() |
|
def | G5_EXP_IRB0 = gen_irblock(LBL0, [[]]) |
|
def | G5_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, CST2)]]) |
|
def | G5_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
def | G5_EXP_IRB3 = gen_irblock(LBL3, [[]]) |
|
def | G5_EXP_IRB4 = gen_irblock(LBL4, [[]]) |
|
def | G5_EXP_IRB5 = gen_irblock(LBL5, [[]]) |
|
| G6_IRA = IRA.new_ircfg() |
|
def | G6_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)]]) |
|
def | G6_IRB1 = gen_irblock(LBL1, [[ExprAssign(b, a)]]) |
|
def | G6_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, b)]]) |
|
def | G6_IRB3 = gen_irblock(LBL3, [[ExprAssign(r, CST2)]]) |
|
| G6_EXP_IRA = IRA.new_ircfg() |
|
def | G6_EXP_IRB0 = gen_irblock(LBL0, [[]]) |
|
def | G6_EXP_IRB1 = gen_irblock(LBL1, [[]]) |
|
def | G6_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
def | G6_EXP_IRB3 = gen_irblock(LBL3, [[ExprAssign(r, CST2)]]) |
|
| G7_IRA = IRA.new_ircfg() |
|
def | G7_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(r, CST1)]]) |
|
def | G7_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)]]) |
|
def | G7_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, a+CST2)]]) |
|
def | G7_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, r)]]) |
|
| G7_EXP_IRA = IRA.new_ircfg() |
|
def | G7_EXP_IRB0 = gen_irblock(LBL0, [[], [ExprAssign(r, CST1)]]) |
|
def | G7_EXP_IRB1 = gen_irblock(LBL1, [[]]) |
|
def | G7_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
def | G7_EXP_IRB3 = gen_irblock(LBL3, [[]]) |
|
| G8_IRA = IRA.new_ircfg() |
|
def | G8_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(b, CST1)]]) |
|
def | G8_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)]]) |
|
def | G8_IRB2 = gen_irblock(LBL2, [[ExprAssign(b, b+CST2)]]) |
|
def | G8_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, b)]]) |
|
| G8_EXP_IRA = IRA.new_ircfg() |
|
def | G8_EXP_IRB0 = gen_irblock(LBL0, [[], []]) |
|
def | G8_EXP_IRB1 = gen_irblock(LBL1, [[]]) |
|
def | G8_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
def | G8_EXP_IRB3 = gen_irblock(LBL3, [[]]) |
|
| G9_IRA = IRA.new_ircfg() |
|
def | G9_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(b, CST1)]]) |
|
def | G9_IRB1 = gen_irblock(LBL1, [[ExprAssign(a, a+CST1)], [ExprAssign(b, b+CST1)]]) |
|
def | G9_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, a+CST2)], [ExprAssign(b, b+CST2)]]) |
|
def | G9_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, b)]]) |
|
def | G9_IRB4 = gen_irblock(LBL4, [[ExprAssign(r, a)], [ExprAssign(r, b)]]) |
|
| G9_EXP_IRA = IRA.new_ircfg() |
|
def | G9_EXP_IRB0 = gen_irblock(LBL0, [[], [ExprAssign(b, CST1)]]) |
|
def | G9_EXP_IRB1 = gen_irblock(LBL1, [[], [ExprAssign(b, b+CST1)]]) |
|
def | G9_EXP_IRB2 = gen_irblock(LBL2, [[], [ExprAssign(b, b+CST2)]]) |
|
def | G9_EXP_IRB3 = gen_irblock(LBL3, [[]]) |
|
def | G9_EXP_IRB4 = gen_irblock(LBL4, [[], [ExprAssign(r, b)]]) |
|
| G10_IRA = IRA.new_ircfg() |
|
def | G10_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)]]) |
|
def | G10_IRB1 = gen_irblock(LBL1, [[ExprAssign(b, a)]]) |
|
def | G10_IRB2 = gen_irblock(LBL2, [[ExprAssign(a, b)]]) |
|
def | G10_IRB3 = gen_irblock(LBL3, [[ExprAssign(r, CST1)]]) |
|
| G10_EXP_IRA = IRA.new_ircfg() |
|
def | G10_EXP_IRB0 = gen_irblock(LBL0, [[]]) |
|
def | G10_EXP_IRB1 = gen_irblock(LBL1, [[]]) |
|
def | G10_EXP_IRB2 = gen_irblock(LBL2, [[]]) |
|
def | G10_EXP_IRB3 = gen_irblock(LBL3, [[ExprAssign(r, CST1)]]) |
|
| G11_IRA = IRA.new_ircfg() |
|
def | G11_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, b)]]) |
|
def | G11_IRB1 = gen_irblock(LBL1, [[ExprAssign(b, a)]]) |
|
def | G11_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)]]) |
|
def | G11_IRB3 = gen_irblock(LBL3, [[ExprAssign(a, a+CST1)]]) |
|
def | G11_IRB4 = gen_irblock(LBL4, [[ExprAssign(b, b+CST1)]]) |
|
| G11_EXP_IRA = IRA.new_ircfg() |
|
def | G11_EXP_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, b)]]) |
|
def | G11_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(b, a)]]) |
|
def | G11_EXP_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)]]) |
|
| G12_IRA = IRA.new_ircfg() |
|
def | G12_IRB0 = gen_irblock(LBL0, [[ExprAssign(r, CST1)], [ExprAssign(a, CST2)]]) |
|
def | G12_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, CST2)]]) |
|
def | G12_IRB2 = gen_irblock(LBL2, [[ExprAssign(r, a)], [ExprAssign(b, CST3)]]) |
|
def | G12_IRB3 = gen_irblock(LBL3, [[ExprAssign(r, CST3)]]) |
|
def | G12_IRB4 = gen_irblock(LBL4, [[ExprAssign(r, CST2)]]) |
|
def | G12_IRB5 = gen_irblock(LBL5, [[ExprAssign(r, b)]]) |
|
| G12_EXP_IRA = IRA.new_ircfg() |
|
def | G12_EXP_IRB0 = gen_irblock(LBL0, [[], []]) |
|
def | G12_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, CST2)]]) |
|
def | G12_EXP_IRB2 = gen_irblock(LBL2, [[], [ExprAssign(b, CST3)]]) |
|
def | G12_EXP_IRB3 = gen_irblock(LBL3, [[ExprAssign(r, CST3)]]) |
|
def | G12_EXP_IRB4 = gen_irblock(LBL4, [[]]) |
|
def | G12_EXP_IRB5 = gen_irblock(LBL5, [[ExprAssign(r, b)]]) |
|
| G13_IRA = IRA.new_ircfg() |
|
def | G13_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(b, CST2)]]) |
|
def | G13_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, b)]]) |
|
def | G13_IRB2 |
|
def | G13_IRB3 = gen_irblock(LBL3, [[]]) |
|
def | G13_IRB4 = gen_irblock(LBL4, [[ExprAssign(b, CST2)]]) |
|
| G13_EXP_IRA = IRA.new_ircfg() |
|
def | G13_EXP_IRB0 = gen_irblock(LBL0, [[ExprAssign(a, CST1)], [ExprAssign(b, CST2)]]) |
|
def | G13_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, b)]]) |
|
def | G13_EXP_IRB2 |
|
def | G13_EXP_IRB3 = gen_irblock(LBL3, [[]]) |
|
def | G13_EXP_IRB4 = gen_irblock(LBL4, [[ExprAssign(b, CST2)]]) |
|
| G14_IRA = IRA.new_ircfg() |
|
def | G14_IRB0 |
|
def | G14_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, a+c)]]) |
|
| G14_EXP_IRA = IRA.new_ircfg() |
|
def | G14_EXP_IRB0 |
|
def | G14_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, a+c)]]) |
|
| G15_IRA = IRA.new_ircfg() |
|
def | G15_IRB0 |
|
def | G15_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, a)]]) |
|
| G15_EXP_IRA = IRA.new_ircfg() |
|
def | G15_EXP_IRB0 = gen_irblock(LBL0, [[], [ExprAssign(a, CST1)]]) |
|
def | G15_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, a)]]) |
|
| G16_IRA = IRA.new_ircfg() |
|
def | G16_IRB0 |
|
def | G16_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, a+b)], [ExprAssign(r, c+r)]]) |
|
def | G16_IRB2 = gen_irblock(LBL2, [[]]) |
|
| G16_EXP_IRA = IRA.new_ircfg() |
|
def | G16_EXP_IRB0 |
|
def | G16_EXP_IRB1 = gen_irblock(LBL1, [[ExprAssign(r, a+b)], [ExprAssign(r, c+r)]]) |
|
| G17_IRA = IRA.new_ircfg() |
|
def | G17_IRB0 |
|
| G17_EXP_IRA = IRA.new_ircfg() |
|
def | G17_EXP_IRB0 |
|
| g_ira |
|
| g_exp_ira |
|
| reaching_defs = ReachingDefinitions(g_ira) |
|
| defuse = DiGraphDefUse(reaching_defs, deref_mem=True) |
|
| exp_irb = g_exp_ira.blocks[lbl] |
|
Test cases for dead code elimination