[llvm] [TableGen] More generically handle tied source operands in CompressInstEmitter. (PR #146183)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 10:46:16 PDT 2025


================
@@ -290,6 +285,28 @@ void CompressInstEmitter::addDagOperandMapping(const Record *Rec,
       } else {
         llvm_unreachable("Unhandled CompressPat argument type!");
       }
+
+      // Create a mapping between the operand name in the Dag (e.g. $rs1) and
+      // its index in the list of Dag operands and check that operands with the
+      // same name have the same type. For example in 'C_ADD $rs1, $rs2' we
+      // generate the mapping $rs1 --> 0, $rs2 ---> 1. If the operand appears
+      // twice in the (tied) same Dag we use the last occurrence for indexing.
+      if (Dag->getArgNameStr(DAGOpNo).empty())
----------------
jurahul wrote:

Dag->getArgNameStr(DAGOpNo) is used 4 times, extract it out in a variable?

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


More information about the llvm-commits mailing list