Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect functions returning sequences of registers #1138

Open
uxmal opened this issue Jan 17, 2022 · 0 comments
Open

Detect functions returning sequences of registers #1138

uxmal opened this issue Jan 17, 2022 · 0 comments
Assignees
Labels
enhancement This is a feature request

Comments

@uxmal
Copy link
Owner

uxmal commented Jan 17, 2022

It's common to return register pairs or n-tuples from procedures when the return value exceeds the register size. For instance, in MS-DOS binaries, long pointers are returned in the dx:ax register pair. Reko today handles long input parameters passably, but functions returning register tuples inevitably end up looking like this:

word16 myfunc(word16 & dxOut) {
    dx_ax = ds->dw0044;
    dxOut = dx_ax >> 16; // or worse, SLICE(dx_ax, word16, 16)
    return (word16) dx_ax;
}

There is still a place for out parameters, but in this case it should be more appropriate to generate:

word32 myfunc() {
    return ds->dw0044;
}
@uxmal uxmal self-assigned this Jan 17, 2022
@uxmal uxmal added the enhancement This is a feature request label Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is a feature request
Projects
None yet
Development

No branches or pull requests

1 participant