[llvm] r282956 - [AArch64][RegisterBankInfo] Use the static opds mapping for alt mappings

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 14:45:56 PDT 2016


Author: qcolombet
Date: Fri Sep 30 16:45:56 2016
New Revision: 282956

URL: http://llvm.org/viewvc/llvm-project?rev=282956&view=rev
Log:
[AArch64][RegisterBankInfo] Use the static opds mapping for alt mappings

Avoid to rely on the dynamically allocated operands mapping for the
alternative mapping.
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=282956&r1=282955&r2=282956&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64RegisterBankInfo.cpp Fri Sep 30 16:45:56 2016
@@ -248,20 +248,13 @@ AArch64RegisterBankInfo::getInstrAlterna
                                   /*NumOperands*/ 3);
     InstructionMapping FPRMapping(/*ID*/ 2, /*Cost*/ 1, nullptr,
                                   /*NumOperands*/ 3);
-    GPRMapping.setOperandsMapping(getOperandsMapping(
-        {&AArch64::ValMappings[AArch64::getRegBankBaseIdx(Size) +
-                               AArch64::FirstGPR],
-         &AArch64::ValMappings[AArch64::getRegBankBaseIdx(Size) +
-                               AArch64::FirstGPR],
-         &AArch64::ValMappings[AArch64::getRegBankBaseIdx(Size) +
-                               AArch64::FirstGPR]}));
-    FPRMapping.setOperandsMapping(getOperandsMapping(
-        {&AArch64::ValMappings[AArch64::getRegBankBaseIdx(Size) +
-                               AArch64::FirstFPR],
-         &AArch64::ValMappings[AArch64::getRegBankBaseIdx(Size) +
-                               AArch64::FirstFPR],
-         &AArch64::ValMappings[AArch64::getRegBankBaseIdx(Size) +
-                               AArch64::FirstFPR]}));
+    unsigned RBIdx = AArch64::getRegBankBaseIdx(Size);
+    GPRMapping.setOperandsMapping(
+        &AArch64::ValMappings[AArch64::First3OpsIdx +
+                              (RBIdx + AArch64::FirstGPR) * 3]);
+    FPRMapping.setOperandsMapping(
+        &AArch64::ValMappings[AArch64::First3OpsIdx +
+                              (RBIdx + AArch64::FirstFPR) * 3]);
     AltMappings.emplace_back(std::move(GPRMapping));
     AltMappings.emplace_back(std::move(FPRMapping));
     return AltMappings;




More information about the llvm-commits mailing list