Skip to content

Commit 38349eb

Browse files
Simon Mollmemfrob
authored andcommitted
[nfc] clang-format TargetTransformInfo.cpp
1 parent 444bfae commit 38349eb

File tree

1 file changed

+65
-72
lines changed

1 file changed

+65
-72
lines changed

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 65 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
4242
explicit NoTTIImpl(const DataLayout &DL)
4343
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
4444
};
45-
}
45+
} // namespace
4646

4747
bool HardwareLoopInfo::canAnalyze(LoopInfo &LI) {
4848
// If the loop has irreducible control flow, it can not be converted to
@@ -171,23 +171,22 @@ int TargetTransformInfo::getExtCost(const Instruction *I,
171171
return TTIImpl->getExtCost(I, Src);
172172
}
173173

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 {
177177
int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments, U);
178178
assert(Cost >= 0 && "TTI should not produce negative costs!");
179179
return Cost;
180180
}
181181

182-
unsigned
183-
TargetTransformInfo::getEstimatedNumberOfCaseClusters(
182+
unsigned TargetTransformInfo::getEstimatedNumberOfCaseClusters(
184183
const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI,
185184
BlockFrequencyInfo *BFI) const {
186185
return TTIImpl->getEstimatedNumberOfCaseClusters(SI, JTSize, PSI, BFI);
187186
}
188187

189188
int TargetTransformInfo::getUserCost(const User *U,
190-
ArrayRef<const Value *> Operands) const {
189+
ArrayRef<const Value *> Operands) const {
191190
int Cost = TTIImpl->getUserCost(U, Operands);
192191
assert(Cost >= 0 && "TTI should not produce negative costs!");
193192
return Cost;
@@ -214,12 +213,13 @@ unsigned TargetTransformInfo::getFlatAddressSpace() const {
214213
}
215214

216215
bool TargetTransformInfo::collectFlatAddressOperands(
217-
SmallVectorImpl<int> &OpIndexes, Intrinsic::ID IID) const {
216+
SmallVectorImpl<int> &OpIndexes, Intrinsic::ID IID) const {
218217
return TTIImpl->collectFlatAddressOperands(OpIndexes, IID);
219218
}
220219

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 {
223223
return TTIImpl->rewriteIntrinsicWithAddressSpace(II, OldV, NewV);
224224
}
225225

@@ -228,14 +228,15 @@ bool TargetTransformInfo::isLoweredToCall(const Function *F) const {
228228
}
229229

230230
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 {
233233
return TTIImpl->isHardwareLoopProfitable(L, SE, AC, LibInfo, HWLoopInfo);
234234
}
235235

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 {
239240
return TTIImpl->preferPredicateOverEpilogue(L, LI, SE, AC, TLI, DT, LAI);
240241
}
241242

@@ -254,8 +255,7 @@ bool TargetTransformInfo::isLegalICmpImmediate(int64_t Imm) const {
254255

255256
bool TargetTransformInfo::isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV,
256257
int64_t BaseOffset,
257-
bool HasBaseReg,
258-
int64_t Scale,
258+
bool HasBaseReg, int64_t Scale,
259259
unsigned AddrSpace,
260260
Instruction *I) const {
261261
return TTIImpl->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg,
@@ -337,8 +337,7 @@ bool TargetTransformInfo::prefersVectorizedAddressing() const {
337337

338338
int TargetTransformInfo::getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
339339
int64_t BaseOffset,
340-
bool HasBaseReg,
341-
int64_t Scale,
340+
bool HasBaseReg, int64_t Scale,
342341
unsigned AddrSpace) const {
343342
int Cost = TTIImpl->getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg,
344343
Scale, AddrSpace);
@@ -367,30 +366,31 @@ bool TargetTransformInfo::isTypeLegal(Type *Ty) const {
367366
bool TargetTransformInfo::shouldBuildLookupTables() const {
368367
return TTIImpl->shouldBuildLookupTables();
369368
}
370-
bool TargetTransformInfo::shouldBuildLookupTablesForConstant(Constant *C) const {
369+
bool TargetTransformInfo::shouldBuildLookupTablesForConstant(
370+
Constant *C) const {
371371
return TTIImpl->shouldBuildLookupTablesForConstant(C);
372372
}
373373

374374
bool TargetTransformInfo::useColdCCForColdCall(Function &F) const {
375375
return TTIImpl->useColdCCForColdCall(F);
376376
}
377377

378-
unsigned TargetTransformInfo::
379-
getScalarizationOverhead(Type *Ty, bool Insert, bool Extract) const {
378+
unsigned TargetTransformInfo::getScalarizationOverhead(Type *Ty, bool Insert,
379+
bool Extract) const {
380380
return TTIImpl->getScalarizationOverhead(Ty, Insert, Extract);
381381
}
382382

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 {
386385
return TTIImpl->getOperandsScalarizationOverhead(Args, VF);
387386
}
388387

389388
bool TargetTransformInfo::supportsEfficientVectorElementLoadStore() const {
390389
return TTIImpl->supportsEfficientVectorElementLoadStore();
391390
}
392391

393-
bool TargetTransformInfo::enableAggressiveInterleaving(bool LoopHasReductions) const {
392+
bool TargetTransformInfo::enableAggressiveInterleaving(
393+
bool LoopHasReductions) const {
394394
return TTIImpl->enableAggressiveInterleaving(LoopHasReductions);
395395
}
396396

@@ -416,8 +416,8 @@ bool TargetTransformInfo::allowsMisalignedMemoryAccesses(LLVMContext &Context,
416416
unsigned AddressSpace,
417417
unsigned Alignment,
418418
bool *Fast) const {
419-
return TTIImpl->allowsMisalignedMemoryAccesses(Context, BitWidth, AddressSpace,
420-
Alignment, Fast);
419+
return TTIImpl->allowsMisalignedMemoryAccesses(Context, BitWidth,
420+
AddressSpace, Alignment, Fast);
421421
}
422422

423423
TargetTransformInfo::PopcntSupportKind
@@ -471,11 +471,12 @@ unsigned TargetTransformInfo::getNumberOfRegisters(unsigned ClassID) const {
471471
return TTIImpl->getNumberOfRegisters(ClassID);
472472
}
473473

474-
unsigned TargetTransformInfo::getRegisterClassForType(bool Vector, Type *Ty) const {
474+
unsigned TargetTransformInfo::getRegisterClassForType(bool Vector,
475+
Type *Ty) const {
475476
return TTIImpl->getRegisterClassForType(Vector, Ty);
476477
}
477478

478-
const char* TargetTransformInfo::getRegisterClassName(unsigned ClassID) const {
479+
const char *TargetTransformInfo::getRegisterClassName(unsigned ClassID) const {
479480
return TTIImpl->getRegisterClassName(ClassID);
480481
}
481482

@@ -505,24 +506,23 @@ unsigned TargetTransformInfo::getCacheLineSize() const {
505506
return TTIImpl->getCacheLineSize();
506507
}
507508

508-
llvm::Optional<unsigned> TargetTransformInfo::getCacheSize(CacheLevel Level)
509-
const {
509+
llvm::Optional<unsigned>
510+
TargetTransformInfo::getCacheSize(CacheLevel Level) const {
510511
return TTIImpl->getCacheSize(Level);
511512
}
512513

513-
llvm::Optional<unsigned> TargetTransformInfo::getCacheAssociativity(
514-
CacheLevel Level) const {
514+
llvm::Optional<unsigned>
515+
TargetTransformInfo::getCacheAssociativity(CacheLevel Level) const {
515516
return TTIImpl->getCacheAssociativity(Level);
516517
}
517518

518519
unsigned TargetTransformInfo::getPrefetchDistance() const {
519520
return TTIImpl->getPrefetchDistance();
520521
}
521522

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 {
526526
return TTIImpl->getMinPrefetchStride(NumMemAccesses, NumStridedMemAccesses,
527527
NumPrefetches, HasCall);
528528
}
@@ -606,10 +606,10 @@ int TargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Ty, int Index,
606606
return Cost;
607607
}
608608

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.");
613613
int Cost = TTIImpl->getCastInstrCost(Opcode, Dst, Src, I);
614614
assert(Cost >= 0 && "TTI should not produce negative costs!");
615615
return Cost;
@@ -630,9 +630,10 @@ int TargetTransformInfo::getCFInstrCost(unsigned Opcode) const {
630630
}
631631

632632
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.");
636637
int Cost = TTIImpl->getCmpSelInstrCost(Opcode, ValTy, CondTy, I);
637638
assert(Cost >= 0 && "TTI should not produce negative costs!");
638639
return Cost;
@@ -649,8 +650,8 @@ int TargetTransformInfo::getMemoryOpCost(unsigned Opcode, Type *Src,
649650
MaybeAlign Alignment,
650651
unsigned AddressSpace,
651652
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.");
654655
int Cost = TTIImpl->getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, I);
655656
assert(Cost >= 0 && "TTI should not produce negative costs!");
656657
return Cost;
@@ -679,10 +680,9 @@ int TargetTransformInfo::getInterleavedMemoryOpCost(
679680
unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef<unsigned> Indices,
680681
unsigned Alignment, unsigned AddressSpace, bool UseMaskForCond,
681682
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);
686686
assert(Cost >= 0 && "TTI should not produce negative costs!");
687687
return Cost;
688688
}
@@ -767,22 +767,16 @@ Value *TargetTransformInfo::getOrCreateResultFromMemIntrinsic(
767767
return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType);
768768
}
769769

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 {
776773
return TTIImpl->getMemcpyLoopLoweringType(Context, Length, SrcAddrSpace,
777-
DestAddrSpace, SrcAlign,
778-
DestAlign);
774+
DestAddrSpace, SrcAlign, DestAlign);
779775
}
780776

781777
void TargetTransformInfo::getMemcpyLoopResidualLoweringType(
782778
SmallVectorImpl<Type *> &OpsOut, LLVMContext &Context,
783-
unsigned RemainingBytes,
784-
unsigned SrcAddrSpace,
785-
unsigned DestAddrSpace,
779+
unsigned RemainingBytes, unsigned SrcAddrSpace, unsigned DestAddrSpace,
786780
unsigned SrcAlign, unsigned DestAlign) const {
787781
TTIImpl->getMemcpyLoopResidualLoweringType(OpsOut, Context, RemainingBytes,
788782
SrcAddrSpace, DestAddrSpace,
@@ -848,8 +842,8 @@ unsigned TargetTransformInfo::getStoreVectorFactor(unsigned VF,
848842
return TTIImpl->getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy);
849843
}
850844

851-
bool TargetTransformInfo::useReductionIntrinsic(unsigned Opcode,
852-
Type *Ty, ReductionFlags Flags) const {
845+
bool TargetTransformInfo::useReductionIntrinsic(unsigned Opcode, Type *Ty,
846+
ReductionFlags Flags) const {
853847
return TTIImpl->useReductionIntrinsic(Opcode, Ty, Flags);
854848
}
855849

@@ -1246,7 +1240,7 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
12461240
return getCastInstrCost(I->getOpcode(), I->getType(), SrcTy, I);
12471241
}
12481242
case Instruction::ExtractElement: {
1249-
const ExtractElementInst * EEI = cast<ExtractElementInst>(I);
1243+
const ExtractElementInst *EEI = cast<ExtractElementInst>(I);
12501244
ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1));
12511245
unsigned Idx = -1;
12521246
if (CI)
@@ -1260,7 +1254,7 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
12601254
switch (matchVectorSplittingReduction(EEI, ReduxOpCode, ReduxType)) {
12611255
case RK_Arithmetic:
12621256
return getArithmeticReductionCost(ReduxOpCode, ReduxType,
1263-
/*IsPairwiseForm=*/false);
1257+
/*IsPairwiseForm=*/false);
12641258
case RK_MinMax:
12651259
return getMinMaxReductionCost(
12661260
ReduxType, CmpInst::makeCmpResultType(ReduxType),
@@ -1276,7 +1270,7 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
12761270
switch (matchPairwiseReduction(EEI, ReduxOpCode, ReduxType)) {
12771271
case RK_Arithmetic:
12781272
return getArithmeticReductionCost(ReduxOpCode, ReduxType,
1279-
/*IsPairwiseForm=*/true);
1273+
/*IsPairwiseForm=*/true);
12801274
case RK_MinMax:
12811275
return getMinMaxReductionCost(
12821276
ReduxType, CmpInst::makeCmpResultType(ReduxType),
@@ -1289,17 +1283,16 @@ int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
12891283
break;
12901284
}
12911285

1292-
return getVectorInstrCost(I->getOpcode(),
1293-
EEI->getOperand(0)->getType(), Idx);
1286+
return getVectorInstrCost(I->getOpcode(), EEI->getOperand(0)->getType(),
1287+
Idx);
12941288
}
12951289
case Instruction::InsertElement: {
1296-
const InsertElementInst * IE = cast<InsertElementInst>(I);
1290+
const InsertElementInst *IE = cast<InsertElementInst>(I);
12971291
ConstantInt *CI = dyn_cast<ConstantInt>(IE->getOperand(2));
12981292
unsigned Idx = -1;
12991293
if (CI)
13001294
Idx = CI->getZExtValue();
1301-
return getVectorInstrCost(I->getOpcode(),
1302-
IE->getType(), Idx);
1295+
return getVectorInstrCost(I->getOpcode(), IE->getType(), Idx);
13031296
}
13041297
case Instruction::ExtractValue:
13051298
return 0; // Model all ExtractValue nodes as free.

0 commit comments

Comments
 (0)