Skip to content

Commit 2cb357d

Browse files
committed
[RISCV][TTI] Constify a few routines [nfc]
1 parent 84a2155 commit 2cb357d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static cl::opt<unsigned> SLPMaxVF(
3434
"exclusively by SLP vectorizer."),
3535
cl::Hidden);
3636

37-
InstructionCost RISCVTTIImpl::getLMULCost(MVT VT) {
37+
InstructionCost RISCVTTIImpl::getLMULCost(MVT VT) const {
3838
// TODO: Here assume reciprocal throughput is 1 for LMUL_1, it is
3939
// implementation-defined.
4040
if (!VT.isVector())
@@ -266,22 +266,22 @@ static VectorType *getVRGatherIndexType(MVT DataVT, const RISCVSubtarget &ST,
266266
/// Return the cost of a vrgather.vv instruction for the type VT. vrgather.vv
267267
/// is generally quadratic in the number of vreg implied by LMUL. Note that
268268
/// operand (index and possibly mask) are handled separately.
269-
InstructionCost RISCVTTIImpl::getVRGatherVVCost(MVT VT) {
269+
InstructionCost RISCVTTIImpl::getVRGatherVVCost(MVT VT) const {
270270
return getLMULCost(VT) * getLMULCost(VT);
271271
}
272272

273273
/// Return the cost of a vrgather.vi (or vx) instruction for the type VT.
274274
/// vrgather.vi/vx may be linear in the number of vregs implied by LMUL,
275275
/// or may track the vrgather.vv cost. It is implementation-dependent.
276-
InstructionCost RISCVTTIImpl::getVRGatherVICost(MVT VT) {
276+
InstructionCost RISCVTTIImpl::getVRGatherVICost(MVT VT) const {
277277
return getLMULCost(VT);
278278
}
279279

280280
/// Return the cost of a vslidedown.vi/vx or vslideup.vi/vx instruction
281281
/// for the type VT. (This does not cover the vslide1up or vslide1down
282282
/// variants.) Slides may be linear in the number of vregs implied by LMUL,
283283
/// or may track the vrgather.vv cost. It is implementation-dependent.
284-
InstructionCost RISCVTTIImpl::getVSlideCost(MVT VT) {
284+
InstructionCost RISCVTTIImpl::getVSlideCost(MVT VT) const {
285285
return getLMULCost(VT);
286286
}
287287

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
4949
unsigned getEstimatedVLFor(VectorType *Ty);
5050

5151
/// Return the cost of LMUL. The larger the LMUL, the higher the cost.
52-
InstructionCost getLMULCost(MVT VT);
52+
InstructionCost getLMULCost(MVT VT) const;
5353

5454
/// Return the cost of accessing a constant pool entry of the specified
5555
/// type.
@@ -123,9 +123,9 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
123123
return ST->useRVVForFixedLengthVectors() ? 16 : 0;
124124
}
125125

126-
InstructionCost getVRGatherVVCost(MVT VT);
127-
InstructionCost getVRGatherVICost(MVT VT);
128-
InstructionCost getVSlideCost(MVT VT);
126+
InstructionCost getVRGatherVVCost(MVT VT) const;
127+
InstructionCost getVRGatherVICost(MVT VT) const;
128+
InstructionCost getVSlideCost(MVT VT) const;
129129

130130
InstructionCost getShuffleCost(TTI::ShuffleKind Kind, VectorType *Tp,
131131
ArrayRef<int> Mask,

0 commit comments

Comments
 (0)