예제 #1
0
 // ControlFlowGraph/BasicBlock
 private static void AppendProperty(this HierarchicalStringBuilder builder, string name, BasicBlock block)
 {
     using (builder.AppendSection("{0}: Ordinal={1}, Kind={2}, Condition={3}, IsReachable={4}", name, block.Ordinal, block.Kind, block.ConditionKind, block.IsReachable)) {
         builder.AppendProperty("Fall through successor", block.FallThroughSuccessor);
         builder.AppendProperty("Conditional successor", block.ConditionalSuccessor);
         builder.AppendProperty("Branch operation", block.BranchValue);
         foreach (var operation in block.Operations)
         {
             builder.AppendProperty("Operation", operation);
         }
     }
 }
예제 #2
0
        // ControlFlowGraph
        public static string GetDisplayString(ControlFlowGraph graph)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Control flow graph:")) {
                builder.AppendProperty("Original operation", graph.OriginalOperation);
                builder.AppendSeparator();
                builder.AppendProperty("Root region", graph.Root);
                builder.AppendSeparator();
                foreach (var block in graph.Blocks)
                {
                    builder.AppendProperty("Block", block);
                    builder.AppendSeparator();
                }
            }
            return(builder.ToString());
        }
예제 #3
0
 // ControlFlowGraph/ControlFlowRegion
 private static void AppendProperty(this HierarchicalStringBuilder builder, string name, ControlFlowRegion region)
 {
     using (builder.AppendSection("{0}: Kind={1}", name, region.Kind)) {
         builder.AppendLine("Capture ids: {0}", region.CaptureIds.Join());
         builder.AppendLine("Locals: {0}", region.Locals.Join());
         builder.AppendLine("Local functions: {0}", region.LocalFunctions.Join());
         foreach (var nestedRegion in region.NestedRegions)
         {
             builder.AppendProperty("Nested region", nestedRegion);
         }
     }
 }