LLVM 18.0.0git
VPlanHCFGBuilder.h
Go to the documentation of this file.
1//===-- VPlanHCFGBuilder.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 VPlanHCFGBuilder class which contains the public
11/// interface (buildHierarchicalCFG) to build a VPlan-based Hierarchical CFG
12/// (H-CFG) for an incoming IR.
13///
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).
21///
22//===----------------------------------------------------------------------===//
23
24#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
25#define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
26
27#include "VPlanDominatorTree.h"
28#include "VPlanVerifier.h"
29
30namespace llvm {
31
32class Loop;
33class LoopInfo;
34class VPRegionBlock;
35class VPlan;
36class VPlanTestBase;
37
38/// Main class to build the VPlan H-CFG for an incoming IR.
40 friend VPlanTestBase;
41
42private:
43 // The outermost loop of the input loop nest considered for vectorization.
44 Loop *TheLoop;
45
46 // Loop Info analysis.
47 LoopInfo *LI;
48
49 // The VPlan that will contain the H-CFG we are building.
50 VPlan &Plan;
51
52 // VPlan verifier utility.
53 VPlanVerifier Verifier;
54
55 // Dominator analysis for VPlan plain CFG to be used in the
56 // construction of the H-CFG. This analysis is no longer valid once regions
57 // are introduced.
58 VPDominatorTree VPDomTree;
59
60 /// Build plain CFG for TheLoop and connects it to Plan's entry.
61 void buildPlainCFG();
62
63public:
65 : TheLoop(Lp), LI(LI), Plan(P) {}
66
67 /// Build H-CFG for TheLoop and update Plan accordingly.
69};
70} // namespace llvm
71
72#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H
#define P(N)
This file implements dominator tree analysis for a single level of a VPlan's H-CFG.
This file declares the class VPlanVerifier, which contains utility functions to check the consistency...
Core dominator tree base class.
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:47
Main class to build the VPlan H-CFG for an incoming IR.
VPlanHCFGBuilder(Loop *Lp, LoopInfo *LI, VPlan &P)
void buildHierarchicalCFG()
Build H-CFG for TheLoop and update Plan accordingly.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition: VPlan.h:2474
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Struct with utility functions that can be used to check the consistency and invariants of a VPlan,...
Definition: VPlanVerifier.h:33