public void BuildPostIdomTree Debug Assert EndVertex null BUFVertex En

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public void BuildPostIdomTree()
{
Debug.Assert(EndVertex != null);
BUFVertex = EndVertex;
CalculateTime();
int i, j;
var G = AllVerts.ToArray();
Array.Sort(G);
var n = G.Length;
for (i = 0; i < n; i++)
{
G[i].attributes.sdom = G[i];
G[i].attributes.label = G[i];
G[i].attributes.ancestor = null;
G[i].attributes.bucket = new List<CVDescr<VProperties>>();
}
for (i = n - 1; i >= 0; i--)
{
if (G[i] == EndVertex) continue;
var iter = this.GetOutEdges(G[i]);
CEDescr<VProperties, EProperties>[] outEdges = iter.ToArray();
for (j = 0; j < outEdges.Length; j++)
{
var u = FindMin(outEdges[j].VEnd);
if (u.attributes.sdom.attributes.time < G[i].attributes.sdom.attributes.time)
{
G[i].attributes.sdom = u.attributes.sdom;
}
}
G[i].attributes.ancestor = G[i].attributes.parent;
G[i].attributes.sdom.attributes.bucket.Add(G[i]);
for (j = 0; j < G[i].attributes.parent.attributes.bucket.Count; j++)
{
var u = FindMin(G[i].attributes.parent.attributes.bucket[j]);
if (u.attributes.sdom == G[i].attributes.parent.attributes.bucket[j].attributes.sdom)
{
G[i].attributes.parent.attributes.bucket[j].ipdom = G[i].attributes.parent;
}
else
{
G[i].attributes.parent.attributes.bucket[j].ipdom = u;
}
}
G[i].attributes.parent.attributes.bucket = new List<CVDescr<VProperties>>();
}
for (i = 0; i < n; i++)
{
if (G[i] == EndVertex) continue;
if (G[i].ipdom != G[i].attributes.sdom)
{
G[i].ipdom = G[i].ipdom.ipdom;
}
}
EndVertex.ipdom = null;
}