Skip to content

Devirtualization of CallIndirect -> Call #1052

@croyzor

Description

@croyzor

Useful for both BRAT and guppy.

We already have InlineCall rewrite (all Calls have a static known target). Moreover, dataflow analysis is already capable of identifying when the called-function input to CallIndirect has a single/known target. (For example, when the input of the CallIndirect is a LoadFunction, but also other cases.) So, extend constant folding that, when it sees the latter, converts the CallIndirect to a Call.


See #978. For BRAT compilation, we'd like to be able to inline static functions, so an indirect_call of a static graph coming from a LoadFunction node becomes an instantiation of that graph. We can then get further by constant folding the whole hugr.

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