[llvm] r282815 - [AArch64][RegisterBankInfo] Check the statically created ValueMapping.

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 29 17:09:43 PDT 2016


Author: qcolombet
Date: Thu Sep 29 19:09:43 2016
New Revision: 282815

URL: http://llvm.org/viewvc/llvm-project?rev=282815&view=rev
Log:
[AArch64][RegisterBankInfo] Check the statically created ValueMapping.

Make sure that the ValueMappings contain the value we expect at the
indices we expect.

NFC.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp?rev=282815&r1=282814&r2=282815&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp Thu Sep 29 19:09:43 2016
@@ -111,6 +111,7 @@ AArch64RegisterBankInfo::AArch64Register
              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::AArch64Register
   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");
 }
 




More information about the llvm-commits mailing list