LLVM 24.0.0git
HexagonTargetTransformInfo.cpp
Go to the documentation of this file.
1//===- HexagonTargetTransformInfo.cpp - Hexagon specific TTI pass ---------===//
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/// \file
8/// This file implements a TargetTransformInfo analysis pass specific to the
9/// Hexagon target machine. It uses the target's detailed information to provide
10/// more precise answers to certain TTI queries, while letting the target
11/// independent and default TTI implementations handle the rest.
12///
13//===----------------------------------------------------------------------===//
14
16#include "HexagonSubtarget.h"
19#include "llvm/IR/InstrTypes.h"
21#include "llvm/IR/User.h"
26
27using namespace llvm;
28
29#define DEBUG_TYPE "hexagontti"
30
31static cl::opt<bool> HexagonAutoHVX("hexagon-autohvx", cl::init(false),
32 cl::Hidden, cl::desc("Enable loop vectorizer for HVX"));
33
35 "hexagon-allow-scatter-gather-hvx", cl::init(false), cl::Hidden,
36 cl::desc("Allow auto-generation of HVX scatter-gather"));
37
39 "force-hvx-float", cl::Hidden,
40 cl::desc("Enable auto-vectorization of floatint point types on v68."));
41
42static cl::opt<bool> EmitLookupTables("hexagon-emit-lookup-tables",
43 cl::init(true), cl::Hidden,
44 cl::desc("Control lookup table emission on Hexagon target"));
45
46static cl::opt<bool> HexagonMaskedVMem("hexagon-masked-vmem", cl::init(true),
47 cl::Hidden, cl::desc("Enable masked loads/stores for HVX"));
48
49// Constant "cost factor" to make floating point operations more expensive
50// in terms of vectorization cost. This isn't the best way, but it should
51// do. Ultimately, the cost should use cycles.
52static const unsigned FloatFactor = 4;
53
54bool HexagonTTIImpl::useHVX() const {
55 return ST.useHVXOps() && HexagonAutoHVX && !IsHMX;
56}
57
58bool HexagonTTIImpl::isHVXVectorType(Type *Ty) const {
59 auto *VecTy = dyn_cast<VectorType>(Ty);
60 if (!VecTy)
61 return false;
62 if (!ST.isTypeForHVX(VecTy))
63 return false;
64 if (ST.useHVXV69Ops() || !VecTy->getElementType()->isFloatingPointTy())
65 return true;
66 return ST.useHVXV68Ops() && EnableV68FloatAutoHVX;
67}
68
69unsigned HexagonTTIImpl::getTypeNumElements(Type *Ty) const {
70 if (auto *VTy = dyn_cast<FixedVectorType>(Ty))
71 return VTy->getNumElements();
72 assert((Ty->isIntegerTy() || Ty->isFloatingPointTy()) &&
73 "Expecting scalar type");
74 return 1;
75}
76
77// The Hexagon target can unroll loops with run-time trip counts.
80 OptimizationRemarkEmitter *ORE) const {
81 UP.Runtime = UP.Partial = true;
82}
83
85 TTI::PeelingPreferences &PP) const {
87 // Only try to peel innermost loops with small runtime trip counts.
88 if (L && L->isInnermost() && canPeel(L) &&
89 SE.getSmallConstantTripCount(L) == 0 &&
92 PP.PeelCount = 2;
93 }
94}
95
101
102/// --- Vector TTI begin ---
103
104unsigned HexagonTTIImpl::getNumberOfRegisters(unsigned ClassID) const {
105 bool Vector = ClassID == 1;
106 if (Vector)
107 return useHVX() ? 32 : 0;
108 return 32;
109}
110
111unsigned
113 bool HasUnorderedReductions) const {
114 return useHVX() ? 2 : 1;
115}
116
130
132 return useHVX() ? ST.getVectorLength()*8 : 32;
133}
134
136 bool IsScalable) const {
137 assert(!IsScalable && "Scalable VFs are not supported for Hexagon");
138 return ElementCount::getFixed((8 * ST.getVectorLength()) / ElemWidth);
139}
140
143 TTI::TargetCostKind CostKind) const {
144 return BaseT::getCallInstrCost(F, RetTy, Tys, CostKind);
145}
146
149 TTI::TargetCostKind CostKind) const {
150 if (ICA.getID() == Intrinsic::bswap) {
151 std::pair<InstructionCost, MVT> LT =
153 return LT.first + 2;
154 }
155 return BaseT::getIntrinsicInstrCost(ICA, CostKind);
156}
157
160 const SCEV *S,
161 TTI::TargetCostKind CostKind) const {
162 return 0;
163}
164
166 Align Alignment,
167 unsigned AddressSpace,
168 TTI::TargetCostKind CostKind,
170 const Instruction *I) const {
171 assert(Opcode == Instruction::Load || Opcode == Instruction::Store);
172
173 // FIXME: Load latency isn't handled here
174 if (Opcode == Instruction::Load && CostKind == TTI::TCK_Latency)
175 return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
176 CostKind, OpInfo, I);
177
178 // TODO: Handle other cost kinds.
179 if (CostKind != TTI::TCK_RecipThroughput)
180 return 1;
181
182 if (Opcode == Instruction::Store)
183 return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
184 CostKind, OpInfo, I);
185
186 if (Src->isVectorTy()) {
187 VectorType *VecTy = cast<VectorType>(Src);
188 unsigned VecWidth = VecTy->getPrimitiveSizeInBits().getFixedValue();
189 if (isHVXVectorType(VecTy)) {
190 unsigned RegWidth =
192 .getFixedValue();
193 assert(RegWidth && "Non-zero vector register width expected");
194 // Cost of HVX loads.
195 if (VecWidth % RegWidth == 0)
196 return VecWidth / RegWidth;
197 // Cost of constructing HVX vector from scalar loads
198 const Align RegAlign(RegWidth / 8);
199 if (Alignment > RegAlign)
200 Alignment = RegAlign;
201 unsigned AlignWidth = 8 * Alignment.value();
202 unsigned NumLoads = alignTo(VecWidth, AlignWidth) / AlignWidth;
203 return 3 * NumLoads;
204 }
205
206 // Non-HVX vectors.
207 // Add extra cost for floating point types.
208 unsigned Cost =
210
211 // At this point unspecified alignment is considered as Align(1).
212 const Align BoundAlignment = std::min(Alignment, Align(8));
213 unsigned AlignWidth = 8 * BoundAlignment.value();
214 unsigned NumLoads = alignTo(VecWidth, AlignWidth) / AlignWidth;
215 if (Alignment == Align(4) || Alignment == Align(8))
216 return Cost * NumLoads;
217 // Loads of less than 32 bits will need extra inserts to compose a vector.
218 assert(BoundAlignment <= Align(8));
219 unsigned LogA = Log2(BoundAlignment);
220 return (3 - LogA) * Cost * NumLoads;
221 }
222
223 return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, CostKind,
224 OpInfo, I);
225}
226
228 TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
229 TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
230 VectorType *SubTp, ArrayRef<const Value *> Args, const Instruction *CtxI,
231 TTI::VectorInstrContext VIC) const {
232 return 1;
233}
234
236 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
237 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
238 bool UseMaskForCond, bool UseMaskForGaps) const {
239 if (Indices.size() != Factor || UseMaskForCond || UseMaskForGaps)
240 return BaseT::getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
241 Alignment, AddressSpace,
242 CostKind,
243 UseMaskForCond, UseMaskForGaps);
244 return getMemoryOpCost(Opcode, VecTy, Alignment, AddressSpace, CostKind);
245}
246
248 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
250 TTI::OperandValueInfo Op2Info, const Instruction *I) const {
251 if (ValTy->isVectorTy() && CostKind == TTI::TCK_RecipThroughput) {
252 if (!isHVXVectorType(ValTy) && ValTy->isFPOrFPVectorTy())
254 std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(ValTy);
255 if (Opcode == Instruction::FCmp)
256 return LT.first + FloatFactor * getTypeNumElements(ValTy);
257 }
258 return BaseT::getCmpSelInstrCost(Opcode, ValTy, CondTy, VecPred, CostKind,
259 Op1Info, Op2Info, I);
260}
261
263 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
265 ArrayRef<const Value *> Args, const Instruction *CtxI,
266 const TargetLibraryInfo *TLibInfo, ArrayRef<const Value *> Scalars) const {
267 // TODO: Handle more cost kinds.
268 if (CostKind != TTI::TCK_RecipThroughput)
269 return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
270 Args, CtxI, TLibInfo, Scalars);
271
272 if (Ty->isVectorTy()) {
273 if (!isHVXVectorType(Ty) && Ty->isFPOrFPVectorTy())
275 std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
276 if (LT.second.isFloatingPoint())
277 return LT.first + FloatFactor * getTypeNumElements(Ty);
278 }
279 return BaseT::getArithmeticInstrCost(Opcode, Ty, CostKind, Op1Info, Op2Info,
280 Args, CtxI, TLibInfo, Scalars);
281}
282
284 Type *SrcTy,
286 TTI::TargetCostKind CostKind,
287 const Instruction *I) const {
288 auto isNonHVXFP = [this] (Type *Ty) {
289 return Ty->isVectorTy() && !isHVXVectorType(Ty) && Ty->isFPOrFPVectorTy();
290 };
291 if (isNonHVXFP(SrcTy) || isNonHVXFP(DstTy))
293
294 if (SrcTy->isFPOrFPVectorTy() || DstTy->isFPOrFPVectorTy()) {
295 unsigned SrcN = SrcTy->isFPOrFPVectorTy() ? getTypeNumElements(SrcTy) : 0;
296 unsigned DstN = DstTy->isFPOrFPVectorTy() ? getTypeNumElements(DstTy) : 0;
297
298 std::pair<InstructionCost, MVT> SrcLT = getTypeLegalizationCost(SrcTy);
299 std::pair<InstructionCost, MVT> DstLT = getTypeLegalizationCost(DstTy);
301 std::max(SrcLT.first, DstLT.first) + FloatFactor * (SrcN + DstN);
302 // TODO: Allow non-throughput costs that aren't binary.
303 if (CostKind != TTI::TCK_RecipThroughput)
304 return Cost == 0 ? 0 : 1;
305 return Cost;
306 }
307 return 1;
308}
309
311 unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
312 const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC) const {
313 Type *ElemTy = Val->isVectorTy() ? cast<VectorType>(Val)->getElementType()
314 : Val;
315 if (Opcode == Instruction::InsertElement) {
316 // Need two rotations for non-zero index.
317 unsigned Cost = (Index != 0) ? 2 : 0;
318 if (ElemTy->isIntegerTy(32))
319 return Cost;
320 // If it's not a 32-bit value, there will need to be an extract.
321 return Cost + getVectorInstrCost(Instruction::ExtractElement, Val, CostKind,
322 Index, Op0, Op1, VIC);
323 }
324
325 if (Opcode == Instruction::ExtractElement)
326 return 2;
327
328 return 1;
329}
330
332 switch (II->getIntrinsicID()) {
333 case Intrinsic::vector_reduce_add:
334 return false;
335 }
336 return true;
337}
338
339bool HexagonTTIImpl::isLegalMaskedStore(Type *DataType, Align /*Alignment*/,
340 unsigned /*AddressSpace*/,
341 TTI::MaskKind /*MaskKind*/) const {
342 // This function is called from scalarize-masked-mem-intrin, which runs
343 // in pre-isel. Use ST directly instead of calling isHVXVectorType.
344 return HexagonMaskedVMem &&
345 (ST.isTypeForHVX(DataType) || ST.isTypeForHLX(DataType));
346}
347
348bool HexagonTTIImpl::isLegalMaskedLoad(Type *DataType, Align /*Alignment*/,
349 unsigned /*AddressSpace*/,
350 TTI::MaskKind /*MaskKind*/) const {
351 // This function is called from scalarize-masked-mem-intrin, which runs
352 // in pre-isel. Use ST directly instead of calling isHVXVectorType.
353 return HexagonMaskedVMem &&
354 (ST.isTypeForHVX(DataType) || ST.isTypeForHLX(DataType));
355}
356
358 // For now assume we can not deal with all HVX datatypes.
359 if (!Ty->isVectorTy() || !ST.isTypeForHVX(Ty) ||
361 return false;
362 // This must be in sync with HexagonVectorCombine pass.
363 switch (Ty->getScalarSizeInBits()) {
364 case 8:
365 return (getTypeNumElements(Ty) == 128);
366 case 16:
367 if (getTypeNumElements(Ty) == 64 || getTypeNumElements(Ty) == 32)
368 return (Alignment >= 2);
369 break;
370 case 32:
371 if (getTypeNumElements(Ty) == 32)
372 return (Alignment >= 4);
373 break;
374 default:
375 break;
376 }
377 return false;
378}
379
381 if (!Ty->isVectorTy() || !ST.isTypeForHVX(Ty) ||
383 return false;
384 // This must be in sync with HexagonVectorCombine pass.
385 switch (Ty->getScalarSizeInBits()) {
386 case 8:
387 return (getTypeNumElements(Ty) == 128);
388 case 16:
389 if (getTypeNumElements(Ty) == 64)
390 return (Alignment >= 2);
391 break;
392 case 32:
393 if (getTypeNumElements(Ty) == 32)
394 return (Alignment >= 4);
395 break;
396 default:
397 break;
398 }
399 return false;
400}
401
403 Align Alignment) const {
404 return !isLegalMaskedGather(VTy, Alignment);
405}
406
408 Align Alignment) const {
409 return !isLegalMaskedScatter(VTy, Alignment);
410}
411
412/// --- Vector TTI end ---
413
415 return ST.getL1PrefetchDistance();
416}
417
419 return ST.getL1CacheLineSize();
420}
421
425 TTI::TargetCostKind CostKind) const {
426 auto isCastFoldedIntoLoad = [this](const CastInst *CI) -> bool {
427 if (!CI->isIntegerCast())
428 return false;
429 // Only extensions from an integer type shorter than 32-bit to i32
430 // can be folded into the load.
431 const DataLayout &DL = getDataLayout();
432 unsigned SBW = DL.getTypeSizeInBits(CI->getSrcTy());
433 unsigned DBW = DL.getTypeSizeInBits(CI->getDestTy());
434 if (DBW != 32 || SBW >= DBW)
435 return false;
436
437 const LoadInst *LI = dyn_cast<const LoadInst>(CI->getOperand(0));
438 // Technically, this code could allow multiple uses of the load, and
439 // check if all the uses are the same extension operation, but this
440 // should be sufficient for most cases.
441 return LI && LI->hasOneUse();
442 };
443
444 if (const CastInst *CI = dyn_cast<const CastInst>(U))
445 if (isCastFoldedIntoLoad(CI))
447 return BaseT::getInstructionCost(U, Operands, CostKind);
448}
449
453
455 const Function *Callee) const {
456 // HVX contexts are a fixed hardware resource, held by threads dedicated to
457 // HVX. HVX reaching a thread without one stalls, and deadlocks if the two
458 // then meet at a barrier.
459 if (Caller->hasFnAttribute("hexagon_hmx") !=
460 Callee->hasFnAttribute("hexagon_hmx"))
461 return false;
462 if (Callee->hasFnAttribute("hexagon_hvx") &&
463 !Caller->hasFnAttribute("hexagon_hvx"))
464 return false;
465 return BaseT::areInlineCompatible(Caller, Callee);
466}
bool IsScalable
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static const unsigned FloatFactor
static cl::opt< bool > EnableV68FloatAutoHVX("force-hvx-float", cl::Hidden, cl::desc("Enable auto-vectorization of floatint point types on v68."))
cl::opt< bool > HexagonAllowScatterGatherHVX("hexagon-allow-scatter-gather-hvx", cl::init(false), cl::Hidden, cl::desc("Allow auto-generation of HVX scatter-gather"))
static cl::opt< bool > EmitLookupTables("hexagon-emit-lookup-tables", cl::init(true), cl::Hidden, cl::desc("Control lookup table emission on Hexagon target"))
static cl::opt< bool > HexagonMaskedVMem("hexagon-masked-vmem", cl::init(true), cl::Hidden, cl::desc("Enable masked loads/stores for HVX"))
static cl::opt< bool > HexagonAutoHVX("hexagon-autohvx", cl::init(false), cl::Hidden, cl::desc("Enable loop vectorizer for HVX"))
This file implements a TargetTransformInfo analysis pass specific to the Hexagon target machine.
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
uint64_t IntrinsicInst * II
SI Fold Operands
This pass exposes codegen information to IR-level passes.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
size_t size() const
Get the array size.
Definition ArrayRef.h:141
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false) const override
bool areInlineCompatible(const Function *Caller, const Function *Callee) const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
InstructionCost getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind) const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
std::pair< InstructionCost, MVT > getTypeLegalizationCost(Type *Ty) const
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const override
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Opd1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Opd2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CtxI=nullptr, const TargetLibraryInfo *TLibInfo=nullptr, ArrayRef< const Value * > Scalars={}) const override
This is the base class for all instructions that perform data casts.
Definition InstrTypes.h:512
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:63
static constexpr ElementCount getFixed(ScalarTy MinVal)
Definition TypeSize.h:306
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
bool forceScalarizeMaskedScatter(VectorType *VTy, Align Alignment) const override
bool isLegalMaskedStore(Type *DataType, Align Alignment, unsigned AddressSpace, TTI::MaskKind MaskKind) const override
ElementCount getMinimumVF(unsigned ElemWidth, bool IsScalable) const override
bool shouldExpandReduction(const IntrinsicInst *II) const override
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr) const override
bool forceScalarizeMaskedGather(VectorType *VTy, Align Alignment) const override
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false) const override
unsigned getNumberOfRegisters(unsigned ClassID) const override
— Vector TTI begin —
InstructionCost getAddressComputationCost(Type *PtrTy, ScalarEvolution *SE, const SCEV *S, TTI::TargetCostKind CostKind) const override
unsigned getMinVectorRegisterBitWidth() const override
bool isLegalMaskedLoad(Type *DataType, Align Alignment, unsigned AddressSpace, TTI::MaskKind MaskKind) const override
bool isLegalMaskedGather(Type *Ty, Align Alignment) const override
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const override
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CtxI=nullptr, const TargetLibraryInfo *TLibInfo=nullptr, ArrayRef< const Value * > Scalars={}) const override
InstructionCost getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind) const override
Compute a cost of the given call instruction.
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy, TTI::TargetCostKind CostKind, ArrayRef< int > Mask, int Index, VectorType *SubTp, ArrayRef< const Value * > Args={}, const Instruction *CtxI=nullptr, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) const override
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP) const override
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const override
Get intrinsic cost based on arguments.
TTI::AddressingModeKind getPreferredAddressingMode(const Loop *L, ScalarEvolution *SE) const override
Bias LSR towards creating post-increment opportunities.
bool shouldBuildLookupTables() const override
unsigned getMaxInterleaveFactor(ElementCount VF, bool HasUnorderedReductions) const override
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, const Value *Op0, const Value *Op1, TTI::VectorInstrContext VIC=TTI::VectorInstrContext::None) const override
bool isLegalMaskedScatter(Type *Ty, Align Alignment) const override
bool areInlineCompatible(const Function *Caller, const Function *Callee) const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Op2Info={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr) const override
InstructionCost getInstructionCost(const User *U, ArrayRef< const Value * > Operands, TTI::TargetCostKind CostKind) const override
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const override
unsigned getCacheLineSize() const override
unsigned getPrefetchDistance() const override
— Vector TTI end —
static InstructionCost getMax()
A wrapper class for inspecting calls to intrinsic functions.
An instruction for reading from memory.
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
The optimization diagnostic interface.
This class represents an analyzed expression in the program.
The main scalar evolution driver.
LLVM_ABI unsigned getSmallConstantMaxTripCount(const Loop *L, SmallVectorImpl< const SCEVPredicate * > *Predicates=nullptr)
Returns the upper bound of the loop trip count as a normal unsigned value.
LLVM_ABI unsigned getSmallConstantTripCount(const Loop *L)
Returns the exact trip count of the loop if we can compute it, and the result is a small constant.
Provides information about what library functions are available for the current target.
virtual const DataLayout & getDataLayout() const
virtual InstructionCost getInstructionCost(const User *U, ArrayRef< const Value * > Operands, TTI::TargetCostKind CostKind) const
MaskKind
Some targets only support masked load/store with a constant mask.
TargetCostKind
The kind of cost model.
@ TCK_RecipThroughput
Reciprocal throughput.
@ TCK_Latency
The latency of instruction.
llvm::VectorInstrContext VectorInstrContext
@ TCC_Free
Expected to fold away in lowering.
AddressingModeKind
Which addressing mode Loop Strength Reduction will try to generate.
@ AMK_PostIndexed
Prefer post-indexed addressing mode.
ShuffleKind
The various kinds of shuffle patterns for vector queries.
CastContextHint
Represents a hint about the context in which a cast is used.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
Definition TypeSize.h:352
static constexpr TypeSize getScalable(ScalarTy MinimumSize)
Definition TypeSize.h:355
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:283
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Definition Type.cpp:187
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition Type.h:186
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition Type.h:252
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition Type.h:222
LLVM Value Representation.
Definition Value.h:75
bool hasOneUse() const
Return true if there is exactly one use of this value.
Definition Value.h:441
Base class of all SIMD vector types.
Type * getElementType() const
constexpr ScalarTy getFixedValue() const
Definition TypeSize.h:201
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
InstructionCost Cost
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
LLVM_ABI bool canPeel(const Loop *L)
Definition LoopPeel.cpp:96
constexpr uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition Alignment.h:149
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
unsigned Log2(Align A)
Returns the log2 of the alignment.
Definition Alignment.h:202
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
constexpr uint64_t value() const
This is a hole in the type system and should not be abused.
Definition Alignment.h:82
unsigned PeelCount
A forced peeling factor (the number of bodied of the original loop that should be peeled off before t...
Parameters that control the generic loop unrolling transformation.