@@ -371,7 +371,7 @@ bool AArch64TTIImpl::shouldMaximizeVectorBandwidth(
371
371
// / Calculate the cost of materializing a 64-bit value. This helper
372
372
// / method might only calculate a fraction of a larger immediate. Therefore it
373
373
// / is valid to return a cost of ZERO.
374
- InstructionCost AArch64TTIImpl::getIntImmCost (int64_t Val) {
374
+ InstructionCost AArch64TTIImpl::getIntImmCost (int64_t Val) const {
375
375
// Check if the immediate can be encoded within an instruction.
376
376
if (Val == 0 || AArch64_AM::isLogicalImmediate (Val, 64 ))
377
377
return 0 ;
@@ -386,8 +386,9 @@ InstructionCost AArch64TTIImpl::getIntImmCost(int64_t Val) {
386
386
}
387
387
388
388
// / Calculate the cost of materializing the given constant.
389
- InstructionCost AArch64TTIImpl::getIntImmCost (const APInt &Imm, Type *Ty,
390
- TTI::TargetCostKind CostKind) {
389
+ InstructionCost
390
+ AArch64TTIImpl::getIntImmCost (const APInt &Imm, Type *Ty,
391
+ TTI::TargetCostKind CostKind) const {
391
392
assert (Ty->isIntegerTy ());
392
393
393
394
unsigned BitSize = Ty->getPrimitiveSizeInBits ();
@@ -577,7 +578,7 @@ static InstructionCost getHistogramCost(const IntrinsicCostAttributes &ICA) {
577
578
578
579
InstructionCost
579
580
AArch64TTIImpl::getIntrinsicInstrCost (const IntrinsicCostAttributes &ICA,
580
- TTI::TargetCostKind CostKind) {
581
+ TTI::TargetCostKind CostKind) const {
581
582
// The code-generator is currently not able to handle scalable vectors
582
583
// of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
583
584
// it. This change will be removed when code-generation for these types is
@@ -2806,7 +2807,7 @@ AArch64TTIImpl::getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const {
2806
2807
2807
2808
bool AArch64TTIImpl::isWideningInstruction (Type *DstTy, unsigned Opcode,
2808
2809
ArrayRef<const Value *> Args,
2809
- Type *SrcOverrideTy) {
2810
+ Type *SrcOverrideTy) const {
2810
2811
// A helper that returns a vector type from the given type. The number of
2811
2812
// elements in type Ty determines the vector width.
2812
2813
auto toVectorTy = [&](Type *ArgTy) {
@@ -2903,7 +2904,7 @@ bool AArch64TTIImpl::isWideningInstruction(Type *DstTy, unsigned Opcode,
2903
2904
// trunc i16 (lshr (add %x, %y), 1) -> i8
2904
2905
//
2905
2906
bool AArch64TTIImpl::isExtPartOfAvgExpr (const Instruction *ExtUser, Type *Dst,
2906
- Type *Src) {
2907
+ Type *Src) const {
2907
2908
// The source should be a legal vector type.
2908
2909
if (!Src->isVectorTy () || !TLI->isTypeLegal (TLI->getValueType (DL, Src)) ||
2909
2910
(Src->isScalableTy () && !ST->hasSVE2 ()))
@@ -2948,7 +2949,7 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
2948
2949
Type *Src,
2949
2950
TTI::CastContextHint CCH,
2950
2951
TTI::TargetCostKind CostKind,
2951
- const Instruction *I) {
2952
+ const Instruction *I) const {
2952
2953
int ISD = TLI->InstructionOpcodeToISD (Opcode);
2953
2954
assert (ISD && " Invalid opcode" );
2954
2955
// If the cast is observable, and it is used by a widening instruction (e.g.,
@@ -3619,7 +3620,7 @@ InstructionCost AArch64TTIImpl::getExtractWithExtendCost(unsigned Opcode,
3619
3620
3620
3621
InstructionCost AArch64TTIImpl::getCFInstrCost (unsigned Opcode,
3621
3622
TTI::TargetCostKind CostKind,
3622
- const Instruction *I) {
3623
+ const Instruction *I) const {
3623
3624
if (CostKind != TTI::TCK_RecipThroughput)
3624
3625
return Opcode == Instruction::PHI ? 0 : 1 ;
3625
3626
assert (CostKind == TTI::TCK_RecipThroughput && " unexpected CostKind" );
@@ -3630,7 +3631,7 @@ InstructionCost AArch64TTIImpl::getCFInstrCost(unsigned Opcode,
3630
3631
InstructionCost AArch64TTIImpl::getVectorInstrCostHelper (
3631
3632
unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
3632
3633
bool HasRealUse, const Instruction *I, Value *Scalar,
3633
- ArrayRef<std::tuple<Value *, User *, int >> ScalarUserAndIdx) {
3634
+ ArrayRef<std::tuple<Value *, User *, int >> ScalarUserAndIdx) const {
3634
3635
assert (Val->isVectorTy () && " This must be a vector type" );
3635
3636
3636
3637
if (Index != -1U ) {
@@ -3802,7 +3803,7 @@ InstructionCost AArch64TTIImpl::getVectorInstrCostHelper(
3802
3803
InstructionCost AArch64TTIImpl::getVectorInstrCost (unsigned Opcode, Type *Val,
3803
3804
TTI::TargetCostKind CostKind,
3804
3805
unsigned Index, Value *Op0,
3805
- Value *Op1) {
3806
+ Value *Op1) const {
3806
3807
bool HasRealUse =
3807
3808
Opcode == Instruction::InsertElement && Op0 && !isa<UndefValue>(Op0);
3808
3809
return getVectorInstrCostHelper (Opcode, Val, CostKind, Index, HasRealUse);
@@ -3826,7 +3827,7 @@ InstructionCost AArch64TTIImpl::getVectorInstrCost(const Instruction &I,
3826
3827
3827
3828
InstructionCost AArch64TTIImpl::getScalarizationOverhead (
3828
3829
VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract,
3829
- TTI::TargetCostKind CostKind, ArrayRef<Value *> VL) {
3830
+ TTI::TargetCostKind CostKind, ArrayRef<Value *> VL) const {
3830
3831
if (isa<ScalableVectorType>(Ty))
3831
3832
return InstructionCost::getInvalid ();
3832
3833
if (Ty->getElementType ()->isFloatingPointTy ())
@@ -3840,8 +3841,7 @@ InstructionCost AArch64TTIImpl::getScalarizationOverhead(
3840
3841
InstructionCost AArch64TTIImpl::getArithmeticInstrCost (
3841
3842
unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
3842
3843
TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
3843
- ArrayRef<const Value *> Args,
3844
- const Instruction *CxtI) {
3844
+ ArrayRef<const Value *> Args, const Instruction *CxtI) const {
3845
3845
3846
3846
// The code-generator is currently not able to handle scalable vectors
3847
3847
// of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
@@ -4171,7 +4171,7 @@ InstructionCost AArch64TTIImpl::getAddressComputationCost(Type *Ty,
4171
4171
InstructionCost AArch64TTIImpl::getCmpSelInstrCost (
4172
4172
unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
4173
4173
TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info,
4174
- TTI::OperandValueInfo Op2Info, const Instruction *I) {
4174
+ TTI::OperandValueInfo Op2Info, const Instruction *I) const {
4175
4175
// TODO: Handle other cost kinds.
4176
4176
if (CostKind != TTI::TCK_RecipThroughput)
4177
4177
return BaseT::getCmpSelInstrCost (Opcode, ValTy, CondTy, VecPred, CostKind,
@@ -4284,7 +4284,7 @@ bool AArch64TTIImpl::prefersVectorizedAddressing() const {
4284
4284
InstructionCost
4285
4285
AArch64TTIImpl::getMaskedMemoryOpCost (unsigned Opcode, Type *Src,
4286
4286
Align Alignment, unsigned AddressSpace,
4287
- TTI::TargetCostKind CostKind) {
4287
+ TTI::TargetCostKind CostKind) const {
4288
4288
if (useNeonVector (Src))
4289
4289
return BaseT::getMaskedMemoryOpCost (Opcode, Src, Alignment, AddressSpace,
4290
4290
CostKind);
@@ -4331,7 +4331,7 @@ static unsigned getSVEGatherScatterOverhead(unsigned Opcode,
4331
4331
4332
4332
InstructionCost AArch64TTIImpl::getGatherScatterOpCost (
4333
4333
unsigned Opcode, Type *DataTy, const Value *Ptr , bool VariableMask,
4334
- Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
4334
+ Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) const {
4335
4335
if (useNeonVector (DataTy) || !isLegalMaskedGatherScatter (DataTy))
4336
4336
return BaseT::getGatherScatterOpCost (Opcode, DataTy, Ptr , VariableMask,
4337
4337
Alignment, CostKind, I);
@@ -4371,7 +4371,7 @@ InstructionCost AArch64TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Ty,
4371
4371
unsigned AddressSpace,
4372
4372
TTI::TargetCostKind CostKind,
4373
4373
TTI::OperandValueInfo OpInfo,
4374
- const Instruction *I) {
4374
+ const Instruction *I) const {
4375
4375
EVT VT = TLI->getValueType (DL, Ty, true );
4376
4376
// Type legalization can't handle structs
4377
4377
if (VT == MVT::Other)
@@ -4980,7 +4980,7 @@ bool AArch64TTIImpl::isLegalToVectorizeReduction(
4980
4980
InstructionCost
4981
4981
AArch64TTIImpl::getMinMaxReductionCost (Intrinsic::ID IID, VectorType *Ty,
4982
4982
FastMathFlags FMF,
4983
- TTI::TargetCostKind CostKind) {
4983
+ TTI::TargetCostKind CostKind) const {
4984
4984
// The code-generator is currently not able to handle scalable vectors
4985
4985
// of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
4986
4986
// it. This change will be removed when code-generation for these types is
@@ -5005,7 +5005,7 @@ AArch64TTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty,
5005
5005
}
5006
5006
5007
5007
InstructionCost AArch64TTIImpl::getArithmeticReductionCostSVE (
5008
- unsigned Opcode, VectorType *ValTy, TTI::TargetCostKind CostKind) {
5008
+ unsigned Opcode, VectorType *ValTy, TTI::TargetCostKind CostKind) const {
5009
5009
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (ValTy);
5010
5010
InstructionCost LegalizationCost = 0 ;
5011
5011
if (LT.first > 1 ) {
@@ -5032,7 +5032,7 @@ InstructionCost AArch64TTIImpl::getArithmeticReductionCostSVE(
5032
5032
InstructionCost
5033
5033
AArch64TTIImpl::getArithmeticReductionCost (unsigned Opcode, VectorType *ValTy,
5034
5034
std::optional<FastMathFlags> FMF,
5035
- TTI::TargetCostKind CostKind) {
5035
+ TTI::TargetCostKind CostKind) const {
5036
5036
// The code-generator is currently not able to handle scalable vectors
5037
5037
// of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
5038
5038
// it. This change will be removed when code-generation for these types is
@@ -5207,8 +5207,9 @@ AArch64TTIImpl::getMulAccReductionCost(bool IsUnsigned, Type *ResTy,
5207
5207
return BaseT::getMulAccReductionCost (IsUnsigned, ResTy, VecTy, CostKind);
5208
5208
}
5209
5209
5210
- InstructionCost AArch64TTIImpl::getSpliceCost (VectorType *Tp, int Index,
5211
- TTI::TargetCostKind CostKind) {
5210
+ InstructionCost
5211
+ AArch64TTIImpl::getSpliceCost (VectorType *Tp, int Index,
5212
+ TTI::TargetCostKind CostKind) const {
5212
5213
static const CostTblEntry ShuffleTbl[] = {
5213
5214
{ TTI::SK_Splice, MVT::nxv16i8, 1 },
5214
5215
{ TTI::SK_Splice, MVT::nxv8i16, 1 },
@@ -5340,7 +5341,7 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
5340
5341
InstructionCost AArch64TTIImpl::getShuffleCost (
5341
5342
TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef<int > Mask,
5342
5343
TTI::TargetCostKind CostKind, int Index, VectorType *SubTp,
5343
- ArrayRef<const Value *> Args, const Instruction *CxtI) {
5344
+ ArrayRef<const Value *> Args, const Instruction *CxtI) const {
5344
5345
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (Tp);
5345
5346
5346
5347
// If we have a Mask, and the LT is being legalized somehow, split the Mask
0 commit comments