LLVM  14.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 
12 #include "SystemZTargetMachine.h"
15 
16 namespace llvm {
17 
18 class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
20  typedef TargetTransformInfo TTI;
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 public:
32  explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
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 
41  InstructionCost getIntImmCost(const APInt &Imm, Type *Ty,
43 
44  InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx,
45  const APInt &Imm, Type *Ty,
47  Instruction *Inst = nullptr);
49  const APInt &Imm, Type *Ty,
51 
52  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
53 
57 
60 
63  /// @}
64 
65  /// \name Vector TTI Implementations
66  /// @{
67 
68  unsigned getNumberOfRegisters(unsigned ClassID) const;
70 
71  unsigned getCacheLineSize() const override { return 256; }
72  unsigned getPrefetchDistance() const override { return 4500; }
73  unsigned getMinPrefetchStride(unsigned NumMemAccesses,
74  unsigned NumStridedMemAccesses,
75  unsigned NumPrefetches,
76  bool HasCall) const override;
77  bool enableWritePrefetching() const override { return true; }
78 
79  bool hasDivRemOp(Type *DataType, bool IsSigned);
80  bool prefersVectorizedAddressing() { return false; }
81  bool LSRWithInstrQueries() { return true; }
83  bool enableInterleavedAccessVectorization() { return true; }
84 
86  unsigned Opcode, Type *Ty,
93  const Instruction *CxtI = nullptr);
96  VectorType *SubTp);
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);
109  InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
110  unsigned Index);
111  bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
112  InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src,
113  MaybeAlign Alignment, unsigned AddressSpace,
115  const Instruction *I = nullptr);
116 
118  unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
119  Align Alignment, unsigned AddressSpace,
121  bool UseMaskForCond = false, bool UseMaskForGaps = false);
122 
125  /// @}
126 };
127 
128 } // end namespace llvm
129 
130 #endif
llvm::SystemZTTIImpl::getInterleavedMemoryOpCost
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind=TTI::TCK_SizeAndLatency, bool UseMaskForCond=false, bool UseMaskForGaps=false)
Definition: SystemZTargetTransformInfo.cpp:1138
llvm::SystemZTTIImpl::enableWritePrefetching
bool enableWritePrefetching() const override
Definition: SystemZTargetTransformInfo.h:77
llvm::InstructionCost
Definition: InstructionCost.h:29
llvm::SystemZTTIImpl::enableInterleavedAccessVectorization
bool enableInterleavedAccessVectorization()
Definition: SystemZTargetTransformInfo.h:83
llvm::TargetTransformInfo::TargetCostKind
TargetCostKind
The kind of cost model.
Definition: TargetTransformInfo.h:211
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::SystemZTTIImpl::getBoolVecToIntConversionCost
unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst, const Instruction *I)
Definition: SystemZTargetTransformInfo.cpp:705
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition: InstrTypes.h:720
llvm::Function
Definition: Function.h:61
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:530
llvm::TargetTransformInfo::PopcntSupportKind
PopcntSupportKind
Flags indicating the kind of support for population count.
Definition: TargetTransformInfo.h:592
C1
instcombine should handle this C2 when C1
Definition: README.txt:263
llvm::SystemZTargetLowering
Definition: SystemZISelLowering.h:392
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:168
llvm::ScalarEvolution
The main scalar evolution driver.
Definition: ScalarEvolution.h:461
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::TargetTransformInfo::PeelingPreferences
Definition: TargetTransformInfo.h:535
llvm::BitmaskEnumDetail::Mask
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
llvm::SystemZTTIImpl::getNumberOfRegisters
unsigned getNumberOfRegisters(unsigned ClassID) const
Definition: SystemZTargetTransformInfo.cpp:318
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::TargetTransformInfoImplBase::getDataLayout
const DataLayout & getDataLayout() const
Definition: TargetTransformInfoImpl.h:48
llvm::SystemZTTIImpl::getVectorInstrCost
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
Definition: SystemZTargetTransformInfo.cpp:958
llvm::SystemZTTIImpl::getCastInstrCost
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Definition: SystemZTargetTransformInfo.cpp:721
llvm::TargetTransformInfo::OP_None
@ OP_None
Definition: TargetTransformInfo.h:886
llvm::TargetTransformInfo::ShuffleKind
ShuffleKind
The various kinds of shuffle patterns for vector queries.
Definition: TargetTransformInfo.h:859
llvm::TargetTransformInfo::CastContextHint
CastContextHint
Represents a hint about the context in which a cast is used.
Definition: TargetTransformInfo.h:1062
llvm::SystemZTTIImpl::LSRWithInstrQueries
bool LSRWithInstrQueries()
Definition: SystemZTargetTransformInfo.h:81
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
llvm::Instruction
Definition: Instruction.h:45
llvm::SystemZTTIImpl::getCacheLineSize
unsigned getCacheLineSize() const override
Definition: SystemZTargetTransformInfo.h:71
llvm::SystemZTTIImpl::getIntrinsicInstrCost
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
Definition: SystemZTargetTransformInfo.cpp:1200
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::AddressSpace
AddressSpace
Definition: NVPTXBaseInfo.h:21
llvm::SystemZTTIImpl::getCmpSelInstrCost
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Definition: SystemZTargetTransformInfo.cpp:873
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::IntrinsicCostAttributes
Definition: TargetTransformInfo.h:118
llvm::SystemZTTIImpl::getRegisterBitWidth
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const
Definition: SystemZTargetTransformInfo.cpp:330
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
llvm::SystemZTTIImpl::getArithmeticInstrCost
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, TTI::OperandValueKind Opd1Info=TTI::OK_AnyValue, TTI::OperandValueKind Opd2Info=TTI::OK_AnyValue, TTI::OperandValueProperties Opd1PropInfo=TTI::OP_None, TTI::OperandValueProperties Opd2PropInfo=TTI::OP_None, ArrayRef< const Value * > Args=ArrayRef< const Value * >(), const Instruction *CxtI=nullptr)
Definition: SystemZTargetTransformInfo.cpp:384
llvm::SystemZTTIImpl::getPeelingPreferences
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
Definition: SystemZTargetTransformInfo.cpp:301
SystemZTargetMachine.h
Index
uint32_t Index
Definition: ELFObjHandler.cpp:84
llvm::TargetTransformInfo::LSRCost
Definition: TargetTransformInfo.h:414
llvm::SystemZTTIImpl::isFoldableLoad
bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue)
Definition: SystemZTargetTransformInfo.cpp:980
llvm::SystemZTTIImpl::getVectorBitmaskConversionCost
unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy)
Definition: SystemZTargetTransformInfo.cpp:654
llvm::TargetTransformInfo::UnrollingPreferences
Parameters that control the generic loop unrolling transformation.
Definition: TargetTransformInfo.h:428
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::TargetTransformInfo::OperandValueProperties
OperandValueProperties
Additional properties of an operand's values.
Definition: TargetTransformInfo.h:886
llvm::SystemZTTIImpl::getVectorTruncCost
unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy)
Definition: SystemZTargetTransformInfo.cpp:612
llvm::SystemZTargetMachine
Definition: SystemZTargetMachine.h:27
llvm::BasicTTIImplBase
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:77
llvm::SystemZTTIImpl::getShuffleCost
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, int Index, VectorType *SubTp)
Definition: SystemZTargetTransformInfo.cpp:559
llvm::SystemZTTIImpl::isLSRCostLess
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1, TargetTransformInfo::LSRCost &C2)
Definition: SystemZTargetTransformInfo.cpp:306
llvm::SystemZSubtarget
Definition: SystemZSubtarget.h:33
llvm::SystemZTTIImpl
Definition: SystemZTargetTransformInfo.h:18
llvm::TargetTransformInfo::OperandValueKind
OperandValueKind
Additional information about an operand's possible values.
Definition: TargetTransformInfo.h:878
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::SystemZTTIImpl::SystemZTTIImpl
SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
Definition: SystemZTargetTransformInfo.h:32
llvm::SystemZTTIImpl::getIntImmCost
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
Definition: SystemZTargetTransformInfo.cpp:33
llvm::SystemZTTIImpl::getInliningThresholdMultiplier
unsigned getInliningThresholdMultiplier()
Definition: SystemZTargetTransformInfo.h:39
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::SystemZTTIImpl::getIntImmCostIntrin
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
Definition: SystemZTargetTransformInfo.cpp:187
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition: OptimizationRemarkEmitter.h:33
llvm::TargetTransformInfo::TCK_SizeAndLatency
@ TCK_SizeAndLatency
The weighted sum of size and latency.
Definition: TargetTransformInfo.h:215
CostKind
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")))
getParent
static const Function * getParent(const Value *V)
Definition: BasicAliasAnalysis.cpp:776
llvm::TargetTransformInfo::OK_AnyValue
@ OK_AnyValue
Definition: TargetTransformInfo.h:879
llvm::LoadInst
An instruction for reading from memory.
Definition: Instructions.h:175
llvm::SystemZTTIImpl::getMinPrefetchStride
unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const override
Definition: SystemZTargetTransformInfo.cpp:343
llvm::TypeSize
Definition: TypeSize.h:417
llvm::SystemZTTIImpl::getMemoryOpCost
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
Definition: SystemZTargetTransformInfo.cpp:1067
llvm::SystemZTTIImpl::getPrefetchDistance
unsigned getPrefetchDistance() const override
Definition: SystemZTargetTransformInfo.h:72
llvm::TargetTransformInfo::RegisterKind
RegisterKind
Definition: TargetTransformInfo.h:907
llvm::SystemZTTIImpl::supportsEfficientVectorElementLoadStore
bool supportsEfficientVectorElementLoadStore()
Definition: SystemZTargetTransformInfo.h:82
TargetTransformInfo.h
llvm::SystemZTTIImpl::getPopcntSupport
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
Definition: SystemZTargetTransformInfo.cpp:238
llvm::SystemZTTIImpl::getIntImmCostInst
InstructionCost getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind, Instruction *Inst=nullptr)
Definition: SystemZTargetTransformInfo.cpp:66
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::SystemZTTIImpl::prefersVectorizedAddressing
bool prefersVectorizedAddressing()
Definition: SystemZTargetTransformInfo.h:80
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
BasicTTIImpl.h
llvm::SystemZTTIImpl::hasDivRemOp
bool hasDivRemOp(Type *DataType, bool IsSigned)
Definition: SystemZTargetTransformInfo.cpp:360
llvm::SystemZTTIImpl::getUnrollingPreferences
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)
Definition: SystemZTargetTransformInfo.cpp:245
llvm::TargetTransformInfo::TCK_RecipThroughput
@ TCK_RecipThroughput
Reciprocal throughput.
Definition: TargetTransformInfo.h:212
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37