LLVM  8.0.1
VPlanHCFGBuilder.h
Go to the documentation of this file.
1 //===-- VPlanHCFGBuilder.h --------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// This file defines the VPlanHCFGBuilder class which contains the public
12 /// interface (buildHierarchicalCFG) to build a VPlan-based Hierarchical CFG
13 /// (H-CFG) for an incoming IR.
14 ///
15 /// A H-CFG in VPlan is a control-flow graph whose nodes are VPBasicBlocks
16 /// and/or VPRegionBlocks (i.e., other H-CFGs). The outermost H-CFG of a VPlan
17 /// consists of a VPRegionBlock, denoted Top Region, which encloses any other
18 /// VPBlockBase in the H-CFG. This guarantees that any VPBlockBase in the H-CFG
19 /// other than the Top Region will have a parent VPRegionBlock and allows us
20 /// to easily add more nodes before/after the main vector loop (such as the
21 /// reduction epilogue).
22 ///
23 //===----------------------------------------------------------------------===//
24 
25 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
26 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
27 
28 #include "VPlan.h"
29 #include "VPlanDominatorTree.h"
30 #include "VPlanVerifier.h"
31 
32 namespace llvm {
33 
34 class Loop;
35 class VPlanTestBase;
36 
37 /// Main class to build the VPlan H-CFG for an incoming IR.
39  friend VPlanTestBase;
40 
41 private:
42  // The outermost loop of the input loop nest considered for vectorization.
43  Loop *TheLoop;
44 
45  // Loop Info analysis.
46  LoopInfo *LI;
47 
48  // The VPlan that will contain the H-CFG we are building.
49  VPlan &Plan;
50 
51  // VPlan verifier utility.
52  VPlanVerifier Verifier;
53 
54  // Dominator analysis for VPlan plain CFG to be used in the
55  // construction of the H-CFG. This analysis is no longer valid once regions
56  // are introduced.
57  VPDominatorTree VPDomTree;
58 
59  /// Build plain CFG for TheLoop. Return a new VPRegionBlock (TopRegion)
60  /// enclosing the plain CFG.
61  VPRegionBlock *buildPlainCFG();
62 
63 public:
65  : TheLoop(Lp), LI(LI), Plan(P) {}
66 
67  /// Build H-CFG for TheLoop and update Plan accordingly.
68  void buildHierarchicalCFG();
69 };
70 } // namespace llvm
71 
72 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
Main class to build the VPlan H-CFG for an incoming IR.
This class represents lattice values for constants.
Definition: AllocatorList.h:24
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:1130
void buildHierarchicalCFG()
Build H-CFG for TheLoop and update Plan accordingly.
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
Definition: VPlan.h:1050
This file implements dominator tree analysis for a single level of a VPlan's H-CFG.
Class with utility functions that can be used to check the consistency and invariants of a VPlan...
Definition: VPlanVerifier.h:34
VPlanHCFGBuilder(Loop *Lp, LoopInfo *LI, VPlan &P)
Core dominator tree base class.
Definition: LoopInfo.h:61
#define P(N)
This file contains the declarations of the Vectorization Plan base classes:
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:465
This file declares the class VPlanVerifier, which contains utility functions to check the consistency...