@@ -42,7 +42,7 @@ struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
42
42
explicit NoTTIImpl (const DataLayout &DL)
43
43
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
44
44
};
45
- }
45
+ } // namespace
46
46
47
47
bool HardwareLoopInfo::canAnalyze (LoopInfo &LI) {
48
48
// If the loop has irreducible control flow, it can not be converted to
@@ -171,23 +171,22 @@ int TargetTransformInfo::getExtCost(const Instruction *I,
171
171
return TTIImpl->getExtCost (I, Src);
172
172
}
173
173
174
- int TargetTransformInfo::getIntrinsicCost (
175
- Intrinsic::ID IID, Type *RetTy, ArrayRef<const Value *> Arguments,
176
- const User *U) const {
174
+ int TargetTransformInfo::getIntrinsicCost (Intrinsic::ID IID, Type *RetTy,
175
+ ArrayRef<const Value *> Arguments,
176
+ const User *U) const {
177
177
int Cost = TTIImpl->getIntrinsicCost (IID, RetTy, Arguments, U);
178
178
assert (Cost >= 0 && " TTI should not produce negative costs!" );
179
179
return Cost;
180
180
}
181
181
182
- unsigned
183
- TargetTransformInfo::getEstimatedNumberOfCaseClusters (
182
+ unsigned TargetTransformInfo::getEstimatedNumberOfCaseClusters (
184
183
const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI,
185
184
BlockFrequencyInfo *BFI) const {
186
185
return TTIImpl->getEstimatedNumberOfCaseClusters (SI, JTSize, PSI, BFI);
187
186
}
188
187
189
188
int TargetTransformInfo::getUserCost (const User *U,
190
- ArrayRef<const Value *> Operands) const {
189
+ ArrayRef<const Value *> Operands) const {
191
190
int Cost = TTIImpl->getUserCost (U, Operands);
192
191
assert (Cost >= 0 && " TTI should not produce negative costs!" );
193
192
return Cost;
@@ -214,12 +213,13 @@ unsigned TargetTransformInfo::getFlatAddressSpace() const {
214
213
}
215
214
216
215
bool TargetTransformInfo::collectFlatAddressOperands (
217
- SmallVectorImpl<int > &OpIndexes, Intrinsic::ID IID) const {
216
+ SmallVectorImpl<int > &OpIndexes, Intrinsic::ID IID) const {
218
217
return TTIImpl->collectFlatAddressOperands (OpIndexes, IID);
219
218
}
220
219
221
- bool TargetTransformInfo::rewriteIntrinsicWithAddressSpace (
222
- IntrinsicInst *II, Value *OldV, Value *NewV) const {
220
+ bool TargetTransformInfo::rewriteIntrinsicWithAddressSpace (IntrinsicInst *II,
221
+ Value *OldV,
222
+ Value *NewV) const {
223
223
return TTIImpl->rewriteIntrinsicWithAddressSpace (II, OldV, NewV);
224
224
}
225
225
@@ -228,14 +228,15 @@ bool TargetTransformInfo::isLoweredToCall(const Function *F) const {
228
228
}
229
229
230
230
bool TargetTransformInfo::isHardwareLoopProfitable (
231
- Loop *L, ScalarEvolution &SE, AssumptionCache &AC,
232
- TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const {
231
+ Loop *L, ScalarEvolution &SE, AssumptionCache &AC,
232
+ TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const {
233
233
return TTIImpl->isHardwareLoopProfitable (L, SE, AC, LibInfo, HWLoopInfo);
234
234
}
235
235
236
- bool TargetTransformInfo::preferPredicateOverEpilogue (Loop *L, LoopInfo *LI,
237
- ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *TLI,
238
- DominatorTree *DT, const LoopAccessInfo *LAI) const {
236
+ bool TargetTransformInfo::preferPredicateOverEpilogue (
237
+ Loop *L, LoopInfo *LI, ScalarEvolution &SE, AssumptionCache &AC,
238
+ TargetLibraryInfo *TLI, DominatorTree *DT,
239
+ const LoopAccessInfo *LAI) const {
239
240
return TTIImpl->preferPredicateOverEpilogue (L, LI, SE, AC, TLI, DT, LAI);
240
241
}
241
242
@@ -254,8 +255,7 @@ bool TargetTransformInfo::isLegalICmpImmediate(int64_t Imm) const {
254
255
255
256
bool TargetTransformInfo::isLegalAddressingMode (Type *Ty, GlobalValue *BaseGV,
256
257
int64_t BaseOffset,
257
- bool HasBaseReg,
258
- int64_t Scale,
258
+ bool HasBaseReg, int64_t Scale,
259
259
unsigned AddrSpace,
260
260
Instruction *I) const {
261
261
return TTIImpl->isLegalAddressingMode (Ty, BaseGV, BaseOffset, HasBaseReg,
@@ -337,8 +337,7 @@ bool TargetTransformInfo::prefersVectorizedAddressing() const {
337
337
338
338
int TargetTransformInfo::getScalingFactorCost (Type *Ty, GlobalValue *BaseGV,
339
339
int64_t BaseOffset,
340
- bool HasBaseReg,
341
- int64_t Scale,
340
+ bool HasBaseReg, int64_t Scale,
342
341
unsigned AddrSpace) const {
343
342
int Cost = TTIImpl->getScalingFactorCost (Ty, BaseGV, BaseOffset, HasBaseReg,
344
343
Scale, AddrSpace);
@@ -367,30 +366,31 @@ bool TargetTransformInfo::isTypeLegal(Type *Ty) const {
367
366
bool TargetTransformInfo::shouldBuildLookupTables () const {
368
367
return TTIImpl->shouldBuildLookupTables ();
369
368
}
370
- bool TargetTransformInfo::shouldBuildLookupTablesForConstant (Constant *C) const {
369
+ bool TargetTransformInfo::shouldBuildLookupTablesForConstant (
370
+ Constant *C) const {
371
371
return TTIImpl->shouldBuildLookupTablesForConstant (C);
372
372
}
373
373
374
374
bool TargetTransformInfo::useColdCCForColdCall (Function &F) const {
375
375
return TTIImpl->useColdCCForColdCall (F);
376
376
}
377
377
378
- unsigned TargetTransformInfo::
379
- getScalarizationOverhead (Type *Ty, bool Insert, bool Extract) const {
378
+ unsigned TargetTransformInfo::getScalarizationOverhead (Type *Ty, bool Insert,
379
+ bool Extract) const {
380
380
return TTIImpl->getScalarizationOverhead (Ty, Insert, Extract);
381
381
}
382
382
383
- unsigned TargetTransformInfo::
384
- getOperandsScalarizationOverhead (ArrayRef<const Value *> Args,
385
- unsigned VF) const {
383
+ unsigned TargetTransformInfo::getOperandsScalarizationOverhead (
384
+ ArrayRef<const Value *> Args, unsigned VF) const {
386
385
return TTIImpl->getOperandsScalarizationOverhead (Args, VF);
387
386
}
388
387
389
388
bool TargetTransformInfo::supportsEfficientVectorElementLoadStore () const {
390
389
return TTIImpl->supportsEfficientVectorElementLoadStore ();
391
390
}
392
391
393
- bool TargetTransformInfo::enableAggressiveInterleaving (bool LoopHasReductions) const {
392
+ bool TargetTransformInfo::enableAggressiveInterleaving (
393
+ bool LoopHasReductions) const {
394
394
return TTIImpl->enableAggressiveInterleaving (LoopHasReductions);
395
395
}
396
396
@@ -416,8 +416,8 @@ bool TargetTransformInfo::allowsMisalignedMemoryAccesses(LLVMContext &Context,
416
416
unsigned AddressSpace,
417
417
unsigned Alignment,
418
418
bool *Fast) const {
419
- return TTIImpl->allowsMisalignedMemoryAccesses (Context, BitWidth, AddressSpace,
420
- Alignment, Fast);
419
+ return TTIImpl->allowsMisalignedMemoryAccesses (Context, BitWidth,
420
+ AddressSpace, Alignment, Fast);
421
421
}
422
422
423
423
TargetTransformInfo::PopcntSupportKind
@@ -471,11 +471,12 @@ unsigned TargetTransformInfo::getNumberOfRegisters(unsigned ClassID) const {
471
471
return TTIImpl->getNumberOfRegisters (ClassID);
472
472
}
473
473
474
- unsigned TargetTransformInfo::getRegisterClassForType (bool Vector, Type *Ty) const {
474
+ unsigned TargetTransformInfo::getRegisterClassForType (bool Vector,
475
+ Type *Ty) const {
475
476
return TTIImpl->getRegisterClassForType (Vector, Ty);
476
477
}
477
478
478
- const char * TargetTransformInfo::getRegisterClassName (unsigned ClassID) const {
479
+ const char * TargetTransformInfo::getRegisterClassName (unsigned ClassID) const {
479
480
return TTIImpl->getRegisterClassName (ClassID);
480
481
}
481
482
@@ -505,24 +506,23 @@ unsigned TargetTransformInfo::getCacheLineSize() const {
505
506
return TTIImpl->getCacheLineSize ();
506
507
}
507
508
508
- llvm::Optional<unsigned > TargetTransformInfo::getCacheSize (CacheLevel Level)
509
- const {
509
+ llvm::Optional<unsigned >
510
+ TargetTransformInfo::getCacheSize (CacheLevel Level) const {
510
511
return TTIImpl->getCacheSize (Level);
511
512
}
512
513
513
- llvm::Optional<unsigned > TargetTransformInfo::getCacheAssociativity (
514
- CacheLevel Level) const {
514
+ llvm::Optional<unsigned >
515
+ TargetTransformInfo::getCacheAssociativity ( CacheLevel Level) const {
515
516
return TTIImpl->getCacheAssociativity (Level);
516
517
}
517
518
518
519
unsigned TargetTransformInfo::getPrefetchDistance () const {
519
520
return TTIImpl->getPrefetchDistance ();
520
521
}
521
522
522
- unsigned TargetTransformInfo::getMinPrefetchStride (unsigned NumMemAccesses,
523
- unsigned NumStridedMemAccesses,
524
- unsigned NumPrefetches,
525
- bool HasCall) const {
523
+ unsigned TargetTransformInfo::getMinPrefetchStride (
524
+ unsigned NumMemAccesses, unsigned NumStridedMemAccesses,
525
+ unsigned NumPrefetches, bool HasCall) const {
526
526
return TTIImpl->getMinPrefetchStride (NumMemAccesses, NumStridedMemAccesses,
527
527
NumPrefetches, HasCall);
528
528
}
@@ -606,10 +606,10 @@ int TargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Ty, int Index,
606
606
return Cost;
607
607
}
608
608
609
- int TargetTransformInfo::getCastInstrCost (unsigned Opcode, Type *Dst,
610
- Type *Src, const Instruction *I) const {
611
- assert ((I == nullptr || I->getOpcode () == Opcode) &&
612
- " Opcode should reflect passed instruction." );
609
+ int TargetTransformInfo::getCastInstrCost (unsigned Opcode, Type *Dst, Type *Src,
610
+ const Instruction *I) const {
611
+ assert ((I == nullptr || I->getOpcode () == Opcode) &&
612
+ " Opcode should reflect passed instruction." );
613
613
int Cost = TTIImpl->getCastInstrCost (Opcode, Dst, Src, I);
614
614
assert (Cost >= 0 && " TTI should not produce negative costs!" );
615
615
return Cost;
@@ -630,9 +630,10 @@ int TargetTransformInfo::getCFInstrCost(unsigned Opcode) const {
630
630
}
631
631
632
632
int TargetTransformInfo::getCmpSelInstrCost (unsigned Opcode, Type *ValTy,
633
- Type *CondTy, const Instruction *I) const {
634
- assert ((I == nullptr || I->getOpcode () == Opcode) &&
635
- " Opcode should reflect passed instruction." );
633
+ Type *CondTy,
634
+ const Instruction *I) const {
635
+ assert ((I == nullptr || I->getOpcode () == Opcode) &&
636
+ " Opcode should reflect passed instruction." );
636
637
int Cost = TTIImpl->getCmpSelInstrCost (Opcode, ValTy, CondTy, I);
637
638
assert (Cost >= 0 && " TTI should not produce negative costs!" );
638
639
return Cost;
@@ -649,8 +650,8 @@ int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src,
649
650
MaybeAlign Alignment,
650
651
unsigned AddressSpace,
651
652
const Instruction *I) const {
652
- assert ((I == nullptr || I->getOpcode () == Opcode) &&
653
- " Opcode should reflect passed instruction." );
653
+ assert ((I == nullptr || I->getOpcode () == Opcode) &&
654
+ " Opcode should reflect passed instruction." );
654
655
int Cost = TTIImpl->getMemoryOpCost (Opcode, Src, Alignment, AddressSpace, I);
655
656
assert (Cost >= 0 && " TTI should not produce negative costs!" );
656
657
return Cost;
@@ -679,10 +680,9 @@ int TargetTransformInfo::getInterleavedMemoryOpCost(
679
680
unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned > Indices,
680
681
unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond,
681
682
bool UseMaskForGaps) const {
682
- int Cost = TTIImpl->getInterleavedMemoryOpCost (Opcode, VecTy, Factor, Indices,
683
- Alignment, AddressSpace,
684
- UseMaskForCond,
685
- UseMaskForGaps);
683
+ int Cost = TTIImpl->getInterleavedMemoryOpCost (
684
+ Opcode, VecTy, Factor, Indices, Alignment, AddressSpace, UseMaskForCond,
685
+ UseMaskForGaps);
686
686
assert (Cost >= 0 && " TTI should not produce negative costs!" );
687
687
return Cost;
688
688
}
@@ -767,22 +767,16 @@ Value *TargetTransformInfo::getOrCreateResultFromMemIntrinsic(
767
767
return TTIImpl->getOrCreateResultFromMemIntrinsic (Inst, ExpectedType);
768
768
}
769
769
770
- Type *TargetTransformInfo::getMemcpyLoopLoweringType (LLVMContext &Context,
771
- Value *Length,
772
- unsigned SrcAddrSpace,
773
- unsigned DestAddrSpace,
774
- unsigned SrcAlign,
775
- unsigned DestAlign) const {
770
+ Type *TargetTransformInfo::getMemcpyLoopLoweringType (
771
+ LLVMContext &Context, Value *Length, unsigned SrcAddrSpace,
772
+ unsigned DestAddrSpace, unsigned SrcAlign, unsigned DestAlign) const {
776
773
return TTIImpl->getMemcpyLoopLoweringType (Context, Length, SrcAddrSpace,
777
- DestAddrSpace, SrcAlign,
778
- DestAlign);
774
+ DestAddrSpace, SrcAlign, DestAlign);
779
775
}
780
776
781
777
void TargetTransformInfo::getMemcpyLoopResidualLoweringType (
782
778
SmallVectorImpl<Type *> &OpsOut, LLVMContext &Context,
783
- unsigned RemainingBytes,
784
- unsigned SrcAddrSpace,
785
- unsigned DestAddrSpace,
779
+ unsigned RemainingBytes, unsigned SrcAddrSpace, unsigned DestAddrSpace,
786
780
unsigned SrcAlign, unsigned DestAlign) const {
787
781
TTIImpl->getMemcpyLoopResidualLoweringType (OpsOut, Context, RemainingBytes,
788
782
SrcAddrSpace, DestAddrSpace,
@@ -848,8 +842,8 @@ unsigned TargetTransformInfo::getStoreVectorFactor(unsigned VF,
848
842
return TTIImpl->getStoreVectorFactor (VF, StoreSize, ChainSizeInBytes, VecTy);
849
843
}
850
844
851
- bool TargetTransformInfo::useReductionIntrinsic (unsigned Opcode,
852
- Type *Ty, ReductionFlags Flags) const {
845
+ bool TargetTransformInfo::useReductionIntrinsic (unsigned Opcode, Type *Ty,
846
+ ReductionFlags Flags) const {
853
847
return TTIImpl->useReductionIntrinsic (Opcode, Ty, Flags);
854
848
}
855
849
@@ -1246,7 +1240,7 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
1246
1240
return getCastInstrCost (I->getOpcode (), I->getType (), SrcTy, I);
1247
1241
}
1248
1242
case Instruction::ExtractElement: {
1249
- const ExtractElementInst * EEI = cast<ExtractElementInst>(I);
1243
+ const ExtractElementInst *EEI = cast<ExtractElementInst>(I);
1250
1244
ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand (1 ));
1251
1245
unsigned Idx = -1 ;
1252
1246
if (CI)
@@ -1260,7 +1254,7 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
1260
1254
switch (matchVectorSplittingReduction (EEI, ReduxOpCode, ReduxType)) {
1261
1255
case RK_Arithmetic:
1262
1256
return getArithmeticReductionCost (ReduxOpCode, ReduxType,
1263
- /* IsPairwiseForm=*/ false );
1257
+ /* IsPairwiseForm=*/ false );
1264
1258
case RK_MinMax:
1265
1259
return getMinMaxReductionCost (
1266
1260
ReduxType, CmpInst::makeCmpResultType (ReduxType),
@@ -1276,7 +1270,7 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
1276
1270
switch (matchPairwiseReduction (EEI, ReduxOpCode, ReduxType)) {
1277
1271
case RK_Arithmetic:
1278
1272
return getArithmeticReductionCost (ReduxOpCode, ReduxType,
1279
- /* IsPairwiseForm=*/ true );
1273
+ /* IsPairwiseForm=*/ true );
1280
1274
case RK_MinMax:
1281
1275
return getMinMaxReductionCost (
1282
1276
ReduxType, CmpInst::makeCmpResultType (ReduxType),
@@ -1289,17 +1283,16 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
1289
1283
break ;
1290
1284
}
1291
1285
1292
- return getVectorInstrCost (I->getOpcode (),
1293
- EEI-> getOperand ( 0 )-> getType (), Idx);
1286
+ return getVectorInstrCost (I->getOpcode (), EEI-> getOperand ( 0 )-> getType (),
1287
+ Idx);
1294
1288
}
1295
1289
case Instruction::InsertElement: {
1296
- const InsertElementInst * IE = cast<InsertElementInst>(I);
1290
+ const InsertElementInst *IE = cast<InsertElementInst>(I);
1297
1291
ConstantInt *CI = dyn_cast<ConstantInt>(IE->getOperand (2 ));
1298
1292
unsigned Idx = -1 ;
1299
1293
if (CI)
1300
1294
Idx = CI->getZExtValue ();
1301
- return getVectorInstrCost (I->getOpcode (),
1302
- IE->getType (), Idx);
1295
+ return getVectorInstrCost (I->getOpcode (), IE->getType (), Idx);
1303
1296
}
1304
1297
case Instruction::ExtractValue:
1305
1298
return 0 ; // Model all ExtractValue nodes as free.
0 commit comments