83
|
1 //===-- X86TargetTransformInfo.h - X86 specific TTI -------------*- C++ -*-===//
|
|
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 /// \file
|
|
10 /// This file a TargetTransformInfo::Concept conforming object specific to the
|
|
11 /// X86 target machine. It uses the target's detailed information to
|
|
12 /// provide more precise answers to certain TTI queries, while letting the
|
|
13 /// target independent and default TTI implementations handle the rest.
|
|
14 ///
|
|
15 //===----------------------------------------------------------------------===//
|
|
16
|
|
17 #ifndef LLVM_LIB_TARGET_X86_X86TARGETTRANSFORMINFO_H
|
|
18 #define LLVM_LIB_TARGET_X86_X86TARGETTRANSFORMINFO_H
|
|
19
|
|
20 #include "X86.h"
|
|
21 #include "X86TargetMachine.h"
|
|
22 #include "llvm/Analysis/TargetTransformInfo.h"
|
|
23 #include "llvm/CodeGen/BasicTTIImpl.h"
|
|
24 #include "llvm/Target/TargetLowering.h"
|
|
25
|
|
26 namespace llvm {
|
|
27
|
|
28 class X86TTIImpl : public BasicTTIImplBase<X86TTIImpl> {
|
|
29 typedef BasicTTIImplBase<X86TTIImpl> BaseT;
|
|
30 typedef TargetTransformInfo TTI;
|
|
31 friend BaseT;
|
|
32
|
|
33 const X86Subtarget *ST;
|
|
34 const X86TargetLowering *TLI;
|
|
35
|
95
|
36 int getScalarizationOverhead(Type *Ty, bool Insert, bool Extract);
|
83
|
37
|
|
38 const X86Subtarget *getST() const { return ST; }
|
|
39 const X86TargetLowering *getTLI() const { return TLI; }
|
|
40
|
|
41 public:
|
95
|
42 explicit X86TTIImpl(const X86TargetMachine *TM, const Function &F)
|
|
43 : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
|
44 TLI(ST->getTargetLowering()) {}
|
83
|
45
|
|
46 // Provide value semantics. MSVC requires that we spell all of these out.
|
|
47 X86TTIImpl(const X86TTIImpl &Arg)
|
|
48 : BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {}
|
|
49 X86TTIImpl(X86TTIImpl &&Arg)
|
|
50 : BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
|
51 TLI(std::move(Arg.TLI)) {}
|
|
52
|
|
53 /// \name Scalar TTI Implementations
|
|
54 /// @{
|
|
55 TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
|
|
56
|
|
57 /// @}
|
|
58
|
|
59 /// \name Vector TTI Implementations
|
|
60 /// @{
|
|
61
|
|
62 unsigned getNumberOfRegisters(bool Vector);
|
|
63 unsigned getRegisterBitWidth(bool Vector);
|
95
|
64 unsigned getMaxInterleaveFactor(unsigned VF);
|
|
65 int getArithmeticInstrCost(
|
83
|
66 unsigned Opcode, Type *Ty,
|
|
67 TTI::OperandValueKind Opd1Info = TTI::OK_AnyValue,
|
|
68 TTI::OperandValueKind Opd2Info = TTI::OK_AnyValue,
|
|
69 TTI::OperandValueProperties Opd1PropInfo = TTI::OP_None,
|
|
70 TTI::OperandValueProperties Opd2PropInfo = TTI::OP_None);
|
95
|
71 int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
|
|
72 int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src);
|
|
73 int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy);
|
|
74 int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
|
|
75 int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
|
|
76 unsigned AddressSpace);
|
|
77 int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
|
|
78 unsigned AddressSpace);
|
100
|
79 int getGatherScatterOpCost(unsigned Opcode, Type *DataTy, Value *Ptr,
|
|
80 bool VariableMask, unsigned Alignment);
|
95
|
81 int getAddressComputationCost(Type *PtrTy, bool IsComplex);
|
83
|
82
|
95
|
83 int getReductionCost(unsigned Opcode, Type *Ty, bool IsPairwiseForm);
|
83
|
84
|
95
|
85 int getIntImmCost(int64_t);
|
83
|
86
|
95
|
87 int getIntImmCost(const APInt &Imm, Type *Ty);
|
83
|
88
|
95
|
89 int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
|
|
90 int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
|
|
91 Type *Ty);
|
100
|
92 bool isLegalMaskedLoad(Type *DataType);
|
|
93 bool isLegalMaskedStore(Type *DataType);
|
|
94 bool isLegalMaskedGather(Type *DataType);
|
|
95 bool isLegalMaskedScatter(Type *DataType);
|
95
|
96 bool areInlineCompatible(const Function *Caller,
|
|
97 const Function *Callee) const;
|
100
|
98 private:
|
|
99 int getGSScalarCost(unsigned Opcode, Type *DataTy, bool VariableMask,
|
|
100 unsigned Alignment, unsigned AddressSpace);
|
|
101 int getGSVectorCost(unsigned Opcode, Type *DataTy, Value *Ptr,
|
|
102 unsigned Alignment, unsigned AddressSpace);
|
83
|
103
|
|
104 /// @}
|
|
105 };
|
|
106
|
|
107 } // end namespace llvm
|
|
108
|
|
109 #endif
|