This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
apart from that I cooked up the design and the code myself. My idea is to do the following (from a comment I put in resolve.c, the code requires my previous patch):
This isn't a new idea, it's what g77 does ;)
PROCEDURE p_2 ( args_2 )
^^ Typo? Should be args?
CALL master_p ( 2, args_2=args )
^^^ the typo's here, should be args_2 :-)
...END PROCEDURE ...
This is somewhat unclear on how we handle multiple (possibly overlapping) arguments. For example:
The way we make sure that the arguments end up in the right places is that we give them keyword names of the form "args_n_i", where n is as above and i is the position in the argument list of that respective ENTRY. This means we have to generate code to copy the arguments into the right local variables inside the master function.
Maybe that's is what is what you mean here. IMHO the best way to implement my
example would be:
subroutine _internal_foo (_which, a, b, c) integer which, a integer, maybe_optional :: b, c select case (_which) case (0): goto _label_0 case (1): goto _label_1 end case call abort _label_0: print *, b _label_1: if (a .gt. 0) print *, c end subroutine
subroutine foo (a, b) integer a, b call _internal_foo (which=1, a=a, b=b) end subroutine
subroutine bar (a, c) integer a real c call _internal_foo (which=2, a=a, c=c) end subroutine
Either way the example should cover how this is handled.
The split between frontend and backend seems sensible. Don't jump through hoops to enforce this though.
I think "stub" or "thunk" may be more appropriate wording than "trampoline".
It looks like that ENTRY statements are redundant. Do we really need them?
The backend doesn't need to know where the entry points are, so maybe these would be better as a list of interfaces hung off the master symbol
A thing I haven't yet thought through is the handling of the RESULT of a function, I hope this will drop easily into
this framework.
My suggestion would be to create an equivalence of all the result variables.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |