[flang-commits] [PATCH] D93322: [flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF()

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Dec 15 11:08:44 PST 2020


klausler created this revision.
klausler added a reviewer: tskeith.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93322

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93322.311970.patch
Type: text/x-patch
Size: 33125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20201215/aa69ad77/attachment-0001.bin>


More information about the flang-commits mailing list