LLVM  9.0.0svn
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 //===----------------------------------------------------------------------===//
19 #include "PPCTargetMachine.h"
24 namespace llvm {
26 class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
28  typedef TargetTransformInfo TTI;
29  friend BaseT;
31  const PPCSubtarget *ST;
32  const PPCTargetLowering *TLI;
34  const PPCSubtarget *getST() const { return ST; }
35  const PPCTargetLowering *getTLI() const { return TLI; }
36  bool mightUseCTR(BasicBlock *BB, TargetLibraryInfo *LibInfo);
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()) {}
43  /// \name Scalar TTI Implementations
44  /// @{
47  int getIntImmCost(const APInt &Imm, Type *Ty);
49  int getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm, Type *Ty);
50  int getIntImmCost(Intrinsic::ID IID, unsigned Idx, const APInt &Imm,
51  Type *Ty);
53  unsigned getUserCost(const User *U, ArrayRef<const Value *> Operands);
55  TTI::PopcntSupportKind getPopcntSupport(unsigned TyWidth);
57  AssumptionCache &AC,
58  TargetLibraryInfo *LibInfo,
59  HardwareLoopInfo &HWLoopInfo);
63  /// @}
65  /// \name Vector TTI Implementations
66  /// @{
68  bool enableAggressiveInterleaving(bool LoopHasReductions);
70  bool IsZeroCmp) const;
72  unsigned getNumberOfRegisters(bool Vector);
73  unsigned getRegisterBitWidth(bool Vector) const;
74  unsigned getCacheLineSize();
75  unsigned getPrefetchDistance();
76  unsigned getMaxInterleaveFactor(unsigned VF);
77  int vectorCostAdjustment(int Cost, unsigned Opcode, Type *Ty1, Type *Ty2);
79  unsigned Opcode, Type *Ty,
85  int getShuffleCost(TTI::ShuffleKind Kind, Type *Tp, int Index, Type *SubTp);
86  int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
87  const Instruction *I = nullptr);
88  int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
89  const Instruction *I = nullptr);
90  int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index);
91  int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
92  unsigned AddressSpace, const Instruction *I = nullptr);
93  int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
94  unsigned Factor,
95  ArrayRef<unsigned> Indices,
96  unsigned Alignment,
97  unsigned AddressSpace,
98  bool UseMaskForCond = false,
99  bool UseMaskForGaps = false);
101  /// @}
102 };
104 } // end namespace llvm
106 #endif
bool useColdCCForColdCall(Function &F)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
The main scalar evolution driver.
A cache of @llvm.assume calls within a function.
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)
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index)
unsigned getMaxInterleaveFactor(unsigned VF)
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)
const TTI::MemCmpExpansionOptions * enableMemCmpExpansion(bool IsZeroCmp) const
unsigned getRegisterBitWidth(bool Vector) const
If not nullptr, enable inline expansion of memcmp.
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:45
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 *>())
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.
unsigned getNumberOfRegisters(bool Vector)
Additional properties of an operand&#39;s values.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Provides information about what library functions are available for the current target.
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:467
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)
static const Function * getParent(const Value *V)
const DataLayout & getDataLayout() const
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.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file describes how to lower LLVM code to machine code.
int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace, const Instruction *I=nullptr)
The various kinds of shuffle patterns for vector queries.