LLVM  15.0.0git
VPlanPredicator.h
Go to the documentation of this file.
1 //===-- VPlanPredicator.h ---------------------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 ///
9 /// \file
10 /// This file defines the VPlanPredicator class which contains the public
11 /// interfaces to predicate and linearize the VPlan region.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
16 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
17 
19 #include "VPlanDominatorTree.h"
20 #include "VPlanLoopInfo.h"
21 #include <list>
22 
23 namespace llvm {
24 class VPBasicBlock;
25 class VPBlockBase;
26 class VPRegionBlock;
27 class VPValue;
28 class VPlan;
29 
31 private:
32  enum class EdgeType {
33  TRUE_EDGE,
34  FALSE_EDGE,
35  };
36 
37  // VPlan being predicated.
38  VPlan &Plan;
39 
40  // VPLoopInfo for Plan's HCFG.
41  VPLoopInfo *VPLI;
42 
43  // Dominator tree for Plan's HCFG.
44  VPDominatorTree VPDomTree;
45 
46  // VPlan builder used to generate VPInstructions for block predicates.
47  VPBuilder Builder;
48 
49  /// Get the type of edge from \p FromBlock to \p ToBlock. Returns TRUE_EDGE if
50  /// \p ToBlock is either the unconditional successor or the conditional true
51  /// successor of \p FromBlock and FALSE_EDGE otherwise.
52  EdgeType getEdgeTypeBetween(VPBlockBase *FromBlock, VPBlockBase *ToBlock);
53 
54  /// Create and return VPValue corresponding to the predicate for the edge from
55  /// \p PredBB to \p CurrentBlock.
56  VPValue *getOrCreateNotPredicate(VPBasicBlock *PredBB, VPBasicBlock *CurrBB);
57 
58  /// Generate and return the result of ORing all the predicate VPValues in \p
59  /// Worklist.
60  VPValue *genPredicateTree(std::list<VPValue *> &Worklist);
61 
62  /// Create or propagate predicate for \p CurrBlock in region \p Region using
63  /// predicate(s) of its predecessor(s)
64  void createOrPropagatePredicates(VPBlockBase *CurrBlock,
66 
67  /// Predicate the CFG within \p Region.
68  void predicateRegionRec(VPRegionBlock *Region);
69 
70  /// Linearize the CFG within \p Region.
71  void linearizeRegionRec(VPRegionBlock *Region);
72 
73 public:
74  VPlanPredicator(VPlan &Plan);
75 
76  /// Predicate Plan's HCFG.
77  void predicate();
78 };
79 } // end namespace llvm
80 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::VPBasicBlock
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:2003
llvm::VPlanPredicator::predicate
void predicate()
Predicate Plan's HCFG.
Definition: VPlanPredicator.cpp:232
VPlanDominatorTree.h
llvm::VPBlockBase
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:395
llvm::VPBuilder
VPlan-based builder utility analogous to IRBuilder.
Definition: LoopVectorizationPlanner.h:44
llvm::VPValue
Definition: VPlanValue.h:44
llvm::VPRegionBlock
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
Definition: VPlan.h:2119
VPlanLoopInfo.h
LoopVectorizationPlanner.h
llvm::DominatorTreeBase
Core dominator tree base class.
Definition: LoopInfo.h:65
llvm::LoopInfoBase< VPBlockBase, VPLoop >
llvm::VPlanPredicator::VPlanPredicator
VPlanPredicator(VPlan &Plan)
Definition: VPlanPredicator.cpp:240
llvm::VPlanPredicator
Definition: VPlanPredicator.h:30
llvm::Region
Definition: RegionInfo.h:889
llvm::VPlan
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:2473