LLVM  10.0.0
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);
37 
38 public:
39  explicit PPCTTIImpl(const PPCTargetMachine *TM, const Function &F)
40  : BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
41  TLI(ST->getTargetLowering()) {}
42 
43  /// \name Scalar TTI Implementations
44  /// @{
45 
47  int getIntImmCost(const APInt &Imm, Type *Ty);
48 
49  int getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm,
50  Type *Ty);
51  int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
52  Type *Ty);
53 
55 
56  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
58  AssumptionCache &AC,
59  TargetLibraryInfo *LibInfo,
60  HardwareLoopInfo &HWLoopInfo);
61  bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI,
63  TargetLibraryInfo *LibInfo);
66 
67  /// @}
68 
69  /// \name Vector TTI Implementations
70  /// @{
72  bool enableAggressiveInterleaving(bool LoopHasReductions);
74  bool IsZeroCmp) const;
76 
79  };
80  unsigned getNumberOfRegisters(unsigned ClassID) const;
81  unsigned getRegisterClassForType(bool Vector, Type *Ty = nullptr) const;
82  const char* getRegisterClassName(unsigned ClassID) const;
83  unsigned getRegisterBitWidth(bool Vector) const;
84  unsigned getCacheLineSize() const override;
85  unsigned getPrefetchDistance() const override;
86  unsigned getMaxInterleaveFactor(unsigned VF);
87  int vectorCostAdjustment(int Cost, unsigned Opcode, Type *Ty1, Type *Ty2);
89  unsigned Opcode, Type *Ty,
95  const Instruction *CxtI = nullptr);
96  int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
97  int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
98  const Instruction *I = nullptr);
99  int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
100  const Instruction *I = nullptr);
101  int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
102  int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment,
103  unsigned AddressSpace, const Instruction *I = nullptr);
104  int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
105  unsigned Factor,
106  ArrayRef<unsigned> Indices,
107  unsigned Alignment,
108  unsigned AddressSpace,
109  bool UseMaskForCond = false,
110  bool UseMaskForGaps = false);
111  unsigned getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
112  ArrayRef<Value*> Args, FastMathFlags FMF, unsigned VF);
113  unsigned getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy,
115  unsigned ScalarizationCostPassed = UINT_MAX);
116 
117  /// @}
118 };
119 
120 } // end namespace llvm
121 
122 #endif
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:77
unsigned getIntImmCost(const APInt &Imm, Type *Ty)
int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp)
unsigned getUserCost(const User *U, ArrayRef< const Value *> Operands)
int getIntImmCost(const APInt &Imm, Type *Ty)
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 getIntImmCostInst(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty)
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
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 *>(), const Instruction *CxtI=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
int getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty)
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:117
Provides information about what library functions are available for the current target.
AddressSpace
Definition: NVPTXBaseInfo.h:21
bool enableAggressiveInterleaving(bool LoopHasReductions)
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)
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, const Instruction *I=nullptr)
TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth)
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:509
Parameters that control the generic loop unrolling transformation.
#define I(x, y, z)
Definition: MD5.cpp:58
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, const Instruction *I=nullptr)
unsigned getPrefetchDistance() const override
static const Function * getParent(const Value *V)
const DataLayout & getDataLayout() const
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:160
OperandValueKind
Additional information about an operand&#39;s possible values.
int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond=false, bool UseMaskForGaps=false)
This pass exposes codegen information to IR-level passes.
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(Intrinsic::ID ID, Type *RetTy, ArrayRef< Value *> Args, FastMathFlags FMF, unsigned VF)
This file describes how to lower LLVM code to machine code.
ShuffleKind
The various kinds of shuffle patterns for vector queries.
int getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, const Instruction *I=nullptr)