LLVM 24.0.0git
SLPCostAnalysis.h
Go to the documentation of this file.
1//===- SLPCostAnalysis.h - SLP Vectorizer free cost helpers ----*- 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// Internal header used by SLPVectorizer.cpp. It declares free cost helpers
10// that do not depend on BoUpSLP or any other SLP-private type. The bulk of
11// the SLP cost model still lives in SLPVectorizer.cpp because it references
12// BoUpSLP internals.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPCOSTANALYSIS_H
17#define LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPCOSTANALYSIS_H
18
19#include "llvm/ADT/ArrayRef.h"
22
23#include <utility>
24
25namespace llvm {
26class Type;
27class Value;
28class VectorType;
29} // namespace llvm
30
31namespace llvm::slpvectorizer {
32
33/// Returns the cost of the shuffle instructions with the given \p Kind, vector
34/// type \p Tp and optional \p Mask. Adds SLP-specific cost estimation for
35/// insert subvector pattern.
36InstructionCost getShuffleCost(const TargetTransformInfo &TTI,
38 VectorType *Tp, ArrayRef<int> Mask = {},
41 int Index = 0, VectorType *SubTp = nullptr,
43
44/// Calculate the scalar and the vector costs from vectorizing set of GEPs.
45std::pair<InstructionCost, InstructionCost>
46getGEPCosts(const TargetTransformInfo &TTI, ArrayRef<Value *> Ptrs,
47 Value *BasePtr, unsigned Opcode,
49 VectorType *VecTy);
50
51} // namespace llvm::slpvectorizer
52
53#endif // LLVM_LIB_TRANSFORMS_VECTORIZE_SLPVECTORIZER_SLPCOSTANALYSIS_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 an InstructionCost class that is used when calculating the cost of an instruction,...
This pass exposes codegen information to IR-level passes.
TargetCostKind
The kind of cost model.
@ TCK_RecipThroughput
Reciprocal throughput.
ShuffleKind
The various kinds of shuffle patterns for vector queries.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
LLVM Value Representation.
Definition Value.h:75
Base class of all SIMD vector types.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
A private "module" namespace for types and utilities used by this pass.
std::pair< InstructionCost, InstructionCost > getGEPCosts(const TargetTransformInfo &TTI, ArrayRef< Value * > Ptrs, Value *BasePtr, unsigned Opcode, TTI::TargetCostKind CostKind, Type *ScalarTy, VectorType *VecTy)
Calculate the scalar and the vector costs from vectorizing set of GEPs.
InstructionCost getShuffleCost(const TargetTransformInfo &TTI, TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args)
Returns the cost of the shuffle instructions with the given Kind, vector type Tp and optional Mask.
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
Definition InstrProf.h:143
TargetTransformInfo TTI
ArrayRef(const T &OneElt) -> ArrayRef< T >