[llvm] [NFC][LLVM] Refactor MachineInstr operand accessors (PR #137261)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 25 08:13:55 PDT 2025
================
@@ -676,68 +672,61 @@ class MachineInstr
const_mop_iterator operands_begin() const { return Operands; }
const_mop_iterator operands_end() const { return Operands + NumOperands; }
- iterator_range<mop_iterator> operands() {
- return make_range(operands_begin(), operands_end());
+ MutableArrayRef<MachineOperand> operands() {
----------------
jurahul wrote:
I am not sure. It only makes it impossible if someone assumes that the return type of operands() is an ArrayRef, with code like:
ArrayRef<MCOperand> ops = MI.operands().
And that's true with today's iterator<mop_iterator> as well. Even today, we cannot change the storage to a segregated arrays without changing the return type of operands(). My claim is that this is ok for well behaving clients and it's not exposing the details any more than iterator<mop_iterator>.
https://github.com/llvm/llvm-project/pull/137261
More information about the llvm-commits
mailing list