Esempio n. 1
0
            public override BasicBlockAnalysisData AnalyzeBlock(BasicBlock basicBlock, CancellationToken cancellationToken)
            {
                BeforeBlockAnalysis();
                Walker.AnalyzeOperationsAndUpdateData(basicBlock.Operations, _analysisData, cancellationToken);
                AfterBlockAnalysis();
                return(_analysisData.CurrentBlockAnalysisData);

                // Local functions.
                void BeforeBlockAnalysis()
                {
                    // Initialize current block analysis data.
                    _analysisData.SetCurrentBlockAnalysisDataFrom(basicBlock, cancellationToken);

                    // At start of entry block, handle parameter definitions from method declaration.
                    if (basicBlock.Kind == BasicBlockKind.Entry)
                    {
                        _analysisData.SetAnalysisDataOnEntryBlockStart();
                    }
                }

                void AfterBlockAnalysis()
                {
                    // If we are exiting the control flow graph, handle ref/out parameter definitions from method declaration.
                    if (basicBlock.FallThroughSuccessor?.Destination == null &&
                        basicBlock.ConditionalSuccessor?.Destination == null)
                    {
                        _analysisData.SetAnalysisDataOnMethodExit();
                    }
                }
            }
Esempio n. 2
0
            public override BasicBlockAnalysisData AnalyzeBlock(BasicBlock basicBlock, CancellationToken cancellationToken)
            {
                BeforeBlockAnalysis();
                Walker.AnalyzeOperationsAndUpdateData(basicBlock.Operations, _analysisData, cancellationToken);
                AfterBlockAnalysis();
                return(_analysisData.CurrentBlockAnalysisData);

                // Local functions.
                void BeforeBlockAnalysis()
                {
                    // Initialize current block analysis data.
                    _analysisData.SetCurrentBlockAnalysisDataFrom(basicBlock);

                    // At start of entry block, handle parameter definitions from method declaration.
                    if (basicBlock.Kind == BasicBlockKind.Entry)
                    {
                        _analysisData.SetAnalysisDataOnEntryBlockStart();
                    }
                }

                void AfterBlockAnalysis()
                {
                    // At end of entry block, handle ref/out parameter definitions from method declaration.
                    if (basicBlock.Kind == BasicBlockKind.Exit)
                    {
                        _analysisData.SetAnalysisDataOnExitBlockEnd();
                    }
                }
            }