[llvm] [TableGen] DecoderEmitter clean-ups and modernization. (PR #84832)

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 08:59:28 PDT 2024


================
@@ -2025,29 +2023,26 @@ populateInstruction(CodeGenTarget &Target, const Record &EncodingDef,
   // Gather the outputs/inputs of the instruction, so we can find their
   // positions in the encoding.  This assumes for now that they appear in the
   // MCInst in the order that they're listed.
-  std::vector<std::pair<Init *, StringRef>> InOutOperands;
+  std::vector<std::tuple<Init *, StringInit *>> InOutOperands;
   DagInit *Out = Def.getValueAsDag("OutOperandList");
   DagInit *In = Def.getValueAsDag("InOperandList");
-  for (unsigned i = 0; i < Out->getNumArgs(); ++i)
-    InOutOperands.push_back(std::pair(Out->getArg(i), Out->getArgNameStr(i)));
-  for (unsigned i = 0; i < In->getNumArgs(); ++i)
-    InOutOperands.push_back(std::pair(In->getArg(i), In->getArgNameStr(i)));
+  for (const auto &ArgPair :
----------------
jyknight wrote:

Not sure this is clearer than the two loops we had before.

https://github.com/llvm/llvm-project/pull/84832


More information about the llvm-commits mailing list