public static MonoCodeBlock[] CreateBlocks(MonoMethod method,
MethodAddress address,
C.CodeBlockEntry[] the_blocks,
out List<MonoCodeBlock> root_blocks)
{
MonoCodeBlock[] blocks = new MonoCodeBlock [the_blocks.Length];
for (int i = 0; i < blocks.Length; i++) {
Block.Type type = (Block.Type) the_blocks [i].BlockType;
int start = find_address (address, the_blocks [i].StartOffset);
int end = find_address (address, the_blocks [i].EndOffset);
blocks [i] = new MonoCodeBlock (i, type, start, end);
}
root_blocks = new List<MonoCodeBlock> ();
for (int i = 0; i < blocks.Length; i++) {
if (the_blocks [i].Parent < 0)
root_blocks.Add (blocks [i]);
else {
MonoCodeBlock parent = blocks [the_blocks [i].Parent - 1];
blocks [i].Parent = parent;
parent.AddChildBlock (blocks [i]);
}
}
return blocks;
}