Skip to content

Commit c482107

Browse files
authored
[GISel] Make target's PartMapping, ValueMapping, and BankIDToCopyMapIdx arrays const. (#71079)
AMDGPU arrays were already const.
1 parent ea89965 commit c482107

8 files changed

+23
-22
lines changed

llvm/lib/Target/AArch64/AArch64GenRegisterBankInfo.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
namespace llvm {
14-
RegisterBankInfo::PartialMapping AArch64GenRegisterBankInfo::PartMappings[]{
14+
const RegisterBankInfo::PartialMapping AArch64GenRegisterBankInfo::PartMappings[]{
1515
/* StartIdx, Length, RegBank */
1616
// 0: FPR 16-bit value.
1717
{0, 16, AArch64::FPRRegBank},
@@ -34,7 +34,7 @@ RegisterBankInfo::PartialMapping AArch64GenRegisterBankInfo::PartMappings[]{
3434
};
3535

3636
// ValueMappings.
37-
RegisterBankInfo::ValueMapping AArch64GenRegisterBankInfo::ValMappings[]{
37+
const RegisterBankInfo::ValueMapping AArch64GenRegisterBankInfo::ValMappings[]{
3838
/* BreakDown, NumBreakDowns */
3939
// 0: invalid
4040
{nullptr, 0},
@@ -212,7 +212,7 @@ AArch64GenRegisterBankInfo::getValueMapping(PartialMappingIdx RBIdx,
212212
return &ValMappings[ValMappingIdx];
213213
}
214214

215-
AArch64GenRegisterBankInfo::PartialMappingIdx
215+
const AArch64GenRegisterBankInfo::PartialMappingIdx
216216
AArch64GenRegisterBankInfo::BankIDToCopyMapIdx[]{
217217
PMI_None, // CCR
218218
PMI_FirstFPR, // FPR

llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class AArch64GenRegisterBankInfo : public RegisterBankInfo {
4343
PMI_Min = PMI_FirstFPR,
4444
};
4545

46-
static RegisterBankInfo::PartialMapping PartMappings[];
47-
static RegisterBankInfo::ValueMapping ValMappings[];
48-
static PartialMappingIdx BankIDToCopyMapIdx[];
46+
static const RegisterBankInfo::PartialMapping PartMappings[];
47+
static const RegisterBankInfo::ValueMapping ValMappings[];
48+
static const PartialMappingIdx BankIDToCopyMapIdx[];
4949

5050
enum ValueMappingIdx {
5151
InvalidIdx = 0,

llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum PartialMappingIdx {
3535
PMI_Min = PMI_GPR,
3636
};
3737

38-
RegisterBankInfo::PartialMapping PartMappings[]{
38+
const RegisterBankInfo::PartialMapping PartMappings[]{
3939
// GPR Partial Mapping
4040
{0, 32, GPRRegBank},
4141
// SPR Partial Mapping
@@ -72,7 +72,7 @@ enum ValueMappingIdx {
7272
DPR3OpsIdx = 7,
7373
};
7474

75-
RegisterBankInfo::ValueMapping ValueMappings[] = {
75+
const RegisterBankInfo::ValueMapping ValueMappings[] = {
7676
// invalid
7777
{nullptr, 0},
7878
// 3 ops in GPRs
@@ -89,8 +89,9 @@ RegisterBankInfo::ValueMapping ValueMappings[] = {
8989
{&PartMappings[PMI_DPR - PMI_Min], 1}};
9090

9191
#ifndef NDEBUG
92-
static bool checkValueMapping(const RegisterBankInfo::ValueMapping &VM,
93-
RegisterBankInfo::PartialMapping *BreakDown) {
92+
static bool
93+
checkValueMapping(const RegisterBankInfo::ValueMapping &VM,
94+
const RegisterBankInfo::PartialMapping *BreakDown) {
9495
return VM.NumBreakDowns == 1 && VM.BreakDown == BreakDown;
9596
}
9697

llvm/lib/Target/M68k/GISel/M68kRegisterBankInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ enum PartialMappingIdx {
3333
PMI_Min = PMI_GPR,
3434
};
3535

36-
RegisterBankInfo::PartialMapping PartMappings[]{
36+
const RegisterBankInfo::PartialMapping PartMappings[]{
3737
// GPR Partial Mapping
3838
{0, 32, GPRRegBank},
3939
};
@@ -43,7 +43,7 @@ enum ValueMappingIdx {
4343
GPR3OpsIdx = 1,
4444
};
4545

46-
RegisterBankInfo::ValueMapping ValueMappings[] = {
46+
const RegisterBankInfo::ValueMapping ValueMappings[] = {
4747
// invalid
4848
{nullptr, 0},
4949
// 3 operands in GPRs

llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum PartialMappingIdx {
3232
PMI_Min = PMI_GPR,
3333
};
3434

35-
RegisterBankInfo::PartialMapping PartMappings[]{
35+
const RegisterBankInfo::PartialMapping PartMappings[]{
3636
{0, 32, GPRBRegBank},
3737
{0, 32, FPRBRegBank},
3838
{0, 64, FPRBRegBank},
@@ -47,7 +47,7 @@ enum ValueMappingIdx {
4747
MSAIdx = 10
4848
};
4949

50-
RegisterBankInfo::ValueMapping ValueMappings[] = {
50+
const RegisterBankInfo::ValueMapping ValueMappings[] = {
5151
// invalid
5252
{nullptr, 0},
5353
// up to 3 operands in GPRs

llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class PPCGenRegisterBankInfo : public RegisterBankInfo {
3737
PMI_Min = PMI_GPR32,
3838
};
3939

40-
static RegisterBankInfo::PartialMapping PartMappings[];
41-
static RegisterBankInfo::ValueMapping ValMappings[];
42-
static PartialMappingIdx BankIDToCopyMapIdx[];
40+
static const RegisterBankInfo::PartialMapping PartMappings[];
41+
static const RegisterBankInfo::ValueMapping ValMappings[];
42+
static const PartialMappingIdx BankIDToCopyMapIdx[];
4343

4444
/// Get the pointer to the ValueMapping representing the RegisterBank
4545
/// at \p RBIdx.

llvm/lib/Target/PowerPC/PPCGenRegisterBankInfo.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
namespace llvm {
15-
RegisterBankInfo::PartialMapping PPCGenRegisterBankInfo::PartMappings[]{
15+
const RegisterBankInfo::PartialMapping PPCGenRegisterBankInfo::PartMappings[]{
1616
/* StartIdx, Length, RegBank */
1717
// 0: GPR 32-bit value.
1818
{0, 32, PPC::GPRRegBank},
@@ -39,7 +39,7 @@ RegisterBankInfo::PartialMapping PPCGenRegisterBankInfo::PartMappings[]{
3939
// 3-operands instructions.
4040
// - Last, mappings for cross-register bank moves follow. Since COPY has only
4141
// 2 operands, a mapping consists of 2 entries.
42-
RegisterBankInfo::ValueMapping PPCGenRegisterBankInfo::ValMappings[]{
42+
const RegisterBankInfo::ValueMapping PPCGenRegisterBankInfo::ValMappings[]{
4343
/* BreakDown, NumBreakDowns */
4444
// 0: invalid
4545
{nullptr, 0},
@@ -77,7 +77,7 @@ PPCGenRegisterBankInfo::getValueMapping(PartialMappingIdx RBIdx) {
7777
return &ValMappings[1 + 3 * ValMappingIdx];
7878
}
7979

80-
PPCGenRegisterBankInfo::PartialMappingIdx
80+
const PPCGenRegisterBankInfo::PartialMappingIdx
8181
PPCGenRegisterBankInfo::BankIDToCopyMapIdx[]{
8282
PMI_None,
8383
PMI_FPR64, // FPR

llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
namespace llvm {
2525
namespace RISCV {
2626

27-
RegisterBankInfo::PartialMapping PartMappings[] = {
27+
const RegisterBankInfo::PartialMapping PartMappings[] = {
2828
{0, 32, GPRRegBank},
2929
{0, 64, GPRRegBank},
3030
{0, 32, FPRRegBank},
@@ -38,7 +38,7 @@ enum PartialMappingIdx {
3838
PMI_FPR64 = 3,
3939
};
4040

41-
RegisterBankInfo::ValueMapping ValueMappings[] = {
41+
const RegisterBankInfo::ValueMapping ValueMappings[] = {
4242
// Invalid value mapping.
4343
{nullptr, 0},
4444
// Maximum 3 GPR operands; 32 bit.

0 commit comments

Comments
 (0)