blob: c4e69843615adf197a7499203ee9fb4e632346c9 [file] [log] [blame]
Diego Caballero168d04d2018-05-21 18:14:23 +00001//===-- 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 "VPlanVerifier.h"
30
31namespace llvm {
32
33class Loop;
34
35/// Main class to build the VPlan H-CFG for an incoming IR.
36class VPlanHCFGBuilder {
37private:
38 // The outermost loop of the input loop nest considered for vectorization.
39 Loop *TheLoop;
40
41 // Loop Info analysis.
42 LoopInfo *LI;
43
44 // VPlan verifier utility.
45 VPlanVerifier Verifier;
46
47public:
48 VPlanHCFGBuilder(Loop *Lp, LoopInfo *LI) : TheLoop(Lp), LI(LI) {}
49
50 /// Build H-CFG for TheLoop and update \p Plan accordingly.
51 void buildHierarchicalCFG(VPlan &Plan);
52};
53} // namespace llvm
54
55#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_VPLANHCFGBUILDER_H