003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/Analysis
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
Analysis
/
📁
..
📄
AliasAnalysis.h
(51.98 KB)
📄
AliasAnalysisEvaluator.h
(2.7 KB)
📄
AliasSetTracker.h
(15.42 KB)
📄
AssumeBundleQueries.h
(6.66 KB)
📄
AssumptionCache.h
(8.39 KB)
📄
BasicAliasAnalysis.h
(10.2 KB)
📄
BlockFrequencyInfo.h
(5.59 KB)
📄
BlockFrequencyInfoImpl.h
(56.46 KB)
📄
BranchProbabilityInfo.h
(10.1 KB)
📄
CFG.h
(7.76 KB)
📄
CFGPrinter.h
(9.31 KB)
📄
CFLAliasAnalysisUtils.h
(1.66 KB)
📄
CFLAndersAliasAnalysis.h
(3.97 KB)
📄
CFLSteensAliasAnalysis.h
(4.58 KB)
📄
CGSCCPassManager.h
(41.2 KB)
📄
CallGraph.h
(18.88 KB)
📄
CallGraphSCCPass.h
(5.01 KB)
📄
CallPrinter.h
(799 B)
📄
CaptureTracking.h
(4.78 KB)
📄
CmpInstAnalysis.h
(2.57 KB)
📄
CodeMetrics.h
(3.15 KB)
📄
ConstantFolding.h
(8.01 KB)
📄
DDG.h
(19.15 KB)
📄
DOTGraphTraitsPass.h
(5.5 KB)
📄
DemandedBits.h
(4.07 KB)
📄
DependenceAnalysis.h
(41.83 KB)
📄
DependenceGraphBuilder.h
(7.74 KB)
📄
DivergenceAnalysis.h
(7.38 KB)
📄
DomPrinter.h
(1.04 KB)
📄
DomTreeUpdater.h
(13.2 KB)
📄
DominanceFrontier.h
(6.63 KB)
📄
DominanceFrontierImpl.h
(7.12 KB)
📄
EHPersonalities.h
(3.22 KB)
📄
GlobalsModRef.h
(5.96 KB)
📄
GuardUtils.h
(2.11 KB)
📄
HeatUtils.h
(1.16 KB)
📄
IVDescriptors.h
(14.56 KB)
📄
IVUsers.h
(6.07 KB)
📄
IndirectCallPromotionAnalysis.h
(2.61 KB)
📄
IndirectCallVisitor.h
(1.16 KB)
📄
InlineAdvisor.h
(8.71 KB)
📄
InlineCost.h
(11.33 KB)
📄
InlineFeaturesAnalysis.h
(1.5 KB)
📄
InlineModelFeatureMaps.h
(3.41 KB)
📄
InlineSizeEstimatorAnalysis.h
(1.07 KB)
📄
InstructionPrecedenceTracking.h
(5.9 KB)
📄
InstructionSimplify.h
(13.36 KB)
📄
Interval.h
(4.84 KB)
📄
IntervalIterator.h
(10.64 KB)
📄
IntervalPartition.h
(4.05 KB)
📄
IteratedDominanceFrontier.h
(2.62 KB)
📄
LazyBlockFrequencyInfo.h
(4.34 KB)
📄
LazyBranchProbabilityInfo.h
(4.21 KB)
📄
LazyCallGraph.h
(50.13 KB)
📄
LazyValueInfo.h
(5.4 KB)
📄
LegacyDivergenceAnalysis.h
(2.53 KB)
📄
Lint.h
(1.35 KB)
📄
Loads.h
(7.86 KB)
📄
LoopAccessAnalysis.h
(29.75 KB)
📄
LoopAnalysisManager.h
(5.83 KB)
📄
LoopCacheAnalysis.h
(11.91 KB)
📄
LoopInfo.h
(48.27 KB)
📄
LoopInfoImpl.h
(27.14 KB)
📄
LoopIterator.h
(8.83 KB)
📄
LoopNestAnalysis.h
(5.61 KB)
📄
LoopPass.h
(4.29 KB)
📄
LoopUnrollAnalyzer.h
(3.42 KB)
📄
MLInlineAdvisor.h
(3.48 KB)
📄
MLModelRunner.h
(1.16 KB)
📄
MemoryBuiltins.h
(13.42 KB)
📄
MemoryDependenceAnalysis.h
(20.82 KB)
📄
MemoryLocation.h
(10.99 KB)
📄
MemorySSA.h
(45.92 KB)
📄
MemorySSAUpdater.h
(14.55 KB)
📄
ModuleSummaryAnalysis.h
(3.44 KB)
📄
MustExecute.h
(20.2 KB)
📄
ObjCARCAliasAnalysis.h
(3.35 KB)
📄
ObjCARCAnalysisUtils.h
(10.22 KB)
📄
ObjCARCInstKind.h
(4.87 KB)
📄
OptimizationRemarkEmitter.h
(5.93 KB)
📄
PHITransAddr.h
(4.77 KB)
📄
Passes.h
(3.88 KB)
📄
PhiValues.h
(5.25 KB)
📄
PostDominators.h
(3.41 KB)
📄
ProfileSummaryInfo.h
(9.3 KB)
📄
PtrUseVisitor.h
(9.96 KB)
📄
RegionInfo.h
(35.23 KB)
📄
RegionInfoImpl.h
(25.16 KB)
📄
RegionIterator.h
(14.07 KB)
📄
RegionPass.h
(4.05 KB)
📄
RegionPrinter.h
(2.25 KB)
📄
ScalarEvolution.h
(89.21 KB)
📄
ScalarEvolutionAliasAnalysis.h
(2.09 KB)
📄
ScalarEvolutionDivision.h
(2.48 KB)
📄
ScalarEvolutionExpressions.h
(28.61 KB)
📄
ScalarEvolutionNormalization.h
(2.47 KB)
📄
ScopedNoAliasAA.h
(2.83 KB)
📄
SparsePropagation.h
(19.43 KB)
📄
StackLifetime.h
(6.16 KB)
📄
StackSafetyAnalysis.h
(4.91 KB)
📄
SyncDependenceAnalysis.h
(2.85 KB)
📄
SyntheticCountsUtils.h
(1.85 KB)
📄
TargetFolder.h
(11.04 KB)
📄
TargetLibraryInfo.def
(55.35 KB)
📄
TargetLibraryInfo.h
(16.86 KB)
📄
TargetTransformInfo.h
(96.51 KB)
📄
TargetTransformInfoImpl.h
(37.63 KB)
📄
Trace.h
(4.1 KB)
📄
TypeBasedAliasAnalysis.h
(3.05 KB)
📄
TypeMetadataUtils.h
(1.94 KB)
📁
Utils
📄
ValueLattice.h
(15.14 KB)
📄
ValueLatticeUtils.h
(1.66 KB)
📄
ValueTracking.h
(35.82 KB)
📄
VecFuncs.def
(10.94 KB)
📄
VectorUtils.h
(37.26 KB)
Editing: CFG.h
//===-- Analysis/CFG.h - BasicBlock Analyses --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This family of functions performs analyses on basic blocks, and instructions // contained within basic blocks. // //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_CFG_H #define LLVM_ANALYSIS_CFG_H #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/SmallPtrSet.h" #include <utility> namespace llvm { class BasicBlock; class DominatorTree; class Function; class Instruction; class LoopInfo; template <typename T> class SmallVectorImpl; /// Analyze the specified function to find all of the loop backedges in the /// function and return them. This is a relatively cheap (compared to /// computing dominators and loop info) analysis. /// /// The output is added to Result, as pairs of <from,to> edge info. void FindFunctionBackedges( const Function &F, SmallVectorImpl<std::pair<const BasicBlock *, const BasicBlock *> > & Result); /// Search for the specified successor of basic block BB and return its position /// in the terminator instruction's list of successors. It is an error to call /// this with a block that is not a successor. unsigned GetSuccessorNumber(const BasicBlock *BB, const BasicBlock *Succ); /// Return true if the specified edge is a critical edge. Critical edges are /// edges from a block with multiple successors to a block with multiple /// predecessors. /// bool isCriticalEdge(const Instruction *TI, unsigned SuccNum, bool AllowIdenticalEdges = false); bool isCriticalEdge(const Instruction *TI, const BasicBlock *Succ, bool AllowIdenticalEdges = false); /// Determine whether instruction 'To' is reachable from 'From', without passing /// through any blocks in ExclusionSet, returning true if uncertain. /// /// Determine whether there is a path from From to To within a single function. /// Returns false only if we can prove that once 'From' has been executed then /// 'To' can not be executed. Conservatively returns true. /// /// This function is linear with respect to the number of blocks in the CFG, /// walking down successors from From to reach To, with a fixed threshold. /// Using DT or LI allows us to answer more quickly. LI reduces the cost of /// an entire loop of any number of blocks to be the same as the cost of a /// single block. DT reduces the cost by allowing the search to terminate when /// we find a block that dominates the block containing 'To'. DT is most useful /// on branchy code but not loops, and LI is most useful on code with loops but /// does not help on branchy code outside loops. bool isPotentiallyReachable( const Instruction *From, const Instruction *To, const SmallPtrSetImpl<BasicBlock *> *ExclusionSet = nullptr, const DominatorTree *DT = nullptr, const LoopInfo *LI = nullptr); /// Determine whether block 'To' is reachable from 'From', returning /// true if uncertain. /// /// Determine whether there is a path from From to To within a single function. /// Returns false only if we can prove that once 'From' has been reached then /// 'To' can not be executed. Conservatively returns true. bool isPotentiallyReachable(const BasicBlock *From, const BasicBlock *To, const DominatorTree *DT = nullptr, const LoopInfo *LI = nullptr); /// Determine whether there is at least one path from a block in /// 'Worklist' to 'StopBB', returning true if uncertain. /// /// Determine whether there is a path from at least one block in Worklist to /// StopBB within a single function. Returns false only if we can prove that /// once any block in 'Worklist' has been reached then 'StopBB' can not be /// executed. Conservatively returns true. bool isPotentiallyReachableFromMany(SmallVectorImpl<BasicBlock *> &Worklist, BasicBlock *StopBB, const DominatorTree *DT = nullptr, const LoopInfo *LI = nullptr); /// Determine whether there is at least one path from a block in /// 'Worklist' to 'StopBB' without passing through any blocks in /// 'ExclusionSet', returning true if uncertain. /// /// Determine whether there is a path from at least one block in Worklist to /// StopBB within a single function without passing through any of the blocks /// in 'ExclusionSet'. Returns false only if we can prove that once any block /// in 'Worklist' has been reached then 'StopBB' can not be executed. /// Conservatively returns true. bool isPotentiallyReachableFromMany( SmallVectorImpl<BasicBlock *> &Worklist, BasicBlock *StopBB, const SmallPtrSetImpl<BasicBlock *> *ExclusionSet, const DominatorTree *DT = nullptr, const LoopInfo *LI = nullptr); /// Return true if the control flow in \p RPOTraversal is irreducible. /// /// This is a generic implementation to detect CFG irreducibility based on loop /// info analysis. It can be used for any kind of CFG (Loop, MachineLoop, /// Function, MachineFunction, etc.) by providing an RPO traversal (\p /// RPOTraversal) and the loop info analysis (\p LI) of the CFG. This utility /// function is only recommended when loop info analysis is available. If loop /// info analysis isn't available, please, don't compute it explicitly for this /// purpose. There are more efficient ways to detect CFG irreducibility that /// don't require recomputing loop info analysis (e.g., T1/T2 or Tarjan's /// algorithm). /// /// Requirements: /// 1) GraphTraits must be implemented for NodeT type. It is used to access /// NodeT successors. // 2) \p RPOTraversal must be a valid reverse post-order traversal of the /// target CFG with begin()/end() iterator interfaces. /// 3) \p LI must be a valid LoopInfoBase that contains up-to-date loop /// analysis information of the CFG. /// /// This algorithm uses the information about reducible loop back-edges already /// computed in \p LI. When a back-edge is found during the RPO traversal, the /// algorithm checks whether the back-edge is one of the reducible back-edges in /// loop info. If it isn't, the CFG is irreducible. For example, for the CFG /// below (canonical irreducible graph) loop info won't contain any loop, so the /// algorithm will return that the CFG is irreducible when checking the B <- /// -> C back-edge. /// /// (A->B, A->C, B->C, C->B, C->D) /// A /// / \ /// B<- ->C /// | /// D /// template <class NodeT, class RPOTraversalT, class LoopInfoT, class GT = GraphTraits<NodeT>> bool containsIrreducibleCFG(RPOTraversalT &RPOTraversal, const LoopInfoT &LI) { /// Check whether the edge (\p Src, \p Dst) is a reducible loop backedge /// according to LI. I.e., check if there exists a loop that contains Src and /// where Dst is the loop header. auto isProperBackedge = [&](NodeT Src, NodeT Dst) { for (const auto *Lp = LI.getLoopFor(Src); Lp; Lp = Lp->getParentLoop()) { if (Lp->getHeader() == Dst) return true; } return false; }; SmallPtrSet<NodeT, 32> Visited; for (NodeT Node : RPOTraversal) { Visited.insert(Node); for (NodeT Succ : make_range(GT::child_begin(Node), GT::child_end(Node))) { // Succ hasn't been visited yet if (!Visited.count(Succ)) continue; // We already visited Succ, thus Node->Succ must be a backedge. Check that // the head matches what we have in the loop information. Otherwise, we // have an irreducible graph. if (!isProperBackedge(Node, Succ)) return true; } } return false; } } // End llvm namespace #endif
Upload File
Create Folder