Skip to content

Commit bbb244c

Browse files
authored
[RISCV] Set CopyCost on register classes [NFC] (#131185)
This change sets up CopyCost to reflect the cost of copying a vector register group, a vector segment, or a register pair. This is NFC because the only actual usage of this field in tree is simply checking that cost is not negative. That heuristic is around ABI copy elimination during instruction emission + scheduling, and doesn't immediately seem like it should apply for us.
1 parent 688d7a5 commit bbb244c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class RISCVRegisterClass<list<ValueType> regTypes, int align, dag regList>
226226
int NF = 1;
227227

228228
let Size = !if(IsVRegClass, !mul(VLMul, NF, 64), 0);
229+
let CopyCost = !if(IsVRegClass, !mul(VLMul, NF), 1);
229230

230231
let TSFlags{0} = IsVRegClass;
231232
let TSFlags{3-1} = !logtwo(VLMul);
@@ -343,7 +344,7 @@ let RegAltNameIndices = [ABIRegAltName] in {
343344
}
344345
}
345346

346-
let RegInfos = XLenPairRI,
347+
let RegInfos = XLenPairRI, CopyCost = 2,
347348
DecoderMethod = "DecodeGPRPairRegisterClass" in {
348349
def GPRPair : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (add
349350
X10_X11, X12_X13, X14_X15, X16_X17,
@@ -357,7 +358,7 @@ def GPRPair : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (add
357358
def GPRPairNoX0 : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (sub GPRPair, X0_Pair)>;
358359
} // let RegInfos = XLenPairRI, DecoderMethod = "DecodeGPRPairRegisterClass"
359360

360-
let RegInfos = XLenPairRI in
361+
let RegInfos = XLenPairRI, CopyCost = 2 in
361362
def GPRPairC : RISCVRegisterClass<[XLenPairVT, XLenPairFVT], 64, (add
362363
X10_X11, X12_X13, X14_X15, X8_X9
363364
)>;

0 commit comments

Comments
 (0)