[M3devel] struct pass and return, an additional mode?
Jay K
jay.krell at cornell.edu
Sat Apr 20 19:52:52 CEST 2013
The frontend supports the following, Target.i3:
results_on_left => when the front-end is passing structures the return
result is the left-most parameter. Otherwise, it is
the right-most parameter.
standard_structs =>
TRUE => the front-end will take care of all structure passing:
by VALUE parameters: callers pass the address of the structure
and the callee copies it into a temporary.
return results: the caller passes as the left-most or right-most
parameter the address of the temporary that will hold the result
and the callee copies the value there.
FALSE =>
by VALUE parameters: the back-end is responsible.
(ie. M3CG.T.Pop_struct will be called)
return results: the caller passes as the left-most or right-most
parameter the address of the temporary that will hold the result
and the callee copies the value there. The start_call, call,
and exit_proc methods are called with t=Struct.
I want an additional mode.
I want no extra parameter for struct return.
My backend could easily pass and return them by value and hide the details.
TYPE StructReturn = [None, Left, Right];
?
Too much is wrapped up in standard_structs -- pass and return could/should be separate.
TYPE StructPass = [Value, Pointer];
?
I grant that really supporting this in the frontend might be a bit of work,
and there might be little point, as the code is all rarely used.
Maybe I should work on improving something else, e.g. scopes or global variables/segments.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20130420/4c73c99d/attachment-0001.html>
More information about the M3devel
mailing list