LLVM  11.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  int getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind);
42 
43  int getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm,
44  Type *Ty, TTI::TargetCostKind CostKind);
45  int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
46  Type *Ty, TTI::TargetCostKind CostKind);
47 
48  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
49 
52 
55 
58  /// @}
59 
60  /// \name Vector TTI Implementations
61  /// @{
62 
63  unsigned getNumberOfRegisters(unsigned ClassID) const;
64  unsigned getRegisterBitWidth(bool Vector) const;
65 
66  unsigned getCacheLineSize() const override { return 256; }
67  unsigned getPrefetchDistance() const override { return 4500; }
68  unsigned getMinPrefetchStride(unsigned NumMemAccesses,
69  unsigned NumStridedMemAccesses,
70  unsigned NumPrefetches,
71  bool HasCall) const override;
72  bool enableWritePrefetching() const override { return true; }
73 
74  bool hasDivRemOp(Type *DataType, bool IsSigned);
75  bool prefersVectorizedAddressing() { return false; }
76  bool LSRWithInstrQueries() { return true; }
78  bool enableInterleavedAccessVectorization() { return true; }
79 
81  unsigned Opcode, Type *Ty,
88  const Instruction *CxtI = nullptr);
90  VectorType *SubTp);
91  unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
92  unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
93  unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
94  const Instruction *I);
95  int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
96  TTI::TargetCostKind CostKind,
97  const Instruction *I = nullptr);
98  int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
99  TTI::TargetCostKind CostKind,
100  const Instruction *I = nullptr);
101  int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
102  bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
103  int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
104  unsigned AddressSpace, TTI::TargetCostKind CostKind,
105  const Instruction *I = nullptr);
106 
108  unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
109  Align Alignment, unsigned AddressSpace,
111  bool UseMaskForCond = false, bool UseMaskForGaps = false);
112 
114  TTI::TargetCostKind CostKind);
115  /// @}
116 };
117 
118 } // end namespace llvm
119 
120 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy)
SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1, TargetTransformInfo::LSRCost &C2)
The main scalar evolution driver.
F(f)
An instruction for reading from memory.
Definition: Instructions.h:173
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:76
unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const override
int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
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")))
unsigned getPrefetchDistance() const override
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
int getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
PopcntSupportKind
Flags indicating the kind of support for population count.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:32
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
The weighted sum of size and latency.
int getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
int 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)
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
bool hasDivRemOp(Type *DataType, bool IsSigned)
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
bool enableWritePrefetching() const override
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst, const Instruction *I)
OperandValueProperties
Additional properties of an operand&#39;s values.
int 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)
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment...
Definition: Alignment.h:119
unsigned getRegisterBitWidth(bool Vector) const
AddressSpace
Definition: NVPTXBaseInfo.h:21
Base class of all SIMD vector types.
Definition: DerivedTypes.h:390
Class for arbitrary precision integers.
Definition: APInt.h:69
unsigned getNumberOfRegisters(unsigned ClassID) const
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:516
Parameters that control the generic loop unrolling transformation.
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
#define I(x, y, z)
Definition: MD5.cpp:59
int getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
static const Function * getParent(const Value *V)
const DataLayout & getDataLayout() const
OperandValueKind
Additional information about an operand&#39;s possible values.
This pass exposes codegen information to IR-level passes.
TargetCostKind
The kind of cost model.
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, TTI::PeelingPreferences &PP)
int getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp, int Index, VectorType *SubTp)
bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned getCacheLineSize() const override
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
ShuffleKind
The various kinds of shuffle patterns for vector queries.
unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy)