Much of this work should be put off until after
all the features necessary for its widespread acceptance as a
useful F77 compiler.
However, perhaps this work can be done in parallel during
the feature-adding work.
extern inlinein front of every function definition in
libg2cand #include'ing the resulting file in
gcc--that is, inline all run-time-library functions that are at all worth inlining. (Some of this has already been done, such as for integral exponentiation.)
CHAR_VAR = CHAR_FUNC(...), and it's clear that types line up and
CHAR_VARis addressable or not a
CHAR_VAR, not a temporary, be the receiver for
CHAR_FUNC. (This is now done for
libgccso no special linking is required to link Fortran programs using standard language features. This library would speed up lots of things, from I/O (using precompiled formats, doing just one, or, at most, very few, calls for arrays or array sections, and so on) to general computing (array/section implementations of various intrinsics, implementation of commonly performed loops that aren't likely to be optimally compiled otherwise, etc.).
Among the important things the library would do are:
libg2cwould be moved at least to the
g77compile phase, if not to finer grains (such as choosing how list-directed I/O formatting is done by default at
OPENtime, for preconnected units via options or even statements in the main program unit, maybe even on a per-I/O basis with appropriate pragma-like devices).
COMPLEXfunctions return their values in the way
gccwould if they were declared
__complex__ float, rather than using the mechanism currently used by
CHARACTERfunctions (whereby the functions are compiled as returning void and their first arg is a pointer to where to store the result). (Don't append underscores to external names for
COMPLEXfunctions in some cases once
doiterreferences where possible. For example,
CALL FOO(I)cannot modify
Iif within a
DOloop that uses
Ias the iteration variable, and the back end might find that info useful in determining whether it needs to read
Iback into a register after the call. (It normally has to do that, unless it knows
FOOnever modifies its passed-by-reference argument, which is rarely the case for Fortran-77 code.)