/// <summary>
        ///
        /// </summary>
        internal static ControlAndDataFlowGraph <BasicBlock, Instruction> SetupControlFlow(IMetadataHost host, IMethodBody methodBody, ILocalScopeProvider /*?*/ localScopeProvider = null)
        {
            Contract.Requires(host != null);
            Contract.Requires(methodBody != null);
            Contract.Ensures(Contract.Result <ControlAndDataFlowGraph <BasicBlock, Instruction> >() != null);

            var inferencer = new ControlFlowInferencer <BasicBlock, Instruction>(host, methodBody, localScopeProvider);

            return(inferencer.CreateBlocksAndEdges());
        }
Example #2
0
        /// <summary>
        /// Constructs a control and data flow graph for the given method body.
        /// </summary>
        public static ControlAndDataFlowGraph <BasicBlock, Instruction> GetControlAndDataFlowGraphFor(IMetadataHost host, IMethodBody methodBody, ILocalScopeProvider /*?*/ localScopeProvider = null)
        {
            Contract.Requires(host != null);
            Contract.Requires(methodBody != null);
            Contract.Ensures(Contract.Result <ControlAndDataFlowGraph <BasicBlock, Instruction> >() != null);

            var cdfg = ControlFlowInferencer <BasicBlock, Instruction> .SetupControlFlow(host, methodBody, localScopeProvider);

            DataFlowInferencer <BasicBlock, Instruction> .SetupDataFlow(host, methodBody, cdfg);

            TypeInferencer <BasicBlock, Instruction> .FillInTypes(host, cdfg);

            return(cdfg);
        }