1 //===-- VPlanPredicator.h ---------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file defines the VPlanPredicator class which contains the public
11 /// interfaces to predicate and linearize the VPlan region.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
16 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
18 #include "LoopVectorizationPlanner.h"
20 #include "VPlanDominatorTree.h"
24 class VPlanPredicator
{
31 // VPlan being predicated.
34 // VPLoopInfo for Plan's HCFG.
37 // Dominator tree for Plan's HCFG.
38 VPDominatorTree VPDomTree
;
40 // VPlan builder used to generate VPInstructions for block predicates.
43 /// Get the type of edge from \p FromBlock to \p ToBlock. Returns TRUE_EDGE if
44 /// \p ToBlock is either the unconditional successor or the conditional true
45 /// successor of \p FromBlock and FALSE_EDGE otherwise.
46 EdgeType
getEdgeTypeBetween(VPBlockBase
*FromBlock
, VPBlockBase
*ToBlock
);
48 /// Create and return VPValue corresponding to the predicate for the edge from
49 /// \p PredBB to \p CurrentBlock.
50 VPValue
*getOrCreateNotPredicate(VPBasicBlock
*PredBB
, VPBasicBlock
*CurrBB
);
52 /// Generate and return the result of ORing all the predicate VPValues in \p
54 VPValue
*genPredicateTree(std::list
<VPValue
*> &Worklist
);
56 /// Create or propagate predicate for \p CurrBlock in region \p Region using
57 /// predicate(s) of its predecessor(s)
58 void createOrPropagatePredicates(VPBlockBase
*CurrBlock
,
59 VPRegionBlock
*Region
);
61 /// Predicate the CFG within \p Region.
62 void predicateRegionRec(VPRegionBlock
*Region
);
64 /// Linearize the CFG within \p Region.
65 void linearizeRegionRec(VPRegionBlock
*Region
);
68 VPlanPredicator(VPlan
&Plan
);
70 /// Predicate Plan's HCFG.
73 } // end namespace llvm
74 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H