Skip to content

[Support] Maybe mark InstanceGraph GraphTraits deprecated #8996

@fabianschuiki

Description

@fabianschuiki

The InstanceGraph implements llvm::GraphTraits. That uses getTopLevelNode() as the root node of the graph, which does not contain all modules in the instance graph. Instead, the behaviour is dependent on concrete subclasses of the instance graph. The HW and FIRRTL dialects define this to be variants of "the top module" and "all public modules", which is usually not what we want in a pass. A pass is more likely to want to visit all modules in the IR in post order (children before parents), not just a subset of the modules depending on whether things are transitively instantiated. The new walkPostOrder or walkInversePostOrder functions on InstanceGraph implement those walks.

It may be useful to mark at least getTopLevelNode() on the graph traits deprecated, with a comment about moving to the new walk functions. We shouldn't have any warnings in the code base after this. Only make this change if we have a valid alternative for all existing uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions