Deprecate `many`/`match_many` option from the argument processor
SamirDroubi opened this issue · 0 comments
The many
option currently exists for the StmtCursorA
, ExprCursorA
, and BlockCursorA
processors. However, it is virtually not used anywhere in our code except for two places, which themsevles can be deprecated.
First usage:
@sched_op([ExprCursorA(many=True), NameA, BoolA])
def bind_expr(proc, expr_cursors, new_name, cse=False):
When we specify cse=True, then we would perform CSE on all expressions that match the pattern. Otherwise, it will simply bind the first expressions that matches the pattern. I think generally implementing this as ListOrElemA(NewExprA))
would make more sense. If I want to replicate the old behavior, I can simply call Procedure::find(pat, many=True)
and pass that as an argument.
Second usage:
@sched_op([ExprCursorA(many=True)])
def commute_expr(proc, expr_cursors):
This simply loops through all the cursors and commutes each one. It can be changed to work for exactly one expression and replicate the looping functionality using high-order operations.