LLVM  4.0.0
TargetTransformInfo.cpp
Go to the documentation of this file.
1 //===- llvm/Analysis/TargetTransformInfo.cpp ------------------------------===//
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 
12 #include "llvm/IR/CallSite.h"
13 #include "llvm/IR/DataLayout.h"
14 #include "llvm/IR/Instruction.h"
15 #include "llvm/IR/Instructions.h"
16 #include "llvm/IR/IntrinsicInst.h"
17 #include "llvm/IR/Module.h"
18 #include "llvm/IR/Operator.h"
20 #include <utility>
21 
22 using namespace llvm;
23 
24 #define DEBUG_TYPE "tti"
25 
26 namespace {
27 /// \brief No-op implementation of the TTI interface using the utility base
28 /// classes.
29 ///
30 /// This is used when no target specific information is available.
31 struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
32  explicit NoTTIImpl(const DataLayout &DL)
34 };
35 }
36 
38  : TTIImpl(new Model<NoTTIImpl>(NoTTIImpl(DL))) {}
39 
41 
43  : TTIImpl(std::move(Arg.TTIImpl)) {}
44 
46  TTIImpl = std::move(RHS.TTIImpl);
47  return *this;
48 }
49 
51  Type *OpTy) const {
52  int Cost = TTIImpl->getOperationCost(Opcode, Ty, OpTy);
53  assert(Cost >= 0 && "TTI should not produce negative costs!");
54  return Cost;
55 }
56 
57 int TargetTransformInfo::getCallCost(FunctionType *FTy, int NumArgs) const {
58  int Cost = TTIImpl->getCallCost(FTy, NumArgs);
59  assert(Cost >= 0 && "TTI should not produce negative costs!");
60  return Cost;
61 }
62 
64  ArrayRef<const Value *> Arguments) const {
65  int Cost = TTIImpl->getCallCost(F, Arguments);
66  assert(Cost >= 0 && "TTI should not produce negative costs!");
67  return Cost;
68 }
69 
71  return TTIImpl->getInliningThresholdMultiplier();
72 }
73 
74 int TargetTransformInfo::getGEPCost(Type *PointeeType, const Value *Ptr,
75  ArrayRef<const Value *> Operands) const {
76  return TTIImpl->getGEPCost(PointeeType, Ptr, Operands);
77 }
78 
80  Intrinsic::ID IID, Type *RetTy, ArrayRef<const Value *> Arguments) const {
81  int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments);
82  assert(Cost >= 0 && "TTI should not produce negative costs!");
83  return Cost;
84 }
85 
87  int Cost = TTIImpl->getUserCost(U);
88  assert(Cost >= 0 && "TTI should not produce negative costs!");
89  return Cost;
90 }
91 
93  return TTIImpl->hasBranchDivergence();
94 }
95 
97  return TTIImpl->isSourceOfDivergence(V);
98 }
99 
101  return TTIImpl->isLoweredToCall(F);
102 }
103 
105  Loop *L, UnrollingPreferences &UP) const {
106  return TTIImpl->getUnrollingPreferences(L, UP);
107 }
108 
110  return TTIImpl->isLegalAddImmediate(Imm);
111 }
112 
114  return TTIImpl->isLegalICmpImmediate(Imm);
115 }
116 
118  int64_t BaseOffset,
119  bool HasBaseReg,
120  int64_t Scale,
121  unsigned AddrSpace) const {
122  return TTIImpl->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg,
123  Scale, AddrSpace);
124 }
125 
127  return TTIImpl->isLegalMaskedStore(DataType);
128 }
129 
131  return TTIImpl->isLegalMaskedLoad(DataType);
132 }
133 
135  return TTIImpl->isLegalMaskedGather(DataType);
136 }
137 
139  return TTIImpl->isLegalMaskedGather(DataType);
140 }
141 
143  int64_t BaseOffset,
144  bool HasBaseReg,
145  int64_t Scale,
146  unsigned AddrSpace) const {
147  int Cost = TTIImpl->getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg,
148  Scale, AddrSpace);
149  assert(Cost >= 0 && "TTI should not produce negative costs!");
150  return Cost;
151 }
152 
154  int64_t Offset) const {
155  return TTIImpl->isFoldableMemAccessOffset(I, Offset);
156 }
157 
159  return TTIImpl->isTruncateFree(Ty1, Ty2);
160 }
161 
163  return TTIImpl->isProfitableToHoist(I);
164 }
165 
167  return TTIImpl->isTypeLegal(Ty);
168 }
169 
171  return TTIImpl->getJumpBufAlignment();
172 }
173 
175  return TTIImpl->getJumpBufSize();
176 }
177 
179  return TTIImpl->shouldBuildLookupTables();
180 }
182  return TTIImpl->shouldBuildLookupTablesForConstant(C);
183 }
184 
185 bool TargetTransformInfo::enableAggressiveInterleaving(bool LoopHasReductions) const {
186  return TTIImpl->enableAggressiveInterleaving(LoopHasReductions);
187 }
188 
190  return TTIImpl->enableInterleavedAccessVectorization();
191 }
192 
194  return TTIImpl->isFPVectorizationPotentiallyUnsafe();
195 }
196 
198  unsigned BitWidth,
199  unsigned AddressSpace,
200  unsigned Alignment,
201  bool *Fast) const {
202  return TTIImpl->allowsMisalignedMemoryAccesses(Context, BitWidth, AddressSpace,
203  Alignment, Fast);
204 }
205 
207 TargetTransformInfo::getPopcntSupport(unsigned IntTyWidthInBit) const {
208  return TTIImpl->getPopcntSupport(IntTyWidthInBit);
209 }
210 
212  return TTIImpl->haveFastSqrt(Ty);
213 }
214 
216  int Cost = TTIImpl->getFPOpCost(Ty);
217  assert(Cost >= 0 && "TTI should not produce negative costs!");
218  return Cost;
219 }
220 
221 int TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode, unsigned Idx,
222  const APInt &Imm,
223  Type *Ty) const {
224  int Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty);
225  assert(Cost >= 0 && "TTI should not produce negative costs!");
226  return Cost;
227 }
228 
229 int TargetTransformInfo::getIntImmCost(const APInt &Imm, Type *Ty) const {
230  int Cost = TTIImpl->getIntImmCost(Imm, Ty);
231  assert(Cost >= 0 && "TTI should not produce negative costs!");
232  return Cost;
233 }
234 
235 int TargetTransformInfo::getIntImmCost(unsigned Opcode, unsigned Idx,
236  const APInt &Imm, Type *Ty) const {
237  int Cost = TTIImpl->getIntImmCost(Opcode, Idx, Imm, Ty);
238  assert(Cost >= 0 && "TTI should not produce negative costs!");
239  return Cost;
240 }
241 
243  const APInt &Imm, Type *Ty) const {
244  int Cost = TTIImpl->getIntImmCost(IID, Idx, Imm, Ty);
245  assert(Cost >= 0 && "TTI should not produce negative costs!");
246  return Cost;
247 }
248 
249 unsigned TargetTransformInfo::getNumberOfRegisters(bool Vector) const {
250  return TTIImpl->getNumberOfRegisters(Vector);
251 }
252 
253 unsigned TargetTransformInfo::getRegisterBitWidth(bool Vector) const {
254  return TTIImpl->getRegisterBitWidth(Vector);
255 }
256 
258  return TTIImpl->getCacheLineSize();
259 }
260 
262  return TTIImpl->getPrefetchDistance();
263 }
264 
266  return TTIImpl->getMinPrefetchStride();
267 }
268 
270  return TTIImpl->getMaxPrefetchIterationsAhead();
271 }
272 
273 unsigned TargetTransformInfo::getMaxInterleaveFactor(unsigned VF) const {
274  return TTIImpl->getMaxInterleaveFactor(VF);
275 }
276 
278  unsigned Opcode, Type *Ty, OperandValueKind Opd1Info,
279  OperandValueKind Opd2Info, OperandValueProperties Opd1PropInfo,
280  OperandValueProperties Opd2PropInfo,
282  int Cost = TTIImpl->getArithmeticInstrCost(Opcode, Ty, Opd1Info, Opd2Info,
283  Opd1PropInfo, Opd2PropInfo, Args);
284  assert(Cost >= 0 && "TTI should not produce negative costs!");
285  return Cost;
286 }
287 
289  Type *SubTp) const {
290  int Cost = TTIImpl->getShuffleCost(Kind, Ty, Index, SubTp);
291  assert(Cost >= 0 && "TTI should not produce negative costs!");
292  return Cost;
293 }
294 
295 int TargetTransformInfo::getCastInstrCost(unsigned Opcode, Type *Dst,
296  Type *Src) const {
297  int Cost = TTIImpl->getCastInstrCost(Opcode, Dst, Src);
298  assert(Cost >= 0 && "TTI should not produce negative costs!");
299  return Cost;
300 }
301 
303  VectorType *VecTy,
304  unsigned Index) const {
305  int Cost = TTIImpl->getExtractWithExtendCost(Opcode, Dst, VecTy, Index);
306  assert(Cost >= 0 && "TTI should not produce negative costs!");
307  return Cost;
308 }
309 
310 int TargetTransformInfo::getCFInstrCost(unsigned Opcode) const {
311  int Cost = TTIImpl->getCFInstrCost(Opcode);
312  assert(Cost >= 0 && "TTI should not produce negative costs!");
313  return Cost;
314 }
315 
316 int TargetTransformInfo::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
317  Type *CondTy) const {
318  int Cost = TTIImpl->getCmpSelInstrCost(Opcode, ValTy, CondTy);
319  assert(Cost >= 0 && "TTI should not produce negative costs!");
320  return Cost;
321 }
322 
324  unsigned Index) const {
325  int Cost = TTIImpl->getVectorInstrCost(Opcode, Val, Index);
326  assert(Cost >= 0 && "TTI should not produce negative costs!");
327  return Cost;
328 }
329 
330 int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src,
331  unsigned Alignment,
332  unsigned AddressSpace) const {
333  int Cost = TTIImpl->getMemoryOpCost(Opcode, Src, Alignment, AddressSpace);
334  assert(Cost >= 0 && "TTI should not produce negative costs!");
335  return Cost;
336 }
337 
339  unsigned Alignment,
340  unsigned AddressSpace) const {
341  int Cost =
342  TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace);
343  assert(Cost >= 0 && "TTI should not produce negative costs!");
344  return Cost;
345 }
346 
348  Value *Ptr, bool VariableMask,
349  unsigned Alignment) const {
350  int Cost = TTIImpl->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
351  Alignment);
352  assert(Cost >= 0 && "TTI should not produce negative costs!");
353  return Cost;
354 }
355 
357  unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
358  unsigned Alignment, unsigned AddressSpace) const {
359  int Cost = TTIImpl->getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
360  Alignment, AddressSpace);
361  assert(Cost >= 0 && "TTI should not produce negative costs!");
362  return Cost;
363 }
364 
366  ArrayRef<Type *> Tys,
367  FastMathFlags FMF) const {
368  int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Tys, FMF);
369  assert(Cost >= 0 && "TTI should not produce negative costs!");
370  return Cost;
371 }
372 
375  FastMathFlags FMF) const {
376  int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Args, FMF);
377  assert(Cost >= 0 && "TTI should not produce negative costs!");
378  return Cost;
379 }
380 
382  ArrayRef<Type *> Tys) const {
383  int Cost = TTIImpl->getCallInstrCost(F, RetTy, Tys);
384  assert(Cost >= 0 && "TTI should not produce negative costs!");
385  return Cost;
386 }
387 
389  return TTIImpl->getNumberOfParts(Tp);
390 }
391 
393  ScalarEvolution *SE,
394  const SCEV *Ptr) const {
395  int Cost = TTIImpl->getAddressComputationCost(Tp, SE, Ptr);
396  assert(Cost >= 0 && "TTI should not produce negative costs!");
397  return Cost;
398 }
399 
401  bool IsPairwiseForm) const {
402  int Cost = TTIImpl->getReductionCost(Opcode, Ty, IsPairwiseForm);
403  assert(Cost >= 0 && "TTI should not produce negative costs!");
404  return Cost;
405 }
406 
407 unsigned
409  return TTIImpl->getCostOfKeepingLiveOverCall(Tys);
410 }
411 
413  MemIntrinsicInfo &Info) const {
414  return TTIImpl->getTgtMemIntrinsic(Inst, Info);
415 }
416 
418  IntrinsicInst *Inst, Type *ExpectedType) const {
419  return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType);
420 }
421 
423  const Function *Callee) const {
424  return TTIImpl->areInlineCompatible(Caller, Callee);
425 }
426 
428  return TTIImpl->getLoadStoreVecRegBitWidth(AS);
429 }
430 
432  return TTIImpl->isLegalToVectorizeLoad(LI);
433 }
434 
436  return TTIImpl->isLegalToVectorizeStore(SI);
437 }
438 
440  unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const {
441  return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
442  AddrSpace);
443 }
444 
446  unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const {
447  return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
448  AddrSpace);
449 }
450 
452  unsigned LoadSize,
453  unsigned ChainSizeInBytes,
454  VectorType *VecTy) const {
455  return TTIImpl->getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy);
456 }
457 
459  unsigned StoreSize,
460  unsigned ChainSizeInBytes,
461  VectorType *VecTy) const {
462  return TTIImpl->getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy);
463 }
464 
466 
467 TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI) {}
468 
470  std::function<Result(const Function &)> TTICallback)
471  : TTICallback(std::move(TTICallback)) {}
472 
475  return TTICallback(F);
476 }
477 
478 AnalysisKey TargetIRAnalysis::Key;
479 
480 TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(const Function &F) {
481  return Result(F.getParent()->getDataLayout());
482 }
483 
484 // Register the basic pass.
486  "Target Transform Information", false, true)
488 
489 void TargetTransformInfoWrapperPass::anchor() {}
490 
492  : ImmutablePass(ID) {
495 }
496 
498  TargetIRAnalysis TIRA)
499  : ImmutablePass(ID), TIRA(std::move(TIRA)) {
502 }
503 
505  FunctionAnalysisManager DummyFAM;
506  TTI = TIRA.run(F, DummyFAM);
507  return *TTI;
508 }
509 
512  return new TargetTransformInfoWrapperPass(std::move(TIRA));
513 }
MachineLoop * L
bool shouldBuildLookupTablesForConstant(Constant *C) const
Return true if switches should be turned into lookup tables containing this constant value for the ta...
bool enableInterleavedAccessVectorization() const
Enable matching of interleaved access groups.
PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const
Return hardware support for population count.
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:102
bool isFPVectorizationPotentiallyUnsafe() const
Indicate that it is potentially unsafe to automatically vectorize floating-point operations because t...
int getGatherScatterOpCost(unsigned Opcode, Type *DataTy, Value *Ptr, bool VariableMask, unsigned Alignment) const
bool isLegalMaskedStore(Type *DataType) const
Return true if the target supports masked load/store AVX2 and AVX-512 targets allow masks for consecu...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVMContext & Context
TargetTransformInfo & operator=(TargetTransformInfo &&RHS)
bool isSourceOfDivergence(const Value *V) const
Returns whether V is a source of divergence.
bool isLegalToVectorizeLoad(LoadInst *LI) const
unsigned getStoreVectorFactor(unsigned VF, unsigned StoreSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const
bool isLegalToVectorizeStore(StoreInst *SI) const
bool hasBranchDivergence() const
Return true if branch divergence exists.
int getMaskedMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace) const
The main scalar evolution driver.
TargetTransformInfoWrapperPass()
We must provide a default constructor for the pass but it should never be used.
unsigned getJumpBufSize() const
Returns the target's jmp_buf size in bytes.
ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
unsigned getMaxInterleaveFactor(unsigned VF) const
bool allowsMisalignedMemoryAccesses(LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace=0, unsigned Alignment=1, bool *Fast=nullptr) const
Determine if the target supports unaligned memory accesses.
Analysis pass providing the TargetTransformInfo.
int getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands) const
Estimate the cost of a GEP operation when lowered.
unsigned getNumberOfParts(Type *Tp) const
An instruction for reading from memory.
Definition: Instructions.h:164
int getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, const APInt &Imm, Type *Ty) const
Return the expected cost for the given integer when optimising for size.
bool isLegalAddImmediate(int64_t Imm) const
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
unsigned getMaxPrefetchIterationsAhead() const
This file provides helpers for the implementation of a TargetTransformInfo-conforming class...
CRTP base class for use as a mix-in that aids implementing a TargetTransformInfo-compatible class...
bool isLegalMaskedGather(Type *DataType) const
unsigned getInliningThresholdMultiplier() const
bool isLegalMaskedScatter(Type *DataType) const
Return true if the target supports masked gather/scatter AVX-512 fully supports gather and scatter fo...
Class to represent function types.
Definition: DerivedTypes.h:102
#define F(x, y, z)
Definition: MD5.cpp:51
unsigned getLoadVectorFactor(unsigned VF, unsigned LoadSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
bool isTypeLegal(Type *Ty) const
Return true if this type is legal.
PopcntSupportKind
Flags indicating the kind of support for population count.
unsigned getRegisterBitWidth(bool Vector) const
int getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment, unsigned AddressSpace) const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
An instruction for storing to memory.
Definition: Instructions.h:300
void initializeTargetTransformInfoWrapperPassPass(PassRegistry &)
void getUnrollingPreferences(Loop *L, UnrollingPreferences &UP) const
Get target-customized preferences for the generic loop unrolling transformation.
int getIntrinsicCost(Intrinsic::ID IID, Type *RetTy, ArrayRef< Type * > ParamTys) const
Estimate the cost of an intrinsic when lowered.
int getIntrinsicInstrCost(Intrinsic::ID ID, Type *RetTy, ArrayRef< Type * > Tys, FastMathFlags FMF) const
bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace=0) const
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
Wrapper pass for TargetTransformInfo.
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:48
This is an important base class in LLVM.
Definition: Constant.h:42
int getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys) const
TargetIRAnalysis()
Default construct a target IR analysis.
int getReductionCost(unsigned Opcode, Type *Ty, bool IsPairwiseForm) const
Calculate the cost of performing a vector reduction.
uint32_t Offset
bool enableAggressiveInterleaving(bool LoopHasReductions) const
Don't restrict interleaved unrolling to small loops.
int getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src) const
int getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy=nullptr) const
Estimate the cost of a specific operation when lowered.
int getFPOpCost(Type *Ty) const
Return the expected cost of supporting the floating point operation of the specified type...
int getShuffleCost(ShuffleKind Kind, Type *Tp, int Index=0, Type *SubTp=nullptr) const
bool isFoldableMemAccessOffset(Instruction *I, int64_t Offset) const
Return true if target supports the load / store instruction with the given Offset on the form reg + O...
int getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace=0) const
Return the cost of the scaling factor used in the addressing mode represented by AM for this target...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:36
OperandValueProperties
Additional properties of an operand's values.
Value * getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType) const
ImmutablePass class - This class is used to provide information that does not need to be run...
Definition: Pass.h:266
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
unsigned getMinPrefetchStride() const
bool areInlineCompatible(const Function *Caller, const Function *Callee) const
Module.h This file contains the declarations for the Module class.
AddressSpace
Definition: NVPTXBaseInfo.h:22
bool haveFastSqrt(Type *Ty) const
Return true if the hardware has a fast square-root instruction.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
Class to represent vector types.
Definition: DerivedTypes.h:369
bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) const
Class for arbitrary precision integers.
Definition: APInt.h:77
int getIntImmCost(const APInt &Imm, Type *Ty) const
Return the expected cost of materializing for the given integer immediate of the specified type...
unsigned getJumpBufAlignment() const
Returns the target's jmp_buf alignment in bytes.
TargetTransformInfo(T Impl)
Construct a TTI object using a type implementing the Concept API below.
Result run(const Function &F, FunctionAnalysisManager &)
bool isLegalICmpImmediate(int64_t Imm) const
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:384
bool shouldBuildLookupTables() const
Return true if switches should be turned into lookup tables for the target.
bool isLegalMaskedLoad(Type *DataType) const
This class represents an analyzed expression in the program.
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:368
int getCallCost(FunctionType *FTy, int NumArgs=-1) const
Estimate the cost of a function call when lowered.
unsigned getPrefetchDistance() const
Parameters that control the generic loop unrolling transformation.
int getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, unsigned Alignment, unsigned AddressSpace) const
#define I(x, y, z)
Definition: MD5.cpp:54
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, unsigned Alignment, unsigned AddrSpace) const
int getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index=-1) const
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isLoweredToCall(const Function *F) const
Test whether calls to a function lower to actual program function calls.
TargetTransformInfo Result
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:537
LLVM Value Representation.
Definition: Value.h:71
bool isTruncateFree(Type *Ty1, Type *Ty2) const
Return true if it's free to truncate a value of type Ty1 to type Ty2.
unsigned getNumberOfRegisters(bool Vector) const
print Print MemDeps of function
int getCFInstrCost(unsigned Opcode) const
Convenience struct for specifying and reasoning about fast-math flags.
Definition: Operator.h:168
OperandValueKind
Additional information about an operand's possible values.
A container for analyses that lazily runs them and caches their results.
int getVectorInstrCost(unsigned Opcode, Type *Val, unsigned Index=-1) const
This pass exposes codegen information to IR-level passes.
TargetTransformInfo & getTTI(const Function &F)
int * Ptr
int getUserCost(const User *U) const
Estimate the cost of a given IR user when lowered.
unsigned getCostOfKeepingLiveOverCall(ArrayRef< Type * > Tys) const
Information about a load/store intrinsic defined by the target.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
Definition: CallingConv.h:42
int getAddressComputationCost(Type *Ty, ScalarEvolution *SE=nullptr, const SCEV *Ptr=nullptr) const
int getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy=nullptr) const
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:64
bool isProfitableToHoist(Instruction *I) const
Return true if it is profitable to hoist instruction in the then/else to before if.
int getArithmeticInstrCost(unsigned Opcode, Type *Ty, OperandValueKind Opd1Info=OK_AnyValue, OperandValueKind Opd2Info=OK_AnyValue, OperandValueProperties Opd1PropInfo=OP_None, OperandValueProperties Opd2PropInfo=OP_None, ArrayRef< const Value * > Args=ArrayRef< const Value * >()) const
A wrapper class for inspecting calls to intrinsic functions.
Definition: IntrinsicInst.h:44
ShuffleKind
The various kinds of shuffle patterns for vector queries.