LLVM 17.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
31public:
33 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
34 TLI(ST->getTargetLowering()) {}
35
36 /// \name Scalar TTI Implementations
37 /// @{
38
39 unsigned getInliningThresholdMultiplier() { return 3; }
40 unsigned adjustInliningThreshold(const CallBase *CB) const;
41
44
45 InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
46 const APInt &Imm, Type *Ty,
48 Instruction *Inst = nullptr);
50 const APInt &Imm, Type *Ty,
52
54
58
61
64 /// @}
65
66 /// \name Vector TTI Implementations
67 /// @{
68
69 unsigned getNumberOfRegisters(unsigned ClassID) const;
71
72 unsigned getCacheLineSize() const override { return 256; }
73 unsigned getPrefetchDistance() const override { return 4500; }
74 unsigned getMinPrefetchStride(unsigned NumMemAccesses,
75 unsigned NumStridedMemAccesses,
76 unsigned NumPrefetches,
77 bool HasCall) const override;
78 bool enableWritePrefetching() const override { return true; }
79
80 bool hasDivRemOp(Type *DataType, bool IsSigned);
81 bool prefersVectorizedAddressing() { return false; }
82 bool LSRWithInstrQueries() { return true; }
85
87 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
89 TTI::OperandValueInfo Op2Info = {TTI::OK_AnyValue, TTI::OP_None},
90 ArrayRef<const Value *> Args = ArrayRef<const Value *>(),
91 const Instruction *CxtI = nullptr);
92 InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp,
93 ArrayRef<int> Mask,
95 VectorType *SubTp,
96 ArrayRef<const Value *> Args = std::nullopt);
97 unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
98 unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
99 unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
100 const Instruction *I);
101 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
104 const Instruction *I = nullptr);
105 InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
106 CmpInst::Predicate VecPred,
108 const Instruction *I = nullptr);
110 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
112 unsigned Index, Value *Op0, Value *Op1);
113 bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
114 InstructionCost
115 getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
117 TTI::OperandValueInfo OpInfo = {TTI::OK_AnyValue, TTI::OP_None},
118 const Instruction *I = nullptr);
119
120 InstructionCost getInterleavedMemoryOpCost(
121 unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
122 Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
123 bool UseMaskForCond = false, bool UseMaskForGaps = false);
124
125 InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
127 /// @}
128};
129
130} // end namespace llvm
131
132#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:75
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:79
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:1184
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:718
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:547
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 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
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.