LLVM  10.0.0svn
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 "VPlan.h"
20 #include "VPlanDominatorTree.h"
21 
22 namespace llvm {
23 
25 private:
26  enum class EdgeType {
27  TRUE_EDGE,
28  FALSE_EDGE,
29  };
30 
31  // VPlan being predicated.
32  VPlan &Plan;
33 
34  // VPLoopInfo for Plan's HCFG.
35  VPLoopInfo *VPLI;
36 
37  // Dominator tree for Plan's HCFG.
38  VPDominatorTree VPDomTree;
39 
40  // VPlan builder used to generate VPInstructions for block predicates.
41  VPBuilder Builder;
42 
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);
47 
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);
51 
52  /// Generate and return the result of ORing all the predicate VPValues in \p
53  /// Worklist.
54  VPValue *genPredicateTree(std::list<VPValue *> &Worklist);
55 
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,
60 
61  /// Predicate the CFG within \p Region.
62  void predicateRegionRec(VPRegionBlock *Region);
63 
64  /// Linearize the CFG within \p Region.
65  void linearizeRegionRec(VPRegionBlock *Region);
66 
67 public:
68  VPlanPredicator(VPlan &Plan);
69 
70  /// Predicate Plan's HCFG.
71  void predicate(void);
72 };
73 } // end namespace llvm
74 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_PREDICATOR_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:1147
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
Definition: VPlan.h:1067
This file implements dominator tree analysis for a single level of a VPlan&#39;s H-CFG.
This file provides a LoopVectorizationPlanner class.
Core dominator tree base class.
Definition: LoopInfo.h:66
VPlan-based builder utility analogous to IRBuilder.
This file contains the declarations of the Vectorization Plan base classes:
void predicate(void)
Predicate Plan&#39;s HCFG.
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:982
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
Definition: VPlan.h:333