LLVM 24.0.0git
VPlanAnalysis.h
Go to the documentation of this file.
1//===- VPlanAnalysis.h - Various Analyses working on VPlan ------*- 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#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANANALYSIS_H
10#define LLVM_TRANSFORMS_VECTORIZE_VPLANANALYSIS_H
11
12#include "VPlan.h"
13#include "llvm/ADT/DenseMap.h"
14#include "llvm/ADT/DenseSet.h"
15#include "llvm/ADT/MapVector.h"
17#include "llvm/IR/DataLayout.h"
18#include "llvm/IR/Type.h"
19
20namespace llvm {
21
22class VPRecipeBase;
23class VPlan;
24class VPDominatorTree;
26class InstructionCost;
27
28struct VPCostContext;
29
30// Collect a VPlan's ephemeral recipes (those used only by an assume).
32 DenseSet<VPRecipeBase *> &EphRecipes);
33
34/// Returns true if the memory accesses in outer loop plain CFG \p Plan can be
35/// vectorized.
37 AAResults &AA, const VPDominatorTree &VPDT,
38 const Loop *OuterLoop);
39
40/// A struct that represents some properties of the register usage
41/// of a loop.
43 /// Holds the number of loop invariant values that are used in the loop.
44 /// The key is ClassID of target-provided register class.
46 /// Holds the maximum number of concurrent live intervals in the loop.
47 /// The key is ClassID of target-provided register class.
49
50 /// Calculate the estimated cost of any spills due to using more registers
51 /// than the number available for the target. If non-zero, OverrideMaxNumRegs
52 /// is used in place of the target's number of registers.
55 unsigned OverrideMaxNumRegs = 0) const;
56};
57
58/// Estimate the register usage for \p Plan and vectorization factors in \p VFs
59/// by calculating the highest number of values that are live at a single
60/// location as a rough estimate. Returns the register usage for each VF in \p
61/// VFs.
65
66} // end namespace llvm
67
68#endif // LLVM_TRANSFORMS_VECTORIZE_VPLANANALYSIS_H
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
This file implements a map that provides insertion order iteration.
This pass exposes codegen information to IR-level passes.
This file contains the declarations of the Vectorization Plan base classes:
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Implements a dense probed hash-table based set.
Definition DenseSet.h:281
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
TargetCostKind
The kind of cost model.
Template specialization of the standard LLVM dominator tree utility for VPBlockBases.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition VPlan.h:405
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition VPlan.h:4877
Abstract Attribute helper functions.
Definition Attributor.h:164
This is an optimization pass for GlobalISel generic memory operations.
void collectEphemeralRecipesForVPlan(VPlan &Plan, DenseSet< VPRecipeBase * > &EphRecipes)
SmallVector< VPRegisterUsage, 8 > calculateRegisterUsageForPlan(VPlan &Plan, ArrayRef< ElementCount > VFs, const TargetTransformInfo &TTI)
Estimate the register usage for Plan and vectorization factors in VFs by calculating the highest numb...
TargetTransformInfo TTI
bool proveOuterLoopMemorySafety(VPlan &Plan, PredicatedScalarEvolution &PSE, AAResults &AA, const VPDominatorTree &VPDT, const Loop *OuterLoop)
Returns true if the memory accesses in outer loop plain CFG Plan can be vectorized.
A MapVector that performs no allocations if smaller than a certain size.
Definition MapVector.h:342
Struct to hold various analysis needed for cost computations.
A struct that represents some properties of the register usage of a loop.
SmallMapVector< unsigned, unsigned, 4 > MaxLocalUsers
Holds the maximum number of concurrent live intervals in the loop.
InstructionCost spillCost(const TargetTransformInfo &TTI, TargetTransformInfo::TargetCostKind CostKind, unsigned OverrideMaxNumRegs=0) const
Calculate the estimated cost of any spills due to using more registers than the number available for ...
SmallMapVector< unsigned, unsigned, 4 > LoopInvariantRegs
Holds the number of loop invariant values that are used in the loop.