diff options
| author | Rahul Joshi <rjoshi@nvidia.com> | 2025-06-24 18:47:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 18:47:53 -0700 |
| commit | f608716b098687f67c981f96d1adff324e41e486 (patch) | |
| tree | 49cf47f24bc6272ccd22b38825a3fcb4256e86f9 /llvm/utils/TableGen/CodeEmitterGen.cpp | |
| parent | dbb3e7d1162dcb5d03937935f00ed7987b66213b (diff) | |
[LLVM][TableGen] Minor cleanup in CGIOperandList (#142721)
- Change `hadOperandNamed` to return index as std::optional and rename
it to `findOperandNamed`.
- Change `SubOperandAlias` to return std::optional and rename it to
`findSubOperandAlias`.
Diffstat (limited to 'llvm/utils/TableGen/CodeEmitterGen.cpp')
| -rw-r--r-- | llvm/utils/TableGen/CodeEmitterGen.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/utils/TableGen/CodeEmitterGen.cpp b/llvm/utils/TableGen/CodeEmitterGen.cpp index 2fe40450abfd..14dffb438fcb 100644 --- a/llvm/utils/TableGen/CodeEmitterGen.cpp +++ b/llvm/utils/TableGen/CodeEmitterGen.cpp @@ -123,12 +123,11 @@ bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R, // operand number. Non-matching operands are assumed to be in // order. unsigned OpIdx; - std::pair<unsigned, unsigned> SubOp; - if (CGI.Operands.hasSubOperandAlias(VarName, SubOp)) { - OpIdx = CGI.Operands[SubOp.first].MIOperandNo + SubOp.second; - } else if (CGI.Operands.hasOperandNamed(VarName, OpIdx)) { + if (auto SubOp = CGI.Operands.findSubOperandAlias(VarName)) { + OpIdx = CGI.Operands[SubOp->first].MIOperandNo + SubOp->second; + } else if (auto MayBeOpIdx = CGI.Operands.findOperandNamed(VarName)) { // Get the machine operand number for the indicated operand. - OpIdx = CGI.Operands[OpIdx].MIOperandNo; + OpIdx = CGI.Operands[*MayBeOpIdx].MIOperandNo; } else { PrintError(R, Twine("No operand named ") + VarName + " in record " + R->getName()); |
