[flang-commits] [flang] [flang] GETPID runtime and lower intrinsic implementation (PR #70442)
Yi Wu via flang-commits
flang-commits at lists.llvm.org
Tue Oct 31 09:21:15 PDT 2023
PAX-12-WU wrote:
> > > `getpid` needs to be defined as an intrinsic function in order to get its result type correct.
> >
> >
> > How can I define it as intrinsic function to get a correct result type? I have tried renaming `iargc` to `argc` in `extension.cpp`, it will be called as `call contract float @argc_()`. @klausler I've defined `getpid` in `flang/lib/intrinsics.cpp` and `flang/lib/optimizer/builder/intrinsicsCall.cpp`. However, if it's defined in `extension.cpp`, which only calls a runtime function in `flang/runtime/command.cpp`, how does the intrinsic function affect the return type in `extension.cpp`?
> > I initially tried in `extension.cpp` but it didn't work due to reason mention above, so I switched to do in it `intrinsics` and `instrinsicsCall.cpp`. I still don't understand why adding/remove an `i` would have such effect in `estension.cpp`
>
> Types are determined in semantics. By default, in Fortran, a name with no explicit type is integer if its first letter is in the range I through N, and real otherwise.
Thanks a lot, if I have understood correctly, I have it defined as a lowering intrinsic function under `intrinsic.cpp` and `intrinsicCalls.cpp`. This gives a correct output.
It is just that I haven't found a way to do it in `extension.cpp`, due to the result type is not correct, and it is excluded in this change.
https://github.com/llvm/llvm-project/pull/70442
More information about the flang-commits
mailing list