LLVM  10.0.0svn
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);
42 
43  int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
44  int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
45  Type *Ty);
46 
47  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
48 
51 
54  /// @}
55 
56  /// \name Vector TTI Implementations
57  /// @{
58 
59  unsigned getNumberOfRegisters(unsigned ClassID) const;
60  unsigned getRegisterBitWidth(bool Vector) const;
61 
62  unsigned getCacheLineSize() const override { return 256; }
63  unsigned getPrefetchDistance() const override { return 2000; }
64  unsigned getMinPrefetchStride() const override { return 2048; }
65 
66  bool hasDivRemOp(Type *DataType, bool IsSigned);
67  bool prefersVectorizedAddressing() { return false; }
68  bool LSRWithInstrQueries() { return true; }
70  bool enableInterleavedAccessVectorization() { return true; }
71 
73  unsigned Opcode, Type *Ty,
79  int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
80  unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
81  unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
82  unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
83  const Instruction *I);
84  int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
85  const Instruction *I = nullptr);
86  int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
87  const Instruction *I = nullptr);
88  int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
89  bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
90  int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
91  unsigned AddressSpace, const Instruction *I = nullptr);
92 
93  int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
94  unsigned Factor,
95  ArrayRef<unsigned> Indices,
96  unsigned Alignment,
97  unsigned AddressSpace,
98  bool UseMaskForCond = false,
99  bool UseMaskForGaps = false);
100 
103  unsigned VF = 1);
106  unsigned ScalarizationCostPassed = UINT_MAX);
107  /// @}
108 };
109 
110 } // end namespace llvm
111 
112 #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:169
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:77
unsigned getPrefetchDistance() const override
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
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)
int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace, const Instruction *I=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)
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I=nullptr)
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst, const Instruction *I)
OperandValueProperties
Additional properties of an operand&#39;s values.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
unsigned getRegisterBitWidth(bool Vector) const
AddressSpace
Definition: NVPTXBaseInfo.h:21
int getIntImmCost(const APInt &Imm, Type *Ty)
unsigned getMinPrefetchStride() const override
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:509
Parameters that control the generic loop unrolling transformation.
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
#define I(x, y, z)
Definition: MD5.cpp:58
int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
int getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, ArrayRef< Value *> Args, FastMathFlags FMF, unsigned VF=1)
static const Function * getParent(const Value *V)
const DataLayout & getDataLayout() const
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:159
OperandValueKind
Additional information about an operand&#39;s possible values.
This pass exposes codegen information to IR-level passes.
bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue)
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
int getArithmeticInstrCost(unsigned Opcode, Type *Ty, 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 *>())
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned getCacheLineSize() const override
ShuffleKind
The various kinds of shuffle patterns for vector queries.
unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy)