Skip to content

Add way to differentiate locals that are function arguments from other locals #47

Closed
rust-lang/rust
#117095
@klinvill

Description

It would be nice to be able to differentiate between locals in a function that correspond to arguments (& return values) and other locals. This kind of functionality would be useful for computing function summaries. As mentioned in a Zulip thread, this information is not available yet in stable MIR. However, it does appear to currently be the case that local 0 is the return local, and the next N locals are the function's arguments.

One approach could be to return the number of arguments to a function (n). The return local could then be retrieved by indexing the 0th local, while the arguments could be retrieved by slicing the 1st to nth locals.

Alternatively, an API could be added to return both the arguments and the return values. Such an API could abstract over the actual implementation of the return and argument layout in locals.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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