[llvm] 0249ea6 - [TableGen][CodeEmitterGen] Fix SubOpAliases MIOperandNo mixup

Ilya Leoshkevich via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 08:29:29 PDT 2023


Author: Ilya Leoshkevich
Date: 2023-07-13T17:28:22+02:00
New Revision: 0249ea611f55ed7ddce978289578bd01b80cfbcf

URL: https://github.com/llvm/llvm-project/commit/0249ea611f55ed7ddce978289578bd01b80cfbcf
DIFF: https://github.com/llvm/llvm-project/commit/0249ea611f55ed7ddce978289578bd01b80cfbcf.diff

LOG: [TableGen][CodeEmitterGen] Fix SubOpAliases MIOperandNo mixup

SubOpAliases maps a sub-operand name to the respective operand's index
and the sub-operand number within this operand. The operand index is
used for the Operands array.

Currently MIOperandNo is used as the operand index, which is not
correct. For example, if there are 2 operands with 3 sub-operands each:

  (ins (bdladdr12onlylen4 $B1, $D1, $L1):$BDL1,
       (bdladdr12onlylen4 $B2, $D2, $L2):$BDL2)

then B2's operand index will be 3, but the correct value is 1.

Reviewed By: jyknight

Differential Revision: https://reviews.llvm.org/D155158

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenInstruction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp
index 11133918a8ff24..8662b6fb52da1f 100644
--- a/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -175,7 +175,7 @@ CGIOperandList::CGIOperandList(Record *R) : TheDef(R) {
         }
 
         OpInfo.SubOpNames[j] = SubArgName;
-        SubOpAliases[SubArgName] = std::make_pair(MIOperandNo, j);
+        SubOpAliases[SubArgName] = std::make_pair(i, j);
       }
     } else if (!EncoderMethod.empty()) {
       // If we have no explicit sub-op dag, but have an top-level encoder


        


More information about the llvm-commits mailing list