vast icon indicating copy to clipboard operation
vast copied to clipboard

Implement APIs to easily access control-flow targets

Open pgoodman opened this issue 1 year ago • 3 comments

Prerequisites

  • [X] I have read the documentation and the proposed feature is not implemented.

Description

Some control-flow altering operations, e.g. GotoStmt, do not provide any methods to know the targets of their flows. This is in contrast to something like SwitchOp, which provides a getCases method. This issue requests that all control-flow altering operations provide an API to get the relevant control-flow targets. If possible, having a more generic trait that provides generic access to the successors would also be nice.

pgoodman avatar Dec 06 '23 21:12 pgoodman

Since in high level we do not have blocks, what is the ideal returned value? Next operation to be executed?

lkorenc avatar Dec 06 '23 21:12 lkorenc

An addendum is that there should also be APIs to find predecessors, e.g. to LabelDeclOps (or maybe LabelStmt?). Ditto for cases.

pgoodman avatar Dec 06 '23 21:12 pgoodman

Since in high level we do not have blocks, what is the ideal returned value? Next operation to be executed?

Yes, the next operation to execute would be the most logical thing, I think, as there are no guarantees that things are block/region entrypoints.

pgoodman avatar Dec 06 '23 21:12 pgoodman