1 //===-- VPlanHCFGBuilder.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 VPlanHCFGBuilder class which contains the public
11 /// interface (buildHierarchicalCFG) to build a VPlan-based Hierarchical CFG
12 /// (H-CFG) for an incoming IR.
14 /// A H-CFG in VPlan is a control-flow graph whose nodes are VPBasicBlocks
15 /// and/or VPRegionBlocks (i.e., other H-CFGs). The outermost H-CFG of a VPlan
16 /// consists of a VPRegionBlock, denoted Top Region, which encloses any other
17 /// VPBlockBase in the H-CFG. This guarantees that any VPBlockBase in the H-CFG
18 /// other than the Top Region will have a parent VPRegionBlock and allows us
19 /// to easily add more nodes before/after the main vector loop (such as the
20 /// reduction epilogue).
22 //===----------------------------------------------------------------------===//
24 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
25 #define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
28 #include "VPlanDominatorTree.h"
29 #include "VPlanVerifier.h"
36 /// Main class to build the VPlan H-CFG for an incoming IR.
37 class VPlanHCFGBuilder
{
41 // The outermost loop of the input loop nest considered for vectorization.
44 // Loop Info analysis.
47 // The VPlan that will contain the H-CFG we are building.
50 // VPlan verifier utility.
51 VPlanVerifier Verifier
;
53 // Dominator analysis for VPlan plain CFG to be used in the
54 // construction of the H-CFG. This analysis is no longer valid once regions
56 VPDominatorTree VPDomTree
;
58 /// Build plain CFG for TheLoop. Return a new VPRegionBlock (TopRegion)
59 /// enclosing the plain CFG.
60 VPRegionBlock
*buildPlainCFG();
63 VPlanHCFGBuilder(Loop
*Lp
, LoopInfo
*LI
, VPlan
&P
)
64 : TheLoop(Lp
), LI(LI
), Plan(P
) {}
66 /// Build H-CFG for TheLoop and update Plan accordingly.
67 void buildHierarchicalCFG();
71 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H