LLVM 19.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:
35 : BaseT(TM, F.getParent()->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 = ArrayRef<const Value *>(),
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 unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
100 unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
101 unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
102 const Instruction *I);
103 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
106 const Instruction *I = nullptr);
107 InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
108 CmpInst::Predicate VecPred,
110 const Instruction *I = nullptr);
112 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
114 unsigned Index, Value *Op0, Value *Op1);
115 bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
116 InstructionCost
117 getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
119 TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
120 const Instruction *I = nullptr);
121
122 InstructionCost getInterleavedMemoryOpCost(
123 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
124 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
125 bool UseMaskForCond = false, bool UseMaskForGaps = false);
126
127 InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
129 /// @}
130};
131
132} // end namespace llvm
133
134#endif
static const Function * getParent(const Value *V)
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
const char LLVMTargetMachineRef TM
This pass exposes codegen information to IR-level passes.
Class for arbitrary precision integers.
Definition: APInt.h:76
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:80
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:1461
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:960
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:44
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)
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 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=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args=std::nullopt)
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)
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)
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:228
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.