From: Quentin Colombet Date: Fri, 30 Sep 2016 00:09:43 +0000 (+0000) Subject: [AArch64][RegisterBankInfo] Check the statically created ValueMapping. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df7724aeb2e3fc295ede33491e649d02db7b13d8;p=llvm [AArch64][RegisterBankInfo] Check the statically created ValueMapping. Make sure that the ValueMappings contain the value we expect at the indices we expect. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282815 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp index d8bf6bb4dcd..3350dab08d8 100644 --- a/lib/Target/AArch64/AArch64RegisterBankInfo.cpp +++ b/lib/Target/AArch64/AArch64RegisterBankInfo.cpp @@ -111,6 +111,7 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI) AArch64::PartialMappingIdx::FPR512 && "FPR indices not properly ordered"); // Now, the content. +// Check partial mapping. #define CHECK_PARTIALMAP(Idx, ValStartIdx, ValLength, RB) \ do { \ const PartialMapping &Map = \ @@ -128,6 +129,23 @@ AArch64RegisterBankInfo::AArch64RegisterBankInfo(const TargetRegisterInfo &TRI) CHECK_PARTIALMAP(FPR256, 0, 256, RBFPR); CHECK_PARTIALMAP(FPR512, 0, 512, RBFPR); +// Check value mapping. +#define CHECK_VALUEMAP(Idx) \ + do { \ + const ValueMapping &Map = AArch64::ValMappings[Idx]; \ + (void) Map; \ + assert(Map.BreakDown == &AArch64::PartMappings[Idx] && \ + Map.NumBreakDowns == 1 && #Idx " is incorrectly initialized"); \ + } while (0) + + CHECK_VALUEMAP(AArch64::PartialMappingIdx::GPR32); + CHECK_VALUEMAP(AArch64::PartialMappingIdx::GPR64); + CHECK_VALUEMAP(AArch64::PartialMappingIdx::FPR32); + CHECK_VALUEMAP(AArch64::PartialMappingIdx::FPR64); + CHECK_VALUEMAP(AArch64::PartialMappingIdx::FPR128); + CHECK_VALUEMAP(AArch64::PartialMappingIdx::FPR256); + CHECK_VALUEMAP(AArch64::PartialMappingIdx::FPR512); + assert(verify(TRI) && "Invalid register bank information"); }