]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / SystemZ / SystemZTargetTransformInfo.h
1 //===-- SystemZTargetTransformInfo.h - SystemZ-specific TTI ---------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
11 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZTARGETTRANSFORMINFO_H
12
13 #include "SystemZTargetMachine.h"
14 #include "llvm/Analysis/TargetTransformInfo.h"
15 #include "llvm/CodeGen/BasicTTIImpl.h"
16
17 namespace llvm {
18
19 class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
20   typedef BasicTTIImplBase<SystemZTTIImpl> BaseT;
21   typedef TargetTransformInfo TTI;
22   friend BaseT;
23
24   const SystemZSubtarget *ST;
25   const SystemZTargetLowering *TLI;
26
27   const SystemZSubtarget *getST() const { return ST; }
28   const SystemZTargetLowering *getTLI() const { return TLI; }
29
30   unsigned const LIBCALL_COST = 30;
31
32 public:
33   explicit SystemZTTIImpl(const SystemZTargetMachine *TM, const Function &F)
34       : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
35         TLI(ST->getTargetLowering()) {}
36
37   /// \name Scalar TTI Implementations
38   /// @{
39
40   unsigned getInliningThresholdMultiplier() { return 3; }
41
42   int getIntImmCost(const APInt &Imm, Type *Ty);
43
44   int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
45   int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
46                     Type *Ty);
47
48   TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
49
50   void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
51                                TTI::UnrollingPreferences &UP);
52
53   bool isLSRCostLess(TargetTransformInfo::LSRCost &C1,
54                      TargetTransformInfo::LSRCost &C2);
55   /// @}
56
57   /// \name Vector TTI Implementations
58   /// @{
59
60   unsigned getNumberOfRegisters(bool Vector);
61   unsigned getRegisterBitWidth(bool Vector) const;
62
63   unsigned getCacheLineSize() { return 256; }
64   unsigned getPrefetchDistance() { return 2000; }
65   unsigned getMinPrefetchStride() { return 2048; }
66
67   bool hasDivRemOp(Type *DataType, bool IsSigned);
68   bool prefersVectorizedAddressing() { return false; }
69   bool LSRWithInstrQueries() { return true; }
70   bool supportsEfficientVectorElementLoadStore() { return true; }
71   bool enableInterleavedAccessVectorization() { return true; }
72
73   int getArithmeticInstrCost(
74       unsigned Opcode, Type *Ty,
75       TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
76       TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
77       TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
78       TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None,
79       ArrayRef<const Value *> Args = ArrayRef<const Value *>());
80   int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
81   unsigned getVectorTruncCost(Type *SrcTy, Type *DstTy);
82   unsigned getVectorBitmaskConversionCost(Type *SrcTy, Type *DstTy);
83   unsigned getBoolVecToIntConversionCost(unsigned Opcode, Type *Dst,
84                                          const Instruction *I);
85   int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
86                        const Instruction *I = nullptr);
87   int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
88                          const Instruction *I = nullptr);
89   int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
90   bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
91   int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
92                       unsigned AddressSpace, const Instruction *I = nullptr);
93
94   int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
95                                  unsigned Factor,
96                                  ArrayRef<unsigned> Indices,
97                                  unsigned Alignment,
98                                  unsigned AddressSpace,
99                                  bool UseMaskForCond = false,
100                                  bool UseMaskForGaps = false);
101
102   int getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
103                             ArrayRef<Value *> Args, FastMathFlags FMF,
104                             unsigned VF = 1);
105   int getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
106                             ArrayRef<Type *> Tys, FastMathFlags FMF,
107                             unsigned ScalarizationCostPassed = UINT_MAX);
108   /// @}
109 };
110
111 } // end namespace llvm
112
113 #endif