コード例 #1
0
        /// <summary>
        /// Computes the immediate dominator of each basic block.
        /// The default implementation directs the task to the Cooper-Harvey-Kennedy algorithm.
        /// </summary>
        protected virtual void ComputeDominators()
        {
            IGraphAdapter <BasicBlock <Ti> > a = BasicBlock <Ti> .DominanceAnalysisAdapter;

            a.InvertRelation(a.Succs, a.Preds, BasicBlocks);
            a.ComputeImmediateDominators(BasicBlocks, EntryCB);
        }
コード例 #2
0
        /// <summary>
        /// Analyzes the loop nesting structure of the control-flow graph.
        /// The default implementation directs the tasks to Havlak's algorithm.
        /// </summary>
        protected virtual void AnalyzeLoops()
        {
            IGraphAdapter <BasicBlock <Ti> > a = BasicBlock <Ti> .LoopAnalysisAdapter;

            BasicBlock <Ti>[] reachable = a.GetPreOrder(BasicBlocks, EntryCB);
            a.InvertRelation(a.Succs, a.Preds, reachable);
            a.AnalyzeLoops(reachable, EntryCB);
        }
コード例 #3
0
 /// <summary>
 /// Computes a the immediate dominators of all specified graph nodes.
 /// </summary>
 /// <param name="a">graph adapter</param>
 /// <param name="nodes">nodes to consider</param>
 /// <param name="entry">entry node</param>
 public static void ComputeImmediateDominators <T>(this IGraphAdapter <T> a,
                                                   IList <T> nodes, T entry) where T : class
 {
     ComputeImmediateDominators(a.Succs, a.Preds, a.PostOrderIndex,
                                a.IDom, nodes, entry);
     a.IDom[entry] = null;
     a.InvertRelation(a.IDom, a.IDoms, nodes);
     a.IDom[entry] = entry;
 }
コード例 #4
0
 /// <summary>
 /// Inverts a successor relation, taking the predecessor relation as target.
 /// </summary>
 /// <param name="a">graph adapter providing the relations</param>
 /// <param name="nodes">nodes to be considered</param>
 public static void ComputePredecessorsFromSuccessors <T>(this IGraphAdapter <T> a, IEnumerable <T> nodes)
 {
     a.InvertRelation(a.Succs, a.Preds, nodes);
 }
コード例 #5
0
 /// <summary>
 /// Inverts a parent relation, taking the successor relation as target.
 /// </summary>
 /// <param name="a">graph adapter providing the relations</param>
 /// <param name="nodes">nodes to be considered</param>
 public static void ComputeSuccessorsFromParent <T>(this IGraphAdapter <T> a, IEnumerable <T> nodes)
 {
     a.InvertRelation(a.Parent, a.Succs, nodes);
 }