LLVM  3.7.0
X86TargetTransformInfo.h
Go to the documentation of this file.
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"
25 
26 namespace llvm {
27 
28 class X86TTIImpl : public BasicTTIImplBase<X86TTIImpl> {
30  typedef TargetTransformInfo TTI;
31  friend BaseT;
32 
33  const X86Subtarget *ST;
34  const X86TargetLowering *TLI;
35 
36  unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract);
37 
38  const X86Subtarget *getST() const { return ST; }
39  const X86TargetLowering *getTLI() const { return TLI; }
40 
41 public:
43  : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
44  TLI(ST->getTargetLowering()) {}
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) {}
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);
64  unsigned getMaxInterleaveFactor(unsigned VF);
65  unsigned getArithmeticInstrCost(
66  unsigned Opcode, Type *Ty,
71  unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index,
72  Type *SubTp);
73  unsigned getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src);
74  unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy);
75  unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
76  unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
77  unsigned AddressSpace);
78  unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
79  unsigned AddressSpace);
80 
81  unsigned getAddressComputationCost(Type *PtrTy, bool IsComplex);
82 
83  unsigned getReductionCost(unsigned Opcode, Type *Ty, bool IsPairwiseForm);
84 
85  unsigned getIntImmCost(int64_t);
86 
87  unsigned getIntImmCost(const APInt &Imm, Type *Ty);
88 
89  unsigned getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm,
90  Type *Ty);
91  unsigned getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
92  Type *Ty);
93  bool isLegalMaskedLoad(Type *DataType, int Consecutive);
94  bool isLegalMaskedStore(Type *DataType, int Consecutive);
95  bool hasCompatibleFunctionAttributes(const Function *Caller,
96  const Function *Callee) const;
97 
98  /// @}
99 };
100 
101 } // end namespace llvm
102 
103 #endif
unsigned getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy)
unsigned getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
unsigned getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace)
F(f)
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:40
unsigned getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
unsigned getNumberOfRegisters(bool Vector)
unsigned getMaxInterleaveFactor(unsigned VF)
X86TTIImpl(X86TTIImpl &&Arg)
unsigned getIntImmCost(int64_t)
Calculate the cost of materializing a 64-bit value.
unsigned getReductionCost(unsigned Opcode, Type *Ty, bool IsPairwiseForm)
unsigned getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src)
X86TTIImpl(const X86TTIImpl &Arg)
PopcntSupportKind
Flags indicating the kind of support for population count.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
bool isLegalMaskedStore(Type *DataType, int Consecutive)
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
X86TTIImpl(const X86TargetMachine *TM, Function &F)
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
OperandValueProperties
Additional properties of an operand's values.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
AddressSpace
Definition: NVPTXBaseInfo.h:22
bool hasCompatibleFunctionAttributes(const Function *Caller, const Function *Callee) const
Class for arbitrary precision integers.
Definition: APInt.h:73
unsigned getRegisterBitWidth(bool Vector)
const DataLayout & getDataLayout() const
unsigned 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)
unsigned getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace)
const ARM::ArchExtKind Kind
aarch64 promote const
static const Function * getParent(const Value *V)
OperandValueKind
Additional information about an operand's possible values.
This pass exposes codegen information to IR-level passes.
unsigned getAddressComputationCost(Type *PtrTy, bool IsComplex)
This file describes how to lower LLVM code to machine code.
bool isLegalMaskedLoad(Type *DataType, int Consecutive)
ShuffleKind
The various kinds of shuffle patterns for vector queries.