[all-commits] [llvm/llvm-project] 6aa359: [flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZE...

Peter Klausler via All-commits all-commits at lists.llvm.org
Tue Dec 15 17:31:28 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6aa3591e98402418e110c506cdd488ed1e3021b6
      https://github.com/llvm/llvm-project/commit/6aa3591e98402418e110c506cdd488ed1e3021b6
  Author: peter klausler <pklausler at nvidia.com>
  Date:   2020-12-15 (Tue, 15 Dec 2020)

  Changed paths:
    M flang/docs/Extensions.md
    M flang/include/flang/Evaluate/characteristics.h
    M flang/include/flang/Evaluate/common.h
    M flang/include/flang/Evaluate/initial-image.h
    M flang/include/flang/Evaluate/type.h
    M flang/lib/Evaluate/characteristics.cpp
    M flang/lib/Evaluate/fold-designator.cpp
    M flang/lib/Evaluate/fold-integer.cpp
    M flang/lib/Evaluate/initial-image.cpp
    M flang/lib/Evaluate/intrinsics.cpp
    M flang/lib/Evaluate/shape.cpp
    M flang/lib/Evaluate/type.cpp
    M flang/lib/Semantics/compute-offsets.cpp
    M flang/lib/Semantics/compute-offsets.h
    M flang/lib/Semantics/data-to-inits.cpp
    M flang/lib/Semantics/semantics.cpp
    M flang/lib/Semantics/type.cpp
    M flang/module/__fortran_builtins.f90
    M flang/module/iso_c_binding.f90
    A flang/test/Evaluate/folding17.f90
    M flang/test/Semantics/resolve92.f90
    M flang/test/Semantics/typeinfo01.f90

  Log Message:
  -----------
  [flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF()

STORAGE_SIZE() is a standard inquiry intrinsic (size in bits
of an array element of the same type as the argument); SIZEOF()
is a common extension that returns the size in bytes of its
argument; C_SIZEOF() is a renaming of SIZEOF() in module ISO_C_BINDING.

STORAGE_SIZE() and SIZEOF() are implemented via rewrites to
expressions; these expressions will be constant when the necessary
type parameters and bounds are also constant.

Code to calculate the sizes of types (with and without alignment)
was isolated into Evaluate/type.* and /characteristics.*.
Code in Semantics/compute-offsets.* to calculate sizes and alignments
of derived types' scopes was exposed so that it can be called at type
instantiation time (earlier than before) so that these inquiry intrinsics
could be called from specification expressions.

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




More information about the All-commits mailing list