[all-commits] [llvm/llvm-project] 109f9a: [flang] Support lowering of intrinsic module proce...

PeixinQiao via All-commits all-commits at lists.llvm.org
Mon Sep 5 17:16:10 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 109f9a291850a8e82f5026f68a382222a235c4f3
      https://github.com/llvm/llvm-project/commit/109f9a291850a8e82f5026f68a382222a235c4f3
  Author: Peixin Qiao <qiaopeixin at huawei.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/FIRBuilder.h
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/ConvertExpr.cpp
    M flang/lib/Lower/IntrinsicCall.cpp
    M flang/lib/Optimizer/Builder/FIRBuilder.cpp
    A flang/test/Lower/Intrinsics/c_f_pointer.f90
    M flang/test/Lower/Intrinsics/c_funloc.f90
    M flang/test/Lower/Intrinsics/c_loc.f90

  Log Message:
  -----------
  [flang] Support lowering of intrinsic module procedure C_F_POINTER

As Fortran 2018 18.2.3.3, the intrinsic module procedure
C_F_POINTER(CPTR, FPTR [, SHAPE]) associates a data pointer with the
target of a C pointer and specify its shape. CPTR shall be a scalar of
type C_PTR, and its value is the C address or the result of a reference
to C_LOC. FPTR is one pointer, either scalar or array. SHAPE is a
rank-one integer array, and it shall be present if and only if FPTR is
an array.

C_PTR is the derived type with only one component of integer 64, and the
integer 64 component value is the address. Build the right "source"
fir::ExtendedValue based on the address and shape, and use
associateMutableBox to associate the pointer with the target of the C
pointer.

Refactor the getting the address of C_PTR to reuse the code.

Reviewed By: jeanPerier

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




More information about the All-commits mailing list