[all-commits] [llvm/llvm-project] 367c3c: [flang] correctly deal with bind(c) derived type r...

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Oct 14 00:35:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 367c3c968eb8f29b55fb8019b2464c7ff6307ca8
      https://github.com/llvm/llvm-project/commit/367c3c968eb8f29b55fb8019b2464c7ff6307ca8
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-10-14 (Mon, 14 Oct 2024)

  Changed paths:
    M flang/include/flang/Optimizer/CodeGen/Target.h
    M flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
    M flang/lib/Optimizer/CodeGen/Target.cpp
    M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
    M flang/lib/Optimizer/Transforms/AbstractResult.cpp
    A flang/test/Fir/abstract-results-bindc.fir
    A flang/test/Fir/struct-return-x86-64.fir

  Log Message:
  -----------
  [flang] correctly deal with bind(c) derived type result ABI (#111969)

Derived type results of BIND(C) function should be returned according
the the C ABI for returning the related C struct type.

This currently did not happen since the abstract-result pass was forcing
the Fortran ABI for all derived type results.
use the bind_c attribute that was added on call/func/dispatch in FIR to
prevent such rewrite in the abstract result pass, and update the
target-rewrite pass to deal with the struct return ABI.

So far, the target specific part of the target-rewrite is only
implemented for X86-64 according to the "System V Application Binary
Interface AMD64 v1", the other targets will hit a TODO, just like for
BIND(C), VALUE derived type arguments.

This intends to deal with #102113.

This is a re-land of #111678 with an extra commit to keep rewriting `type(c_ptr)`
results to `!fir.ref<none>` in the abstract result pass regardless of the ABIs.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list