Path: blob/main/contrib/llvm-project/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.h
35294 views
//===-- VPlanHCFGBuilder.h --------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7///8/// \file9/// This file defines the VPlanHCFGBuilder class which contains the public10/// interface (buildHierarchicalCFG) to build a VPlan-based Hierarchical CFG11/// (H-CFG) for an incoming IR.12///13/// A H-CFG in VPlan is a control-flow graph whose nodes are VPBasicBlocks14/// and/or VPRegionBlocks (i.e., other H-CFGs). The outermost H-CFG of a VPlan15/// consists of a VPRegionBlock, denoted Top Region, which encloses any other16/// VPBlockBase in the H-CFG. This guarantees that any VPBlockBase in the H-CFG17/// other than the Top Region will have a parent VPRegionBlock and allows us18/// to easily add more nodes before/after the main vector loop (such as the19/// reduction epilogue).20///21//===----------------------------------------------------------------------===//2223#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H24#define LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H2526#include "VPlanDominatorTree.h"2728namespace llvm {2930class Loop;31class LoopInfo;32class VPRegionBlock;33class VPlan;34class VPlanTestBase;3536/// Main class to build the VPlan H-CFG for an incoming IR.37class VPlanHCFGBuilder {38friend VPlanTestBase;3940private:41// The outermost loop of the input loop nest considered for vectorization.42Loop *TheLoop;4344// Loop Info analysis.45LoopInfo *LI;4647// The VPlan that will contain the H-CFG we are building.48VPlan &Plan;4950// Dominator analysis for VPlan plain CFG to be used in the51// construction of the H-CFG. This analysis is no longer valid once regions52// are introduced.53VPDominatorTree VPDomTree;5455/// Build plain CFG for TheLoop and connects it to Plan's entry.56void buildPlainCFG();5758public:59VPlanHCFGBuilder(Loop *Lp, LoopInfo *LI, VPlan &P)60: TheLoop(Lp), LI(LI), Plan(P) {}6162/// Build H-CFG for TheLoop and update Plan accordingly.63void buildHierarchicalCFG();64};65} // namespace llvm6667#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H686970