reko
reko copied to clipboard
Detect functions returning sequences of registers
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;
}