]> granicus.if.org Git - llvm/commitdiff
[AArch64][RegisterBankInfo] Check the statically created ValueMapping.
authorQuentin Colombet <qcolombet@apple.com>
Fri, 30 Sep 2016 00:09:43 +0000 (00:09 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Fri, 30 Sep 2016 00:09:43 +0000 (00:09 +0000)
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

lib/Target/AArch64/AArch64RegisterBankInfo.cpp

index d8bf6bb4dcd2ba39eb749afd26cae5a41c96f482..3350dab08d8d18053057486012fc170a734e711b 100644 (file)
@@ -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");
 }