LLVM 20.0.0git
SystemZTargetTransformInfo.h
Go to the documentation of this file.
1//===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
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_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
10#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
11
15
16namespace llvm {
17
18class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
21 friend BaseT;
22
23 const SystemZSubtarget *ST;
24 const SystemZTargetLowering *TLI;
25
26 const SystemZSubtarget *getST() const { return ST; }
27 const SystemZTargetLowering *getTLI() const { return TLI; }
28
29 unsigned const LIBCALL_COST = 30;
30
31 bool isInt128InVR(Type *Ty) { return Ty->isIntegerTy(128) && ST->hasVector(); }
32
33public:
34 explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
35 : BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),
36 TLI(ST->getTargetLowering()) {}
37
38 /// \name Scalar TTI Implementations
39 /// @{
40
41 unsigned getInliningThresholdMultiplier() const { return 3; }
42 unsigned adjustInliningThreshold(const CallBase *CB) const;
43
46
47 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
48 const APInt &Imm, Type *Ty,
50 Instruction *Inst = nullptr);
52 const APInt &Imm, Type *Ty,
54
56
60
63
66 /// @}
67
68 /// \name Vector TTI Implementations
69 /// @{
70
71 unsigned getNumberOfRegisters(unsigned ClassID) const;
73
74 unsigned getCacheLineSize() const override { return 256; }
75 unsigned getPrefetchDistance() const override { return 4500; }
76 unsigned getMinPrefetchStride(unsigned NumMemAccesses,
77 unsigned NumStridedMemAccesses,
78 unsigned NumPrefetches,
79 bool HasCall) const override;
80 bool enableWritePrefetching() const override { return true; }
81
82 bool hasDivRemOp(Type *DataType, bool IsSigned);
83 bool prefersVectorizedAddressing() { return false; }
84 bool LSRWithInstrQueries() { return true; }
87
89 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
91 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
92 ArrayRef<const Value *> Args = std::nullopt,
93 const Instruction *CxtI = nullptr);
94 InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp,
95 ArrayRef<int> Mask,
97 VectorType *SubTp,
98 ArrayRef<const Value *> Args = std::nullopt,
99 const Instruction *CxtI = nullptr);
100 unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
101 unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
102 unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
103 const Instruction *I);
104 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
107 const Instruction *I = nullptr);
108 InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
109 CmpInst::Predicate VecPred,
111 const Instruction *I = nullptr);
113 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
115 unsigned Index, Value *Op0, Value *Op1);
116 bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
117 InstructionCost
118 getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
120 TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
121 const Instruction *I = nullptr);
122
123 InstructionCost getInterleavedMemoryOpCost(
124 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
125 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
126 bool UseMaskForCond = false, bool UseMaskForGaps = false);
127
128 InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
130
131 bool shouldExpandReduction(const IntrinsicInst *II) const;
132 /// @}
133};
134
135} // end namespace llvm
136
137#endif
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
static cl::opt< TargetTransformInfo::TargetCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(TargetTransformInfo::TCK_RecipThroughput), cl::values(clEnumValN(TargetTransformInfo::TCK_RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(TargetTransformInfo::TCK_Latency, "latency", "Instruction latency"), clEnumValN(TargetTransformInfo::TCK_CodeSize, "code-size", "Code size"), clEnumValN(TargetTransformInfo::TCK_SizeAndLatency, "size-latency", "Code size and latency")))
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
uint64_t IntrinsicInst * II
This pass exposes codegen information to IR-level passes.
Class for arbitrary precision integers.
Definition: APInt.h:78
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:81
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition: InstrTypes.h:1236
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:757
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:39
The optimization diagnostic interface.
The main scalar evolution driver.
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)
bool shouldExpandReduction(const IntrinsicInst *II) const
SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
bool enableWritePrefetching() const override
unsigned getNumberOfRegisters(unsigned ClassID) const
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst, const Instruction *I)
unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const override
unsigned getInliningThresholdMultiplier() const
unsigned adjustInliningThreshold(const CallBase *CB) const
unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy)
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)
unsigned getPrefetchDistance() const override
bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue)
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo={TTI::OK_AnyValue, TTI::OP_None}, const Instruction *I=nullptr)
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=std::nullopt, const Instruction *CxtI=nullptr)
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2)
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt, const Instruction *CxtI=nullptr)
unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy)
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr)
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
unsigned getCacheLineSize() const override
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
bool hasDivRemOp(Type *DataType, bool IsSigned)
const DataLayout & getDataLayout() const
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
TargetCostKind
The kind of cost model.
PopcntSupportKind
Flags indicating the kind of support for population count.
ShuffleKind
The various kinds of shuffle patterns for vector queries.
CastContextHint
Represents a hint about the context in which a cast is used.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:224
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
AddressSpace
Definition: NVPTXBaseInfo.h:21
Parameters that control the generic loop unrolling transformation.