Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir][IR] Change MutableOperandRange::operator[] to return an OpOperand & #66515

Commits on Sep 18, 2023

  1. [mlir][IR] MutableOperandRange: operator[] returns OpOperand &

    `operator[]` returns `OpOperand &` instead of `Value`.
    
    * This allows users to get OpOperands by name instead of "magic" number. E.g., `extractSliceOp->getOpOperand(0)` can be written as `extractSliceOp.getSourceMutable()[0]`.
    * `OperandRange` provides a read-only API to operands: `operator[]` returns `Value`. `MutableOperandRange` now provides a mutable API: `operator[]` returns `OpOperand &`, which can be used to set operands.
    
    Note: The TableGen code generator could be changed to return `OpOperand &` (instead of `MutableOperandRange`) for non-variadic and non-optional arguments in a subsequent change. Then the `[0]` part in the above example would no longer be necessary.
    
    BEGIN_PUBLIC
    No public commit message needed for presubmit.
    END_PUBLIC
    matthias-springer committed Sep 18, 2023
    Configuration menu
    Copy the full SHA
    52450fe View commit details
    Browse the repository at this point in the history