forked from OSchip/llvm-project
[globalisel][aarch64] Fix unintended assumptions about PartialMappingIdx. NFC.
Summary: This is NFC but prevents assertions when PartialMappingIdx is tablegen-erated. The assumptions were: 1) FirstGPR is 0 2) FirstGPR is the first of the First* enumerators. GPR32 is changed to 1 to demonstrate that assumption #1 is fixed. #2 will be covered by a subsequent patch that tablegen-erates information and swaps the order of GPR and FPR as a side effect. Depends on D27336 Reviewers: ab, t.p.northover, qcolombet Subscribers: aemerson, rengolin, vkalintiris, dberris, rovka, llvm-commits Differential Revision: https://reviews.llvm.org/D27337 llvm-svn: 288812
This commit is contained in:
parent
1b8eb4104b
commit
4fd1e7c628
|
|
@ -27,7 +27,7 @@ RegisterBank *RegBanks[] = {&GPRRegBank, &FPRRegBank, &CCRRegBank};
|
|||
// PartialMappings.
|
||||
enum PartialMappingIdx {
|
||||
PMI_None = -1,
|
||||
PMI_GPR32 = 0,
|
||||
PMI_GPR32 = 1,
|
||||
PMI_GPR64,
|
||||
PMI_FPR32,
|
||||
PMI_FPR64,
|
||||
|
|
@ -137,10 +137,11 @@ const RegisterBankInfo::ValueMapping *
|
|||
getValueMapping(PartialMappingIdx RBIdx, unsigned Size) {
|
||||
assert(RBIdx != PartialMappingIdx::PMI_None && "No mapping needed for that");
|
||||
unsigned ValMappingIdx = First3OpsIdx +
|
||||
(RBIdx + getRegBankBaseIdxOffset(Size)) *
|
||||
ValueMappingIdx::DistanceBetweenRegBanks;
|
||||
assert(ValMappingIdx >= AArch64::First3OpsIdx &&
|
||||
ValMappingIdx <= AArch64::Last3OpsIdx && "Mapping out of bound");
|
||||
(RBIdx - AArch64::PartialMappingIdx::PMI_Min +
|
||||
getRegBankBaseIdxOffset(Size)) *
|
||||
ValueMappingIdx::DistanceBetweenRegBanks;
|
||||
assert(ValMappingIdx >= AArch64::First3OpsIdx &&
|
||||
ValMappingIdx <= AArch64::Last3OpsIdx && "Mapping out of bound");
|
||||
|
||||
return &ValMappings[ValMappingIdx];
|
||||
}
|
||||
|
|
@ -160,7 +161,7 @@ getCopyMapping(bool DstIsGPR, bool SrcIsGPR, unsigned Size) {
|
|||
assert(Size <= 64 && "GPR cannot handle that size");
|
||||
unsigned ValMappingIdx =
|
||||
FirstCrossRegCpyIdx +
|
||||
(DstRBIdx - PMI_FirstGPR + getRegBankBaseIdxOffset(Size)) *
|
||||
(DstRBIdx - PMI_Min + getRegBankBaseIdxOffset(Size)) *
|
||||
ValueMappingIdx::DistanceBetweenCrossRegCpy;
|
||||
assert(ValMappingIdx >= AArch64::FirstCrossRegCpyIdx &&
|
||||
ValMappingIdx <= AArch64::LastCrossRegCpyIdx &&
|
||||
|
|
|
|||
|
|
@ -115,8 +115,9 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI)
|
|||
#define CHECK_PARTIALMAP(Idx, ValStartIdx, ValLength, RB) \
|
||||
do { \
|
||||
const PartialMapping &Map = \
|
||||
AArch64::PartMappings[AArch64::PartialMappingIdx::Idx]; \
|
||||
(void) Map; \
|
||||
AArch64::PartMappings[AArch64::PartialMappingIdx::Idx - \
|
||||
AArch64::PartialMappingIdx::PMI_Min]; \
|
||||
(void)Map; \
|
||||
assert(Map.StartIdx == ValStartIdx && Map.Length == ValLength && \
|
||||
Map.RegBank == &RB && #Idx " is incorrectly initialized"); \
|
||||
} while (0)
|
||||
|
|
@ -132,12 +133,13 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI)
|
|||
// Check value mapping.
|
||||
#define CHECK_VALUEMAP_IMPL(RBName, Size, Offset) \
|
||||
do { \
|
||||
AArch64::PartialMappingIdx PartialMapBaseIdx = \
|
||||
AArch64::PartialMappingIdx::PMI_##RBName##Size; \
|
||||
(void) PartialMapBaseIdx; \
|
||||
const ValueMapping &Map = \
|
||||
AArch64::getValueMapping(AArch64::PMI_First##RBName, Size)[Offset]; \
|
||||
(void) Map; \
|
||||
unsigned PartialMapBaseIdx = \
|
||||
AArch64::PartialMappingIdx::PMI_##RBName##Size - \
|
||||
AArch64::PartialMappingIdx::PMI_Min; \
|
||||
(void)PartialMapBaseIdx; \
|
||||
const ValueMapping &Map = AArch64::getValueMapping( \
|
||||
AArch64::PartialMappingIdx::PMI_First##RBName, Size)[Offset]; \
|
||||
(void)Map; \
|
||||
assert(Map.BreakDown == &AArch64::PartMappings[PartialMapBaseIdx] && \
|
||||
Map.NumBreakDowns == 1 && #RBName #Size \
|
||||
" " #Offset " is incorrectly initialized"); \
|
||||
|
|
@ -172,10 +174,10 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI)
|
|||
|
||||
#define CHECK_VALUEMAP_CROSSREGCPY(RBNameDst, RBNameSrc, Size) \
|
||||
do { \
|
||||
AArch64::PartialMappingIdx PartialMapDstIdx = \
|
||||
AArch64::PartialMappingIdx::PMI_##RBNameDst##Size; \
|
||||
AArch64::PartialMappingIdx PartialMapSrcIdx = \
|
||||
AArch64::PartialMappingIdx::PMI_##RBNameSrc##Size; \
|
||||
unsigned PartialMapDstIdx = \
|
||||
AArch64::PMI_##RBNameDst##Size - AArch64::PMI_Min; \
|
||||
unsigned PartialMapSrcIdx = \
|
||||
AArch64::PMI_##RBNameSrc##Size - AArch64::PMI_Min; \
|
||||
(void) PartialMapDstIdx; \
|
||||
(void) PartialMapSrcIdx; \
|
||||
const ValueMapping *Map = AArch64::getCopyMapping( \
|
||||
|
|
|
|||
Loading…
Reference in New Issue