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

PeixinQiao via All-commits all-commits at lists.llvm.org
Tue Aug 2 08:00:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9b867928f4d9cada6f0e63e5bf79c152d8806df6
      https://github.com/llvm/llvm-project/commit/9b867928f4d9cada6f0e63e5bf79c152d8806df6
  Author: Peixin Qiao <qiaopeixin at huawei.com>
  Date:   2022-08-02 (Tue, 02 Aug 2022)

  Changed paths:
    M flang/lib/Lower/IntrinsicCall.cpp
    A flang/test/Lower/Intrinsics/c_loc.f90

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

As Fortran 2018 18.2.3.6, the intrinsic `c_loc(x)` gets the C address
of argument `x`. It returns the scalar of type C_PTR. As defined in
iso_c_binding in `flang/module/__fortran_builtins.f90`, C_PTR is the
derived type with only one component of integer 64.

This supports the lowering of intrinsic module procedure `c_loc` by
converting the address of argument into integer 64, where the argument
is lowered as Box and the address is generated using fir.box_addr.

The lowering of intrinsic `c_funloc` has the similar characteristic and
will be supported later.

The execution tests for various data types are in issue
https://github.com/llvm/llvm-project/issues/56552.

Reviewed By: Jean Perier

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




More information about the All-commits mailing list