[flang-commits] [PATCH] D118108: [flang] split character procedure arguments in target-rewrite pass

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jan 25 00:43:01 PST 2022


jeanPerier created this revision.
jeanPerier added reviewers: schweitz, clementval, kiranchandramohan.
jeanPerier added a project: Flang.
Herald added subscribers: mehdi_amini, jdoerfert, mgorny.
Herald added a reviewer: sscalpone.
jeanPerier requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118108

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118108.402785.patch
Type: text/x-patch
Size: 16211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220125/8f03136f/attachment-0001.bin>


More information about the flang-commits mailing list