Add way to differentiate locals that are function arguments from other locals #47
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