2022-04-05 23:19:23 +02:00
|
|
|
--TEST--
|
|
|
|
020: Translation out of SSA (Figure 1 from "Translating Out of Static Single Assignment Form" by Sreedhar)
|
|
|
|
--ARGS--
|
|
|
|
--save --dump-live-ranges --dump-cfg
|
|
|
|
--CODE--
|
|
|
|
{
|
|
|
|
uintptr_t c_1 = 0;
|
|
|
|
bool c_2 = 0;
|
|
|
|
bool c_3 = 1;
|
|
|
|
l_1 = START(l_12);
|
|
|
|
int32_t d_2 = PARAM(l_1, "a", 0);
|
|
|
|
int32_t d_3 = PARAM(l_1, "b", 1);
|
|
|
|
bool d_4 = PARAM(l_1, "cond", 2);
|
|
|
|
l_5 = IF(l_1, d_4);
|
|
|
|
l_6 = IF_TRUE(l_5);
|
|
|
|
l_7 = END(l_6);
|
|
|
|
l_8 = IF_FALSE(l_5);
|
|
|
|
l_9 = END(l_8);
|
|
|
|
l_10 = MERGE(l_7, l_9);
|
|
|
|
int32_t d_11 = PHI(l_10, d_3, d_2);
|
|
|
|
l_12 = RETURN(l_10, d_11);
|
|
|
|
}
|
|
|
|
--EXPECT--
|
|
|
|
{
|
|
|
|
uintptr_t c_1 = 0;
|
|
|
|
bool c_2 = 0;
|
|
|
|
bool c_3 = 1;
|
|
|
|
l_1 = START(l_12);
|
|
|
|
int32_t d_2 = PARAM(l_1, "a", 0);
|
|
|
|
int32_t d_3 = PARAM(l_1, "b", 1);
|
|
|
|
bool d_4 = PARAM(l_1, "cond", 2);
|
|
|
|
l_5 = IF(l_1, d_4);
|
|
|
|
l_6 = IF_TRUE(l_5);
|
|
|
|
l_7 = END(l_6);
|
|
|
|
l_8 = IF_FALSE(l_5);
|
|
|
|
l_9 = END(l_8);
|
|
|
|
l_10 = MERGE(l_7, l_9);
|
|
|
|
int32_t d_11 = PHI(l_10, d_3, d_2);
|
|
|
|
l_12 = RETURN(l_10, d_11);
|
|
|
|
}
|
|
|
|
{ # CFG
|
|
|
|
BB1:
|
|
|
|
start=1
|
|
|
|
end=5
|
2022-08-30 22:15:20 +02:00
|
|
|
successors(2) [BB2, BB4]
|
2022-04-05 23:19:23 +02:00
|
|
|
dom_depth=0
|
2022-08-30 22:15:20 +02:00
|
|
|
dom_children [BB2, BB4, BB3]
|
2022-04-05 23:19:23 +02:00
|
|
|
BB2:
|
|
|
|
start=6
|
|
|
|
end=7
|
2022-08-30 22:15:20 +02:00
|
|
|
successors(1) [BB3]
|
2022-04-05 23:19:23 +02:00
|
|
|
predecessors(1) [BB1]
|
|
|
|
dom_parent=BB1
|
|
|
|
dom_depth=1
|
|
|
|
mov R2 -> R1
|
|
|
|
BB3:
|
2022-08-30 22:15:20 +02:00
|
|
|
start=10
|
|
|
|
end=12
|
|
|
|
predecessors(2) [BB2, BB4]
|
2022-04-05 23:19:23 +02:00
|
|
|
dom_parent=BB1
|
|
|
|
dom_depth=1
|
|
|
|
BB4:
|
2022-08-30 22:15:20 +02:00
|
|
|
start=8
|
|
|
|
end=9
|
|
|
|
successors(1) [BB3]
|
|
|
|
predecessors(1) [BB1]
|
2022-04-05 23:19:23 +02:00
|
|
|
dom_parent=BB1
|
|
|
|
dom_depth=1
|
|
|
|
}
|
|
|
|
{ # LIVE-RANGES (vregs_count=3)
|
2022-05-12 23:32:37 +02:00
|
|
|
R1 (d_2, d_11): [2.2-6.0), [8.0-12.1), DEF(2.2), PHI_USE(9.2, phi=d_11/3), DEF(11.2), USE(12.1/2)
|
|
|
|
R2 (d_3): [3.2-8.0), DEF(3.2), PHI_USE(7.2, phi=d_11/2)
|
2022-04-20 17:53:15 +02:00
|
|
|
R3 (d_4): [4.2-5.1), DEF(4.2), USE(5.1/2)
|
2022-04-05 23:19:23 +02:00
|
|
|
}
|