Use a single entry point with many optional parameters.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
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.
flang/include/flang/Runtime/command.h | ||
---|---|---|
31 | 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.
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 ?