Skip to content

[GISel] Make target's PartMapping, ValueMapping, and BankIDToCopyMapIdx arrays const. #71079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/lib/Target/AArch64/AArch64GenRegisterBankInfo.def
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

namespace llvm {
RegisterBankInfo::PartialMapping AArch64GenRegisterBankInfo::PartMappings[]{
const RegisterBankInfo::PartialMapping AArch64GenRegisterBankInfo::PartMappings[]{
/* StartIdx, Length, RegBank */
// 0: FPR 16-bit value.
{0, 16, AArch64::FPRRegBank},
Expand All @@ -34,7 +34,7 @@ RegisterBankInfo::PartialMapping AArch64GenRegisterBankInfo::PartMappings[]{
};

// ValueMappings.
RegisterBankInfo::ValueMapping AArch64GenRegisterBankInfo::ValMappings[]{
const RegisterBankInfo::ValueMapping AArch64GenRegisterBankInfo::ValMappings[]{
/* BreakDown, NumBreakDowns */
// 0: invalid
{nullptr, 0},
Expand Down Expand Up @@ -212,7 +212,7 @@ AArch64GenRegisterBankInfo::getValueMapping(PartialMappingIdx RBIdx,
return &ValMappings[ValMappingIdx];
}

AArch64GenRegisterBankInfo::PartialMappingIdx
const AArch64GenRegisterBankInfo::PartialMappingIdx
AArch64GenRegisterBankInfo::BankIDToCopyMapIdx[]{
PMI_None, // CCR
PMI_FirstFPR, // FPR
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/AArch64/GISel/AArch64RegisterBankInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class AArch64GenRegisterBankInfo : public RegisterBankInfo {
PMI_Min = PMI_FirstFPR,
};

static RegisterBankInfo::PartialMapping PartMappings[];
static RegisterBankInfo::ValueMapping ValMappings[];
static PartialMappingIdx BankIDToCopyMapIdx[];
static const RegisterBankInfo::PartialMapping PartMappings[];
static const RegisterBankInfo::ValueMapping ValMappings[];
static const PartialMappingIdx BankIDToCopyMapIdx[];

enum ValueMappingIdx {
InvalidIdx = 0,
Expand Down
9 changes: 5 additions & 4 deletions llvm/lib/Target/ARM/ARMRegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum PartialMappingIdx {
PMI_Min = PMI_GPR,
};

RegisterBankInfo::PartialMapping PartMappings[]{
const RegisterBankInfo::PartialMapping PartMappings[]{
// GPR Partial Mapping
{0, 32, GPRRegBank},
// SPR Partial Mapping
Expand Down Expand Up @@ -72,7 +72,7 @@ enum ValueMappingIdx {
DPR3OpsIdx = 7,
};

RegisterBankInfo::ValueMapping ValueMappings[] = {
const RegisterBankInfo::ValueMapping ValueMappings[] = {
// invalid
{nullptr, 0},
// 3 ops in GPRs
Expand All @@ -89,8 +89,9 @@ RegisterBankInfo::ValueMapping ValueMappings[] = {
{&PartMappings[PMI_DPR - PMI_Min], 1}};

#ifndef NDEBUG
static bool checkValueMapping(const RegisterBankInfo::ValueMapping &VM,
RegisterBankInfo::PartialMapping *BreakDown) {
static bool
checkValueMapping(const RegisterBankInfo::ValueMapping &VM,
const RegisterBankInfo::PartialMapping *BreakDown) {
return VM.NumBreakDowns == 1 && VM.BreakDown == BreakDown;
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/M68k/GISel/M68kRegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum PartialMappingIdx {
PMI_Min = PMI_GPR,
};

RegisterBankInfo::PartialMapping PartMappings[]{
const RegisterBankInfo::PartialMapping PartMappings[]{
// GPR Partial Mapping
{0, 32, GPRRegBank},
};
Expand All @@ -43,7 +43,7 @@ enum ValueMappingIdx {
GPR3OpsIdx = 1,
};

RegisterBankInfo::ValueMapping ValueMappings[] = {
const RegisterBankInfo::ValueMapping ValueMappings[] = {
// invalid
{nullptr, 0},
// 3 operands in GPRs
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/Mips/MipsRegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum PartialMappingIdx {
PMI_Min = PMI_GPR,
};

RegisterBankInfo::PartialMapping PartMappings[]{
const RegisterBankInfo::PartialMapping PartMappings[]{
{0, 32, GPRBRegBank},
{0, 32, FPRBRegBank},
{0, 64, FPRBRegBank},
Expand All @@ -47,7 +47,7 @@ enum ValueMappingIdx {
MSAIdx = 10
};

RegisterBankInfo::ValueMapping ValueMappings[] = {
const RegisterBankInfo::ValueMapping ValueMappings[] = {
// invalid
{nullptr, 0},
// up to 3 operands in GPRs
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class PPCGenRegisterBankInfo : public RegisterBankInfo {
PMI_Min = PMI_GPR32,
};

static RegisterBankInfo::PartialMapping PartMappings[];
static RegisterBankInfo::ValueMapping ValMappings[];
static PartialMappingIdx BankIDToCopyMapIdx[];
static const RegisterBankInfo::PartialMapping PartMappings[];
static const RegisterBankInfo::ValueMapping ValMappings[];
static const PartialMappingIdx BankIDToCopyMapIdx[];

/// Get the pointer to the ValueMapping representing the RegisterBank
/// at \p RBIdx.
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/PowerPC/PPCGenRegisterBankInfo.def
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//

namespace llvm {
RegisterBankInfo::PartialMapping PPCGenRegisterBankInfo::PartMappings[]{
const RegisterBankInfo::PartialMapping PPCGenRegisterBankInfo::PartMappings[]{
/* StartIdx, Length, RegBank */
// 0: GPR 32-bit value.
{0, 32, PPC::GPRRegBank},
Expand All @@ -39,7 +39,7 @@ RegisterBankInfo::PartialMapping PPCGenRegisterBankInfo::PartMappings[]{
// 3-operands instructions.
// - Last, mappings for cross-register bank moves follow. Since COPY has only
// 2 operands, a mapping consists of 2 entries.
RegisterBankInfo::ValueMapping PPCGenRegisterBankInfo::ValMappings[]{
const RegisterBankInfo::ValueMapping PPCGenRegisterBankInfo::ValMappings[]{
/* BreakDown, NumBreakDowns */
// 0: invalid
{nullptr, 0},
Expand Down Expand Up @@ -77,7 +77,7 @@ PPCGenRegisterBankInfo::getValueMapping(PartialMappingIdx RBIdx) {
return &ValMappings[1 + 3 * ValMappingIdx];
}

PPCGenRegisterBankInfo::PartialMappingIdx
const PPCGenRegisterBankInfo::PartialMappingIdx
PPCGenRegisterBankInfo::BankIDToCopyMapIdx[]{
PMI_None,
PMI_FPR64, // FPR
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
namespace llvm {
namespace RISCV {

RegisterBankInfo::PartialMapping PartMappings[] = {
const RegisterBankInfo::PartialMapping PartMappings[] = {
{0, 32, GPRRegBank},
{0, 64, GPRRegBank},
{0, 32, FPRRegBank},
Expand All @@ -38,7 +38,7 @@ enum PartialMappingIdx {
PMI_FPR64 = 3,
};

RegisterBankInfo::ValueMapping ValueMappings[] = {
const RegisterBankInfo::ValueMapping ValueMappings[] = {
// Invalid value mapping.
{nullptr, 0},
// Maximum 3 GPR operands; 32 bit.
Expand Down