This is an archive of the discontinued LLVM Phabricator instance.

[flang] Add runtime interface for GET_COMMAND

Authored by rovka on Feb 2 2022, 4:22 AM.



Use a single entry point with many optional parameters.

Diff Detail

Event Timeline

rovka created this revision.Feb 2 2022, 4:22 AM
rovka requested review of this revision.Feb 2 2022, 4:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2022, 4:22 AM

The entry point name should reflect the name of the intrinsic procedure more closely.

We will probably have to rethink the interface soon so that the runtime can cope better with intrinsic procedure arguments that are optional and that can't be known to be present or absent until execution.

rovka updated this revision to Diff 405568.Feb 3 2022, 3:40 AM
rovka edited the summary of this revision. (Show Details)

Like this?

jeanPerier added inline comments.Feb 4 2022, 2:07 AM

Passing length as a simple pointer is tempting, but I think it will be problematic because the actual Fortran entity for the length is not guaranteed to be a INTEGER(8). It is only required that it must have a decimal exponent range of at least four.

So if we blindly cast and pass the length in lowering, we may have troubles. And dealing with maybe allocating an INTEGER(8) temp is not easier than the previous interface.

So, I think this either has to be a const Descriptor *length, or lowering has to get more clever and be able to deal with dynamically optional argument with your previous interface.

I tend to think const Descriptor *length is the easiest solution, and since this is not a computational intrinsic, I am not sure the descriptor overhead is a big deal.

@klausler , do you agree ?

A descriptor would work, yes,. Another approach, which is used in the I/O runtime API for some integer results, is a void* pointer and a KIND code.

rovka updated this revision to Diff 406788.Feb 8 2022, 5:38 AM

Ok, I updated it to use a descriptor instead, for brevity mostly.

jeanPerier accepted this revision.Feb 9 2022, 12:57 AM
This revision is now accepted and ready to land.Feb 9 2022, 12:57 AM
This revision was automatically updated to reflect the committed changes.