1 //===-- VPlanHCFGBuilder.h --------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
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).
23 //===----------------------------------------------------------------------===//
25 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
26 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
29 #include "VPlanDominatorTree.h"
30 #include "VPlanVerifier.h"
37 /// Main class to build the VPlan H-CFG for an incoming IR.
38 class VPlanHCFGBuilder {
42 // The outermost loop of the input loop nest considered for vectorization.
45 // Loop Info analysis.
48 // The VPlan that will contain the H-CFG we are building.
51 // VPlan verifier utility.
52 VPlanVerifier Verifier;
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
57 VPDominatorTree VPDomTree;
59 /// Build plain CFG for TheLoop. Return a new VPRegionBlock (TopRegion)
60 /// enclosing the plain CFG.
61 VPRegionBlock *buildPlainCFG();
64 VPlanHCFGBuilder(Loop *Lp, LoopInfo *LI, VPlan &P)
65 : TheLoop(Lp), LI(LI), Plan(P) {}
67 /// Build H-CFG for TheLoop and update Plan accordingly.
68 void buildHierarchicalCFG();
72 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H