22 #ifndef LLVM_ANALYSIS_TARGETTRANSFORMINFO_H 23 #define LLVM_ANALYSIS_TARGETTRANSFORMINFO_H 64 unsigned short MatchingId = 0;
67 bool WriteMem =
false;
136 case TCK_RecipThroughput:
137 return getInstructionThroughput(I);
140 return getInstructionLatency(I);
143 return getUserCost(I);
186 int getOperationCost(
unsigned Opcode,
Type *Ty,
Type *OpTy =
nullptr)
const;
193 int getGEPCost(
Type *PointeeType,
const Value *Ptr,
212 int getCallCost(
FunctionType *FTy,
int NumArgs = -1)
const;
218 int getCallCost(
const Function *
F,
int NumArgs = -1)
const;
231 unsigned getInliningThresholdMultiplier()
const;
248 unsigned getEstimatedNumberOfCaseClusters(
const SwitchInst &
SI,
249 unsigned &JTSize)
const;
279 return getUserCost(U, Operands);
287 bool hasBranchDivergence()
const;
295 bool isSourceOfDivergence(
const Value *V)
const;
300 bool isAlwaysUniform(
const Value *V)
const;
318 unsigned getFlatAddressSpace()
const;
332 bool isLoweredToCall(
const Function *
F)
const;
458 bool isLegalAddImmediate(int64_t Imm)
const;
464 bool isLegalICmpImmediate(int64_t Imm)
const;
472 bool isLegalAddressingMode(
Type *Ty,
GlobalValue *BaseGV, int64_t BaseOffset,
473 bool HasBaseReg, int64_t Scale,
474 unsigned AddrSpace = 0,
484 bool canMacroFuseCmp()
const;
488 bool shouldFavorPostInc()
const;
493 bool isLegalMaskedLoad(
Type *DataType)
const;
498 bool isLegalMaskedScatter(
Type *DataType)
const;
499 bool isLegalMaskedGather(
Type *DataType)
const;
506 bool hasDivRemOp(
Type *DataType,
bool IsSigned)
const;
513 bool hasVolatileVariant(
Instruction *
I,
unsigned AddrSpace)
const;
516 bool prefersVectorizedAddressing()
const;
525 bool HasBaseReg, int64_t Scale,
526 unsigned AddrSpace = 0)
const;
532 bool LSRWithInstrQueries()
const;
537 bool isTruncateFree(
Type *Ty1,
Type *Ty2)
const;
546 bool isTypeLegal(
Type *Ty)
const;
549 unsigned getJumpBufAlignment()
const;
552 unsigned getJumpBufSize()
const;
556 bool shouldBuildLookupTables()
const;
560 bool shouldBuildLookupTablesForConstant(
Constant *
C)
const;
564 bool useColdCCForColdCall(
Function &F)
const;
574 bool supportsEfficientVectorElementLoadStore()
const;
577 bool enableAggressiveInterleaving(
bool LoopHasReductions)
const;
588 bool enableInterleavedAccessVectorization()
const;
597 bool isFPVectorizationPotentiallyUnsafe()
const;
602 unsigned Alignment = 1,
603 bool *
Fast =
nullptr)
const;
609 bool haveFastSqrt(
Type *Ty)
const;
615 bool isFCmpOrdCheaperThanFCmpZero(
Type *Ty)
const;
619 int getFPOpCost(
Type *Ty)
const;
623 int getIntImmCost(
const APInt &Imm,
Type *Ty)
const;
628 int getIntImmCost(
unsigned Opc,
unsigned Idx,
const APInt &Imm,
640 int getIntImmCodeSizeCost(
unsigned Opc,
unsigned Idx,
const APInt &Imm,
668 OK_NonUniformConstantValue
677 unsigned getNumberOfRegisters(
bool Vector)
const;
680 unsigned getRegisterBitWidth(
bool Vector)
const;
683 unsigned getMinVectorRegisterBitWidth()
const;
691 bool shouldMaximizeVectorBandwidth(
bool OptSize)
const;
696 unsigned getMinimumVF(
unsigned ElemWidth)
const;
701 bool shouldConsiderAddressTypePromotion(
702 const Instruction &I,
bool &AllowPromotionWithoutCommonHeader)
const;
705 unsigned getCacheLineSize()
const;
725 unsigned getPrefetchDistance()
const;
730 unsigned getMinPrefetchStride()
const;
735 unsigned getMaxPrefetchIterationsAhead()
const;
740 unsigned getMaxInterleaveFactor(
unsigned VF)
const;
756 int getArithmeticInstrCost(
767 Type *SubTp =
nullptr)
const;
772 int getCastInstrCost(
unsigned Opcode,
Type *Dst,
Type *Src,
777 int getExtractWithExtendCost(
unsigned Opcode,
Type *Dst,
VectorType *VecTy,
778 unsigned Index = -1)
const;
782 int getCFInstrCost(
unsigned Opcode)
const;
787 int getCmpSelInstrCost(
unsigned Opcode,
Type *ValTy,
792 int getVectorInstrCost(
unsigned Opcode,
Type *Val,
unsigned Index = -1)
const;
795 int getMemoryOpCost(
unsigned Opcode,
Type *Src,
unsigned Alignment,
799 int getMaskedMemoryOpCost(
unsigned Opcode,
Type *Src,
unsigned Alignment,
800 unsigned AddressSpace)
const;
809 int getGatherScatterOpCost(
unsigned Opcode,
Type *DataTy,
Value *
Ptr,
810 bool VariableMask,
unsigned Alignment)
const;
820 int getInterleavedMemoryOpCost(
unsigned Opcode,
Type *VecTy,
unsigned Factor,
822 unsigned AddressSpace)
const;
837 int getArithmeticReductionCost(
unsigned Opcode,
Type *Ty,
838 bool IsPairwiseForm)
const;
839 int getMinMaxReductionCost(
Type *Ty,
Type *CondTy,
bool IsPairwiseForm,
840 bool IsUnsigned)
const;
847 unsigned VF = 1)
const;
854 unsigned ScalarizationCostPassed = UINT_MAX)
const;
861 unsigned getNumberOfParts(
Type *Tp)
const;
871 const SCEV *Ptr =
nullptr)
const;
888 unsigned getAtomicMemIntrinsicMaxElementSize()
const;
895 Type *ExpectedType)
const;
899 unsigned SrcAlign,
unsigned DestAlign)
const;
909 unsigned RemainingBytes,
911 unsigned DestAlign)
const;
935 unsigned getLoadStoreVecRegBitWidth(
unsigned AddrSpace)
const;
938 bool isLegalToVectorizeLoad(
LoadInst *LI)
const;
944 bool isLegalToVectorizeLoadChain(
unsigned ChainSizeInBytes,
946 unsigned AddrSpace)
const;
949 bool isLegalToVectorizeStoreChain(
unsigned ChainSizeInBytes,
951 unsigned AddrSpace)
const;
955 unsigned getLoadVectorFactor(
unsigned VF,
unsigned LoadSize,
956 unsigned ChainSizeInBytes,
961 unsigned getStoreVectorFactor(
unsigned VF,
unsigned StoreSize,
962 unsigned ChainSizeInBytes,
975 bool useReductionIntrinsic(
unsigned Opcode,
Type *Ty,
986 int getInstructionLatency(
const Instruction *I)
const;
990 int getInstructionThroughput(
const Instruction *I)
const;
998 template <
typename T>
class Model;
1000 std::unique_ptr<Concept> TTIImpl;
1006 virtual const DataLayout &getDataLayout()
const = 0;
1007 virtual int getOperationCost(
unsigned Opcode,
Type *Ty,
Type *OpTy) = 0;
1008 virtual int getGEPCost(
Type *PointeeType,
const Value *
Ptr,
1011 virtual int getCallCost(
FunctionType *FTy,
int NumArgs) = 0;
1012 virtual int getCallCost(
const Function *
F,
int NumArgs) = 0;
1013 virtual int getCallCost(
const Function *F,
1015 virtual unsigned getInliningThresholdMultiplier() = 0;
1020 virtual unsigned getEstimatedNumberOfCaseClusters(
const SwitchInst &
SI,
1021 unsigned &JTSize) = 0;
1024 virtual bool hasBranchDivergence() = 0;
1025 virtual bool isSourceOfDivergence(
const Value *V) = 0;
1026 virtual bool isAlwaysUniform(
const Value *V) = 0;
1027 virtual unsigned getFlatAddressSpace() = 0;
1028 virtual bool isLoweredToCall(
const Function *F) = 0;
1031 virtual bool isLegalAddImmediate(int64_t Imm) = 0;
1032 virtual bool isLegalICmpImmediate(int64_t Imm) = 0;
1034 int64_t BaseOffset,
bool HasBaseReg,
1040 virtual bool canMacroFuseCmp() = 0;
1041 virtual bool shouldFavorPostInc()
const = 0;
1043 virtual bool isLegalMaskedLoad(
Type *DataType) = 0;
1044 virtual bool isLegalMaskedScatter(
Type *DataType) = 0;
1045 virtual bool isLegalMaskedGather(
Type *DataType) = 0;
1046 virtual bool hasDivRemOp(
Type *DataType,
bool IsSigned) = 0;
1047 virtual bool hasVolatileVariant(
Instruction *I,
unsigned AddrSpace) = 0;
1048 virtual bool prefersVectorizedAddressing() = 0;
1050 int64_t BaseOffset,
bool HasBaseReg,
1051 int64_t Scale,
unsigned AddrSpace) = 0;
1052 virtual bool LSRWithInstrQueries() = 0;
1053 virtual bool isTruncateFree(
Type *Ty1,
Type *Ty2) = 0;
1054 virtual bool isProfitableToHoist(
Instruction *I) = 0;
1055 virtual bool useAA() = 0;
1056 virtual bool isTypeLegal(
Type *Ty) = 0;
1057 virtual unsigned getJumpBufAlignment() = 0;
1058 virtual unsigned getJumpBufSize() = 0;
1059 virtual bool shouldBuildLookupTables() = 0;
1060 virtual bool shouldBuildLookupTablesForConstant(
Constant *
C) = 0;
1061 virtual bool useColdCCForColdCall(
Function &F) = 0;
1066 virtual bool supportsEfficientVectorElementLoadStore() = 0;
1067 virtual bool enableAggressiveInterleaving(
bool LoopHasReductions) = 0;
1069 bool IsZeroCmp)
const = 0;
1070 virtual bool enableInterleavedAccessVectorization() = 0;
1071 virtual bool isFPVectorizationPotentiallyUnsafe() = 0;
1078 virtual bool haveFastSqrt(
Type *Ty) = 0;
1079 virtual bool isFCmpOrdCheaperThanFCmpZero(
Type *Ty) = 0;
1080 virtual int getFPOpCost(
Type *Ty) = 0;
1081 virtual int getIntImmCodeSizeCost(
unsigned Opc,
unsigned Idx,
const APInt &Imm,
1083 virtual int getIntImmCost(
const APInt &Imm,
Type *Ty) = 0;
1084 virtual int getIntImmCost(
unsigned Opc,
unsigned Idx,
const APInt &Imm,
1088 virtual unsigned getNumberOfRegisters(
bool Vector) = 0;
1089 virtual unsigned getRegisterBitWidth(
bool Vector)
const = 0;
1090 virtual unsigned getMinVectorRegisterBitWidth() = 0;
1091 virtual bool shouldMaximizeVectorBandwidth(
bool OptSize)
const = 0;
1092 virtual unsigned getMinimumVF(
unsigned ElemWidth)
const = 0;
1093 virtual bool shouldConsiderAddressTypePromotion(
1094 const Instruction &I,
bool &AllowPromotionWithoutCommonHeader) = 0;
1095 virtual unsigned getCacheLineSize() = 0;
1098 virtual unsigned getPrefetchDistance() = 0;
1099 virtual unsigned getMinPrefetchStride() = 0;
1100 virtual unsigned getMaxPrefetchIterationsAhead() = 0;
1101 virtual unsigned getMaxInterleaveFactor(
unsigned VF) = 0;
1110 virtual int getCastInstrCost(
unsigned Opcode,
Type *Dst,
Type *Src,
1112 virtual int getExtractWithExtendCost(
unsigned Opcode,
Type *Dst,
1114 virtual int getCFInstrCost(
unsigned Opcode) = 0;
1115 virtual int getCmpSelInstrCost(
unsigned Opcode,
Type *ValTy,
1117 virtual int getVectorInstrCost(
unsigned Opcode,
Type *Val,
1118 unsigned Index) = 0;
1119 virtual int getMemoryOpCost(
unsigned Opcode,
Type *Src,
unsigned Alignment,
1121 virtual int getMaskedMemoryOpCost(
unsigned Opcode,
Type *Src,
1123 unsigned AddressSpace) = 0;
1124 virtual int getGatherScatterOpCost(
unsigned Opcode,
Type *DataTy,
1125 Value *Ptr,
bool VariableMask,
1126 unsigned Alignment) = 0;
1127 virtual int getInterleavedMemoryOpCost(
unsigned Opcode,
Type *VecTy,
1131 unsigned AddressSpace) = 0;
1132 virtual int getArithmeticReductionCost(
unsigned Opcode,
Type *Ty,
1133 bool IsPairwiseForm) = 0;
1134 virtual int getMinMaxReductionCost(
Type *Ty,
Type *CondTy,
1135 bool IsPairwiseForm,
bool IsUnsigned) = 0;
1138 unsigned ScalarizationCostPassed) = 0;
1143 virtual unsigned getNumberOfParts(
Type *Tp) = 0;
1145 const SCEV *Ptr) = 0;
1149 virtual unsigned getAtomicMemIntrinsicMaxElementSize()
const = 0;
1151 Type *ExpectedType) = 0;
1154 unsigned DestAlign)
const = 0;
1155 virtual void getMemcpyLoopResidualLoweringType(
1157 unsigned RemainingBytes,
unsigned SrcAlign,
unsigned DestAlign)
const = 0;
1162 virtual unsigned getLoadStoreVecRegBitWidth(
unsigned AddrSpace)
const = 0;
1163 virtual bool isLegalToVectorizeLoad(
LoadInst *LI)
const = 0;
1164 virtual bool isLegalToVectorizeStore(
StoreInst *SI)
const = 0;
1165 virtual bool isLegalToVectorizeLoadChain(
unsigned ChainSizeInBytes,
1167 unsigned AddrSpace)
const = 0;
1168 virtual bool isLegalToVectorizeStoreChain(
unsigned ChainSizeInBytes,
1170 unsigned AddrSpace)
const = 0;
1171 virtual unsigned getLoadVectorFactor(
unsigned VF,
unsigned LoadSize,
1172 unsigned ChainSizeInBytes,
1174 virtual unsigned getStoreVectorFactor(
unsigned VF,
unsigned StoreSize,
1175 unsigned ChainSizeInBytes,
1177 virtual bool useReductionIntrinsic(
unsigned Opcode,
Type *Ty,
1179 virtual bool shouldExpandReduction(
const IntrinsicInst *II)
const = 0;
1180 virtual int getInstructionLatency(
const Instruction *I) = 0;
1183 template <
typename T>
1188 Model(
T Impl) : Impl(std::move(Impl)) {}
1189 ~
Model()
override {}
1191 const DataLayout &getDataLayout()
const override {
1192 return Impl.getDataLayout();
1195 int getOperationCost(
unsigned Opcode,
Type *Ty,
Type *OpTy)
override {
1196 return Impl.getOperationCost(Opcode, Ty, OpTy);
1200 return Impl.getGEPCost(PointeeType, Ptr, Operands);
1203 return Impl.getExtCost(I, Src);
1205 int getCallCost(
FunctionType *FTy,
int NumArgs)
override {
1206 return Impl.getCallCost(FTy, NumArgs);
1208 int getCallCost(
const Function *
F,
int NumArgs)
override {
1209 return Impl.getCallCost(F, NumArgs);
1213 return Impl.getCallCost(F, Arguments);
1215 unsigned getInliningThresholdMultiplier()
override {
1216 return Impl.getInliningThresholdMultiplier();
1220 return Impl.getIntrinsicCost(IID, RetTy, ParamTys);
1224 return Impl.getIntrinsicCost(IID, RetTy, Arguments);
1227 return Impl.getUserCost(U, Operands);
1229 bool hasBranchDivergence()
override {
return Impl.hasBranchDivergence(); }
1230 bool isSourceOfDivergence(
const Value *V)
override {
1231 return Impl.isSourceOfDivergence(V);
1234 bool isAlwaysUniform(
const Value *V)
override {
1235 return Impl.isAlwaysUniform(V);
1238 unsigned getFlatAddressSpace()
override {
1239 return Impl.getFlatAddressSpace();
1242 bool isLoweredToCall(
const Function *F)
override {
1243 return Impl.isLoweredToCall(F);
1247 return Impl.getUnrollingPreferences(L, SE, UP);
1249 bool isLegalAddImmediate(int64_t Imm)
override {
1250 return Impl.isLegalAddImmediate(Imm);
1252 bool isLegalICmpImmediate(int64_t Imm)
override {
1253 return Impl.isLegalICmpImmediate(Imm);
1255 bool isLegalAddressingMode(
Type *Ty,
GlobalValue *BaseGV, int64_t BaseOffset,
1256 bool HasBaseReg, int64_t Scale,
1259 return Impl.isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg,
1260 Scale, AddrSpace, I);
1264 return Impl.isLSRCostLess(C1, C2);
1266 bool canMacroFuseCmp()
override {
1267 return Impl.canMacroFuseCmp();
1269 bool shouldFavorPostInc()
const override {
1270 return Impl.shouldFavorPostInc();
1273 return Impl.isLegalMaskedStore(DataType);
1275 bool isLegalMaskedLoad(
Type *DataType)
override {
1276 return Impl.isLegalMaskedLoad(DataType);
1278 bool isLegalMaskedScatter(
Type *DataType)
override {
1279 return Impl.isLegalMaskedScatter(DataType);
1281 bool isLegalMaskedGather(
Type *DataType)
override {
1282 return Impl.isLegalMaskedGather(DataType);
1284 bool hasDivRemOp(
Type *DataType,
bool IsSigned)
override {
1285 return Impl.hasDivRemOp(DataType, IsSigned);
1287 bool hasVolatileVariant(
Instruction *I,
unsigned AddrSpace)
override {
1288 return Impl.hasVolatileVariant(I, AddrSpace);
1290 bool prefersVectorizedAddressing()
override {
1291 return Impl.prefersVectorizedAddressing();
1294 bool HasBaseReg, int64_t Scale,
1295 unsigned AddrSpace)
override {
1296 return Impl.getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg,
1299 bool LSRWithInstrQueries()
override {
1300 return Impl.LSRWithInstrQueries();
1302 bool isTruncateFree(
Type *Ty1,
Type *Ty2)
override {
1303 return Impl.isTruncateFree(Ty1, Ty2);
1305 bool isProfitableToHoist(
Instruction *I)
override {
1306 return Impl.isProfitableToHoist(I);
1308 bool useAA()
override {
return Impl.useAA(); }
1309 bool isTypeLegal(
Type *Ty)
override {
return Impl.isTypeLegal(Ty); }
1310 unsigned getJumpBufAlignment()
override {
return Impl.getJumpBufAlignment(); }
1311 unsigned getJumpBufSize()
override {
return Impl.getJumpBufSize(); }
1312 bool shouldBuildLookupTables()
override {
1313 return Impl.shouldBuildLookupTables();
1315 bool shouldBuildLookupTablesForConstant(
Constant *
C)
override {
1316 return Impl.shouldBuildLookupTablesForConstant(C);
1318 bool useColdCCForColdCall(
Function &F)
override {
1319 return Impl.useColdCCForColdCall(F);
1323 bool Extract)
override {
1324 return Impl.getScalarizationOverhead(Ty, Insert, Extract);
1327 unsigned VF)
override {
1328 return Impl.getOperandsScalarizationOverhead(Args, VF);
1331 bool supportsEfficientVectorElementLoadStore()
override {
1332 return Impl.supportsEfficientVectorElementLoadStore();
1335 bool enableAggressiveInterleaving(
bool LoopHasReductions)
override {
1336 return Impl.enableAggressiveInterleaving(LoopHasReductions);
1339 bool IsZeroCmp)
const override {
1340 return Impl.enableMemCmpExpansion(IsZeroCmp);
1342 bool enableInterleavedAccessVectorization()
override {
1343 return Impl.enableInterleavedAccessVectorization();
1345 bool isFPVectorizationPotentiallyUnsafe()
override {
1346 return Impl.isFPVectorizationPotentiallyUnsafe();
1350 unsigned Alignment,
bool *
Fast)
override {
1351 return Impl.allowsMisalignedMemoryAccesses(Context, BitWidth, AddressSpace,
1355 return Impl.getPopcntSupport(IntTyWidthInBit);
1357 bool haveFastSqrt(
Type *Ty)
override {
return Impl.haveFastSqrt(Ty); }
1359 bool isFCmpOrdCheaperThanFCmpZero(
Type *Ty)
override {
1360 return Impl.isFCmpOrdCheaperThanFCmpZero(Ty);
1363 int getFPOpCost(
Type *Ty)
override {
return Impl.getFPOpCost(Ty); }
1365 int getIntImmCodeSizeCost(
unsigned Opc,
unsigned Idx,
const APInt &Imm,
1366 Type *Ty)
override {
1367 return Impl.getIntImmCodeSizeCost(Opc, Idx, Imm, Ty);
1369 int getIntImmCost(
const APInt &Imm,
Type *Ty)
override {
1370 return Impl.getIntImmCost(Imm, Ty);
1372 int getIntImmCost(
unsigned Opc,
unsigned Idx,
const APInt &Imm,
1373 Type *Ty)
override {
1374 return Impl.getIntImmCost(Opc, Idx, Imm, Ty);
1377 Type *Ty)
override {
1378 return Impl.getIntImmCost(IID, Idx, Imm, Ty);
1380 unsigned getNumberOfRegisters(
bool Vector)
override {
1381 return Impl.getNumberOfRegisters(Vector);
1383 unsigned getRegisterBitWidth(
bool Vector)
const override {
1384 return Impl.getRegisterBitWidth(Vector);
1386 unsigned getMinVectorRegisterBitWidth()
override {
1387 return Impl.getMinVectorRegisterBitWidth();
1389 bool shouldMaximizeVectorBandwidth(
bool OptSize)
const override {
1390 return Impl.shouldMaximizeVectorBandwidth(OptSize);
1392 unsigned getMinimumVF(
unsigned ElemWidth)
const override {
1393 return Impl.getMinimumVF(ElemWidth);
1395 bool shouldConsiderAddressTypePromotion(
1396 const Instruction &I,
bool &AllowPromotionWithoutCommonHeader)
override {
1397 return Impl.shouldConsiderAddressTypePromotion(
1398 I, AllowPromotionWithoutCommonHeader);
1400 unsigned getCacheLineSize()
override {
1401 return Impl.getCacheLineSize();
1404 return Impl.getCacheSize(Level);
1407 return Impl.getCacheAssociativity(Level);
1409 unsigned getPrefetchDistance()
override {
return Impl.getPrefetchDistance(); }
1410 unsigned getMinPrefetchStride()
override {
1411 return Impl.getMinPrefetchStride();
1413 unsigned getMaxPrefetchIterationsAhead()
override {
1414 return Impl.getMaxPrefetchIterationsAhead();
1416 unsigned getMaxInterleaveFactor(
unsigned VF)
override {
1417 return Impl.getMaxInterleaveFactor(VF);
1419 unsigned getEstimatedNumberOfCaseClusters(
const SwitchInst &
SI,
1420 unsigned &JTSize)
override {
1421 return Impl.getEstimatedNumberOfCaseClusters(SI, JTSize);
1429 return Impl.getArithmeticInstrCost(Opcode, Ty, Opd1Info, Opd2Info,
1430 Opd1PropInfo, Opd2PropInfo, Args);
1433 Type *SubTp)
override {
1434 return Impl.getShuffleCost(Kind, Tp, Index, SubTp);
1436 int getCastInstrCost(
unsigned Opcode,
Type *Dst,
Type *Src,
1438 return Impl.getCastInstrCost(Opcode, Dst, Src, I);
1440 int getExtractWithExtendCost(
unsigned Opcode,
Type *Dst,
VectorType *VecTy,
1441 unsigned Index)
override {
1442 return Impl.getExtractWithExtendCost(Opcode, Dst, VecTy, Index);
1444 int getCFInstrCost(
unsigned Opcode)
override {
1445 return Impl.getCFInstrCost(Opcode);
1447 int getCmpSelInstrCost(
unsigned Opcode,
Type *ValTy,
Type *CondTy,
1449 return Impl.getCmpSelInstrCost(Opcode, ValTy, CondTy, I);
1451 int getVectorInstrCost(
unsigned Opcode,
Type *Val,
unsigned Index)
override {
1452 return Impl.getVectorInstrCost(Opcode, Val, Index);
1454 int getMemoryOpCost(
unsigned Opcode,
Type *Src,
unsigned Alignment,
1455 unsigned AddressSpace,
const Instruction *I)
override {
1456 return Impl.getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, I);
1458 int getMaskedMemoryOpCost(
unsigned Opcode,
Type *Src,
unsigned Alignment,
1459 unsigned AddressSpace)
override {
1460 return Impl.getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace);
1462 int getGatherScatterOpCost(
unsigned Opcode,
Type *DataTy,
1463 Value *Ptr,
bool VariableMask,
1464 unsigned Alignment)
override {
1465 return Impl.getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
1468 int getInterleavedMemoryOpCost(
unsigned Opcode,
Type *VecTy,
unsigned Factor,
1470 unsigned AddressSpace)
override {
1471 return Impl.getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
1472 Alignment, AddressSpace);
1474 int getArithmeticReductionCost(
unsigned Opcode,
Type *Ty,
1475 bool IsPairwiseForm)
override {
1476 return Impl.getArithmeticReductionCost(Opcode, Ty, IsPairwiseForm);
1478 int getMinMaxReductionCost(
Type *Ty,
Type *CondTy,
1479 bool IsPairwiseForm,
bool IsUnsigned)
override {
1480 return Impl.getMinMaxReductionCost(Ty, CondTy, IsPairwiseForm, IsUnsigned);
1483 FastMathFlags FMF,
unsigned ScalarizationCostPassed)
override {
1484 return Impl.getIntrinsicInstrCost(ID, RetTy, Tys, FMF,
1485 ScalarizationCostPassed);
1489 return Impl.getIntrinsicInstrCost(ID, RetTy, Args, FMF, VF);
1493 return Impl.getCallInstrCost(F, RetTy, Tys);
1495 unsigned getNumberOfParts(
Type *Tp)
override {
1496 return Impl.getNumberOfParts(Tp);
1499 const SCEV *Ptr)
override {
1500 return Impl.getAddressComputationCost(Ty, SE, Ptr);
1503 return Impl.getCostOfKeepingLiveOverCall(Tys);
1507 return Impl.getTgtMemIntrinsic(Inst, Info);
1509 unsigned getAtomicMemIntrinsicMaxElementSize()
const override {
1510 return Impl.getAtomicMemIntrinsicMaxElementSize();
1513 Type *ExpectedType)
override {
1514 return Impl.getOrCreateResultFromMemIntrinsic(Inst, ExpectedType);
1518 unsigned DestAlign)
const override {
1519 return Impl.getMemcpyLoopLoweringType(Context, Length, SrcAlign, DestAlign);
1523 unsigned RemainingBytes,
1525 unsigned DestAlign)
const override {
1526 Impl.getMemcpyLoopResidualLoweringType(OpsOut, Context, RemainingBytes,
1527 SrcAlign, DestAlign);
1531 return Impl.areInlineCompatible(Caller, Callee);
1534 return Impl.isIndexedLoadLegal(Mode, Ty, getDataLayout());
1537 return Impl.isIndexedStoreLegal(Mode, Ty, getDataLayout());
1539 unsigned getLoadStoreVecRegBitWidth(
unsigned AddrSpace)
const override {
1540 return Impl.getLoadStoreVecRegBitWidth(AddrSpace);
1542 bool isLegalToVectorizeLoad(
LoadInst *LI)
const override {
1543 return Impl.isLegalToVectorizeLoad(LI);
1545 bool isLegalToVectorizeStore(
StoreInst *SI)
const override {
1546 return Impl.isLegalToVectorizeStore(SI);
1548 bool isLegalToVectorizeLoadChain(
unsigned ChainSizeInBytes,
1550 unsigned AddrSpace)
const override {
1551 return Impl.isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
1554 bool isLegalToVectorizeStoreChain(
unsigned ChainSizeInBytes,
1556 unsigned AddrSpace)
const override {
1557 return Impl.isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
1560 unsigned getLoadVectorFactor(
unsigned VF,
unsigned LoadSize,
1561 unsigned ChainSizeInBytes,
1563 return Impl.getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy);
1565 unsigned getStoreVectorFactor(
unsigned VF,
unsigned StoreSize,
1566 unsigned ChainSizeInBytes,
1568 return Impl.getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy);
1570 bool useReductionIntrinsic(
unsigned Opcode,
Type *Ty,
1572 return Impl.useReductionIntrinsic(Opcode, Ty, Flags);
1574 bool shouldExpandReduction(
const IntrinsicInst *II)
const override {
1575 return Impl.shouldExpandReduction(II);
1577 int getInstructionLatency(
const Instruction *I)
override {
1578 return Impl.getInstructionLatency(I);
1582 template <
typename T>
1584 : TTIImpl(new
Model<
T>(Impl)) {}
1615 : TTICallback(Arg.TTICallback) {}
1617 : TTICallback(
std::move(
Arg.TTICallback)) {}
1619 TTICallback = RHS.TTICallback;
1623 TTICallback = std::move(RHS.TTICallback);
1643 std::function<Result(const Function &)> TTICallback;
1646 static Result getDefaultTTI(
const Function &F);
1657 virtual void anchor();
A parsed version of the target data layout string in and methods for querying it. ...
Atomic ordering constants.
Compute iterated dominance frontiers using a linear time algorithm.
constexpr char IsVolatile[]
Key for Kernel::Arg::Metadata::mIsVolatile.
TargetIRAnalysis & operator=(const TargetIRAnalysis &RHS)
static unsigned getScalarizationOverhead(Instruction *I, unsigned VF, const TargetTransformInfo &TTI)
Estimate the overhead of scalarizing an instruction.
value_op_iterator value_op_begin()
The main scalar evolution driver.
ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
Analysis pass providing the TargetTransformInfo.
value_op_iterator value_op_end()
An instruction for reading from memory.
TargetIRAnalysis & operator=(TargetIRAnalysis &&RHS)
bool areInlineCompatible(const Function &Caller, const Function &Callee)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
AtomicOrdering
Atomic ordering for LLVM's memory model.
Class to represent function types.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
An instruction for storing to memory.
amdgpu Simplify well known AMD library false Value * Callee
A set of analyses that are preserved following a run of a transformation pass.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
This is an important base class in LLVM.
A CRTP mix-in that provides informational APIs needed for analysis passes.
AMDGPU Lower Kernel Arguments
TargetIRAnalysis(const TargetIRAnalysis &Arg)
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
ImmutablePass class - This class is used to provide information that does not need to be run...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Class to represent vector types.
Class for arbitrary precision integers.
amdgpu Simplify well known AMD library false Value Value * Arg
static unsigned getScalingFactorCost(const TargetTransformInfo &TTI, const LSRUse &LU, const Formula &F, const Loop &L)
This class represents an analyzed expression in the program.
Represents a single loop in the control flow graph.
TargetIRAnalysis(TargetIRAnalysis &&Arg)
API to communicate dependencies between analyses during invalidation.
TargetTransformInfo Result
LLVM Value Representation.
print Print MemDeps of function
Convenience struct for specifying and reasoning about fast-math flags.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.
Information about a load/store intrinsic defined by the target.
A special type used by analysis passes to provide an address that identifies that particular analysis...
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
A wrapper class for inspecting calls to intrinsic functions.