@@ -371,7 +371,7 @@ bool AArch64TTIImpl::shouldMaximizeVectorBandwidth(
371371// / Calculate the cost of materializing a 64-bit value. This helper
372372// / method might only calculate a fraction of a larger immediate. Therefore it
373373// / is valid to return a cost of ZERO.
374- InstructionCost AArch64TTIImpl::getIntImmCost (int64_t Val) {
374+ InstructionCost AArch64TTIImpl::getIntImmCost (int64_t Val) const {
375375 // Check if the immediate can be encoded within an instruction.
376376 if (Val == 0 || AArch64_AM::isLogicalImmediate (Val, 64 ))
377377 return 0 ;
@@ -386,8 +386,9 @@ InstructionCost AArch64TTIImpl::getIntImmCost(int64_t Val) {
386386}
387387
388388// / 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 {
391392 assert (Ty->isIntegerTy ());
392393
393394 unsigned BitSize = Ty->getPrimitiveSizeInBits ();
@@ -577,7 +578,7 @@ static InstructionCost getHistogramCost(const IntrinsicCostAttributes &ICA) {
577578
578579InstructionCost
579580AArch64TTIImpl::getIntrinsicInstrCost (const IntrinsicCostAttributes &ICA,
580- TTI::TargetCostKind CostKind) {
581+ TTI::TargetCostKind CostKind) const {
581582 // The code-generator is currently not able to handle scalable vectors
582583 // of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
583584 // it. This change will be removed when code-generation for these types is
@@ -2806,7 +2807,7 @@ AArch64TTIImpl::getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const {
28062807
28072808bool AArch64TTIImpl::isWideningInstruction (Type *DstTy, unsigned Opcode,
28082809 ArrayRef<const Value *> Args,
2809- Type *SrcOverrideTy) {
2810+ Type *SrcOverrideTy) const {
28102811 // A helper that returns a vector type from the given type. The number of
28112812 // elements in type Ty determines the vector width.
28122813 auto toVectorTy = [&](Type *ArgTy) {
@@ -2903,7 +2904,7 @@ bool AArch64TTIImpl::isWideningInstruction(Type *DstTy, unsigned Opcode,
29032904// trunc i16 (lshr (add %x, %y), 1) -> i8
29042905//
29052906bool AArch64TTIImpl::isExtPartOfAvgExpr (const Instruction *ExtUser, Type *Dst,
2906- Type *Src) {
2907+ Type *Src) const {
29072908 // The source should be a legal vector type.
29082909 if (!Src->isVectorTy () || !TLI->isTypeLegal (TLI->getValueType (DL, Src)) ||
29092910 (Src->isScalableTy () && !ST->hasSVE2 ()))
@@ -2948,7 +2949,7 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
29482949 Type *Src,
29492950 TTI::CastContextHint CCH,
29502951 TTI::TargetCostKind CostKind,
2951- const Instruction *I) {
2952+ const Instruction *I) const {
29522953 int ISD = TLI->InstructionOpcodeToISD (Opcode);
29532954 assert (ISD && " Invalid opcode" );
29542955 // If the cast is observable, and it is used by a widening instruction (e.g.,
@@ -3619,7 +3620,7 @@ InstructionCost AArch64TTIImpl::getExtractWithExtendCost(unsigned Opcode,
36193620
36203621InstructionCost AArch64TTIImpl::getCFInstrCost (unsigned Opcode,
36213622 TTI::TargetCostKind CostKind,
3622- const Instruction *I) {
3623+ const Instruction *I) const {
36233624 if (CostKind != TTI::TCK_RecipThroughput)
36243625 return Opcode == Instruction::PHI ? 0 : 1 ;
36253626 assert (CostKind == TTI::TCK_RecipThroughput && " unexpected CostKind" );
@@ -3630,7 +3631,7 @@ InstructionCost AArch64TTIImpl::getCFInstrCost(unsigned Opcode,
36303631InstructionCost AArch64TTIImpl::getVectorInstrCostHelper (
36313632 unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index,
36323633 bool HasRealUse, const Instruction *I, Value *Scalar,
3633- ArrayRef<std::tuple<Value *, User *, int >> ScalarUserAndIdx) {
3634+ ArrayRef<std::tuple<Value *, User *, int >> ScalarUserAndIdx) const {
36343635 assert (Val->isVectorTy () && " This must be a vector type" );
36353636
36363637 if (Index != -1U ) {
@@ -3802,7 +3803,7 @@ InstructionCost AArch64TTIImpl::getVectorInstrCostHelper(
38023803InstructionCost AArch64TTIImpl::getVectorInstrCost (unsigned Opcode, Type *Val,
38033804 TTI::TargetCostKind CostKind,
38043805 unsigned Index, Value *Op0,
3805- Value *Op1) {
3806+ Value *Op1) const {
38063807 bool HasRealUse =
38073808 Opcode == Instruction::InsertElement && Op0 && !isa<UndefValue>(Op0);
38083809 return getVectorInstrCostHelper (Opcode, Val, CostKind, Index, HasRealUse);
@@ -3826,7 +3827,7 @@ InstructionCost AArch64TTIImpl::getVectorInstrCost(const Instruction &I,
38263827
38273828InstructionCost AArch64TTIImpl::getScalarizationOverhead (
38283829 VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract,
3829- TTI::TargetCostKind CostKind, ArrayRef<Value *> VL) {
3830+ TTI::TargetCostKind CostKind, ArrayRef<Value *> VL) const {
38303831 if (isa<ScalableVectorType>(Ty))
38313832 return InstructionCost::getInvalid ();
38323833 if (Ty->getElementType ()->isFloatingPointTy ())
@@ -3840,8 +3841,7 @@ InstructionCost AArch64TTIImpl::getScalarizationOverhead(
38403841InstructionCost AArch64TTIImpl::getArithmeticInstrCost (
38413842 unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind,
38423843 TTI::OperandValueInfo Op1Info, TTI::OperandValueInfo Op2Info,
3843- ArrayRef<const Value *> Args,
3844- const Instruction *CxtI) {
3844+ ArrayRef<const Value *> Args, const Instruction *CxtI) const {
38453845
38463846 // The code-generator is currently not able to handle scalable vectors
38473847 // of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
@@ -4171,7 +4171,7 @@ InstructionCost AArch64TTIImpl::getAddressComputationCost(Type *Ty,
41714171InstructionCost AArch64TTIImpl::getCmpSelInstrCost (
41724172 unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred,
41734173 TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info,
4174- TTI::OperandValueInfo Op2Info, const Instruction *I) {
4174+ TTI::OperandValueInfo Op2Info, const Instruction *I) const {
41754175 // TODO: Handle other cost kinds.
41764176 if (CostKind != TTI::TCK_RecipThroughput)
41774177 return BaseT::getCmpSelInstrCost (Opcode, ValTy, CondTy, VecPred, CostKind,
@@ -4284,7 +4284,7 @@ bool AArch64TTIImpl::prefersVectorizedAddressing() const {
42844284InstructionCost
42854285AArch64TTIImpl::getMaskedMemoryOpCost (unsigned Opcode, Type *Src,
42864286 Align Alignment, unsigned AddressSpace,
4287- TTI::TargetCostKind CostKind) {
4287+ TTI::TargetCostKind CostKind) const {
42884288 if (useNeonVector (Src))
42894289 return BaseT::getMaskedMemoryOpCost (Opcode, Src, Alignment, AddressSpace,
42904290 CostKind);
@@ -4331,7 +4331,7 @@ static unsigned getSVEGatherScatterOverhead(unsigned Opcode,
43314331
43324332InstructionCost AArch64TTIImpl::getGatherScatterOpCost (
43334333 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 {
43354335 if (useNeonVector (DataTy) || !isLegalMaskedGatherScatter (DataTy))
43364336 return BaseT::getGatherScatterOpCost (Opcode, DataTy, Ptr, VariableMask,
43374337 Alignment, CostKind, I);
@@ -4371,7 +4371,7 @@ InstructionCost AArch64TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Ty,
43714371 unsigned AddressSpace,
43724372 TTI::TargetCostKind CostKind,
43734373 TTI::OperandValueInfo OpInfo,
4374- const Instruction *I) {
4374+ const Instruction *I) const {
43754375 EVT VT = TLI->getValueType (DL, Ty, true );
43764376 // Type legalization can't handle structs
43774377 if (VT == MVT::Other)
@@ -4980,7 +4980,7 @@ bool AArch64TTIImpl::isLegalToVectorizeReduction(
49804980InstructionCost
49814981AArch64TTIImpl::getMinMaxReductionCost (Intrinsic::ID IID, VectorType *Ty,
49824982 FastMathFlags FMF,
4983- TTI::TargetCostKind CostKind) {
4983+ TTI::TargetCostKind CostKind) const {
49844984 // The code-generator is currently not able to handle scalable vectors
49854985 // of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
49864986 // it. This change will be removed when code-generation for these types is
@@ -5005,7 +5005,7 @@ AArch64TTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty,
50055005}
50065006
50075007InstructionCost AArch64TTIImpl::getArithmeticReductionCostSVE (
5008- unsigned Opcode, VectorType *ValTy, TTI::TargetCostKind CostKind) {
5008+ unsigned Opcode, VectorType *ValTy, TTI::TargetCostKind CostKind) const {
50095009 std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (ValTy);
50105010 InstructionCost LegalizationCost = 0 ;
50115011 if (LT.first > 1 ) {
@@ -5032,7 +5032,7 @@ InstructionCost AArch64TTIImpl::getArithmeticReductionCostSVE(
50325032InstructionCost
50335033AArch64TTIImpl::getArithmeticReductionCost (unsigned Opcode, VectorType *ValTy,
50345034 std::optional<FastMathFlags> FMF,
5035- TTI::TargetCostKind CostKind) {
5035+ TTI::TargetCostKind CostKind) const {
50365036 // The code-generator is currently not able to handle scalable vectors
50375037 // of <vscale x 1 x eltty> yet, so return an invalid cost to avoid selecting
50385038 // it. This change will be removed when code-generation for these types is
@@ -5207,8 +5207,9 @@ AArch64TTIImpl::getMulAccReductionCost(bool IsUnsigned, Type *ResTy,
52075207 return BaseT::getMulAccReductionCost (IsUnsigned, ResTy, VecTy, CostKind);
52085208}
52095209
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 {
52125213 static const CostTblEntry ShuffleTbl[] = {
52135214 { TTI::SK_Splice, MVT::nxv16i8, 1 },
52145215 { TTI::SK_Splice, MVT::nxv8i16, 1 },
@@ -5340,7 +5341,7 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
53405341InstructionCost AArch64TTIImpl::getShuffleCost (
53415342 TTI::ShuffleKind Kind, VectorType *Tp, ArrayRef<int > Mask,
53425343 TTI::TargetCostKind CostKind, int Index, VectorType *SubTp,
5343- ArrayRef<const Value *> Args, const Instruction *CxtI) {
5344+ ArrayRef<const Value *> Args, const Instruction *CxtI) const {
53445345 std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost (Tp);
53455346
53465347 // If we have a Mask, and the LT is being legalized somehow, split the Mask
0 commit comments