LLVM  11.0.0git
PPCTargetTransformInfo.h
Go to the documentation of this file.
1 //===-- PPCTargetTransformInfo.h - PPC specific TTI -------------*- C++ -*-===//
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 /// \file
9 /// This file a TargetTransformInfo::Concept conforming object specific to the
10 /// PPC target machine. It uses the target's detailed information to
11 /// provide more precise answers to certain TTI queries, while letting the
12 /// target independent and default TTI implementations handle the rest.
13 ///
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETTRANSFORMINFO_H
17 #define LLVM_LIB_TARGET_POWERPC_PPCTARGETTRANSFORMINFO_H
18 
19 #include "PPCTargetMachine.h"
23 
24 namespace llvm {
25 
26 class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
28  typedef TargetTransformInfo TTI;
29  friend BaseT;
30 
31  const PPCSubtarget *ST;
32  const PPCTargetLowering *TLI;
33 
34  const PPCSubtarget *getST() const { return ST; }
35  const PPCTargetLowering *getTLI() const { return TLI; }
36  bool mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo,
38 
39 public:
40  explicit PPCTTIImpl(const PPCTargetMachine *TM, const Function &F)
41  : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
42  TLI(ST->getTargetLowering()) {}
43 
44  /// \name Scalar TTI Implementations
45  /// @{
46 
48  int getIntImmCost(const APInt &Imm, Type *Ty,
50 
51  int getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm,
52  Type *Ty, TTI::TargetCostKind CostKind);
53  int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
54  Type *Ty, TTI::TargetCostKind CostKind);
55 
57  TTI::TargetCostKind CostKind);
58 
59  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
61  AssumptionCache &AC,
62  TargetLibraryInfo *LibInfo,
63  HardwareLoopInfo &HWLoopInfo);
64  bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI,
66  TargetLibraryInfo *LibInfo);
71 
72  /// @}
73 
74  /// \name Vector TTI Implementations
75  /// @{
77  bool enableAggressiveInterleaving(bool LoopHasReductions);
79  bool IsZeroCmp) const;
81 
84  };
85  unsigned getNumberOfRegisters(unsigned ClassID) const;
86  unsigned getRegisterClassForType(bool Vector, Type *Ty = nullptr) const;
87  const char* getRegisterClassName(unsigned ClassID) const;
88  unsigned getRegisterBitWidth(bool Vector) const;
89  unsigned getCacheLineSize() const override;
90  unsigned getPrefetchDistance() const override;
91  unsigned getMaxInterleaveFactor(unsigned VF);
92  int vectorCostAdjustment(int Cost, unsigned Opcode, Type *Ty1, Type *Ty2);
94  unsigned Opcode, Type *Ty,
101  const Instruction *CxtI = nullptr);
102  int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
103  int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
104  TTI::TargetCostKind CostKind,
105  const Instruction *I = nullptr);
106  int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
107  TTI::TargetCostKind CostKind,
108  const Instruction *I = nullptr);
109  int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
110  int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
111  unsigned AddressSpace,
112  TTI::TargetCostKind CostKind,
113  const Instruction *I = nullptr);
114  int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
115  unsigned Factor,
116  ArrayRef<unsigned> Indices,
117  unsigned Alignment,
118  unsigned AddressSpace,
120  bool UseMaskForCond = false,
121  bool UseMaskForGaps = false);
123  TTI::TargetCostKind CostKind);
124 
125  /// @}
126 };
127 
128 } // end namespace llvm
129 
130 #endif
int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind=TTI::TCK_SizeAndLatency, bool UseMaskForCond=false, bool UseMaskForGaps=false)
bool useColdCCForColdCall(Function &F)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
unsigned getCacheLineSize() const override
The main scalar evolution driver.
A cache of @llvm.assume calls within a function.
F(f)
TTI::MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const
Base class which can be used to help build a TTI implementation.
Definition: BasicTTIImpl.h:76
int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
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")))
bool isLSRCostLess(TargetTransformInfo::LSRCost &C1, TargetTransformInfo::LSRCost &C2)
int getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
unsigned getUserCost(const User *U, ArrayRef< const Value *> Operands, TTI::TargetCostKind CostKind)
PPCTTIImpl(const PPCTargetMachine *TM, const Function &F)
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
mir Rename Register Operands
unsigned getMaxInterleaveFactor(unsigned VF)
int getIntImmCost(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
bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition: Dominators.h:144
The weighted sum of size and latency.
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
unsigned getRegisterBitWidth(bool Vector) const
Returns options for expansion of memcmp. IsZeroCmp is.
LLVM Basic Block Representation.
Definition: BasicBlock.h:57
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
Conditional or Unconditional Branch instruction.
unsigned getNumberOfRegisters(unsigned ClassID) const
This file provides a helper that implements much of the TTI interface in terms of the target-independ...
Attributes of a target dependent hardware loop.
Common code between 32-bit and 64-bit PowerPC targets.
OperandValueProperties
Additional properties of an operand&#39;s values.
const char * getRegisterClassName(unsigned ClassID) const
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
Provides information about what library functions are available for the current target.
AddressSpace
Definition: NVPTXBaseInfo.h:21
int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
bool enableAggressiveInterleaving(bool LoopHasReductions)
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)
void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, TTI::UnrollingPreferences &UP)
Class for arbitrary precision integers.
Definition: APInt.h:69
int vectorCostAdjustment(int Cost, unsigned Opcode, Type *Ty1, Type *Ty2)
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:516
Parameters that control the generic loop unrolling transformation.
#define I(x, y, z)
Definition: MD5.cpp:59
unsigned getIntImmCost(const APInt &Imm, Type *Ty, TTI::TargetCostKind CostKind)
unsigned getPrefetchDistance() const override
static const Function * getParent(const Value *V)
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)
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.
bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
unsigned getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)
This file describes how to lower LLVM code to machine code.
ShuffleKind
The various kinds of shuffle patterns for vector queries.