[all-commits] [llvm/llvm-project] 416e50: [flang] split character procedure arguments in tar...

jeanPerier via All-commits all-commits at lists.llvm.org
Thu Jan 27 07:30:37 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 416e503adfc16b8ae7718c4cca4cc34a6158eea0
      https://github.com/llvm/llvm-project/commit/416e503adfc16b8ae7718c4cca4cc34a6158eea0
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-01-27 (Thu, 27 Jan 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/Character.h
    M flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
    M flang/lib/Optimizer/Builder/Character.cpp
    M flang/lib/Optimizer/CodeGen/CMakeLists.txt
    M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
    A flang/test/Fir/target-rewrite-char-proc.fir

  Log Message:
  -----------
  [flang] split character procedure arguments in target-rewrite pass

When passing a character procedure as a dummy procedure, the result
length must be passed along the function address. This is to cover
the cases where the dummy procedure is declared with assumed length
inside the scope that will call it (it will need the length to allocate
the result on the caller side).

To be compatible with other Fortran compiler, this length must be
appended after all other argument just like character objects
(fir.boxchar).

A fir.boxchar cannot be used to implement this feature because it
is meant to take an object address, not a function address.

Instead, argument like `tuple<function type, integer type> {fir.char_proc}`
will be recognized as being character dummy procedure in FIR. That way
lowering does not have to do the argument split.

This patch adds tools in Character.h to create this type and tuple
values as well as to recognize them and extract its tuple members.

It also updates the target rewrite pass to split these arguments like
fir.boxchar.

This part is part of fir-dev upstreaming. It was reviwed previously
in: https://github.com/flang-compiler/f18-llvm-project/pull/1393

Differential Revision: https://reviews.llvm.org/D118108




More information about the All-commits mailing list