-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Labels
Description
Feature or enhancement
Proposal:
With refcount elimination, ops may have more than one output. E.g.
op(_BINARY_OP_ADD_INT, (lhs, rhs -- res))
is now
op(_BINARY_OP_ADD_INT, (lhs, rhs -- res, l, r))
This introduces a problem in the optimizer --- REPLACE_OPCODE_IF_EVALUATES_PURE cannot deal with >1 output.
The solution is not too complex:
Emit the op as _SWAP_TWO_LOAD_CONST_INLINE_BORROW, with signature:
op(_SWAP_TWO_LOAD_CONST_INLINE_BORROW, (res/4, lhs, rhs -- res, l, r))
and add the res to REPLACE_OPCODE_IF_EVALUATES_PURE to tell it which results to check.
So
REPLACE_OPCODE_IF_EVALUATES_PURE(lhs, rhs)
becomes
REPLACE_OPCODE_IF_EVALUATES_PURE(lhs, rhs, res)
Then we have everything we need and can reuse the current code.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
javrr-ui and Sacul0457