This is an archive of the discontinued LLVM Phabricator instance.

[flang] Implement STORAGE_SIZE(), SIZEOF(), C_SIZEOF()
ClosedPublic

Authored by klausler on Dec 15 2020, 11:08 AM.

Details

Summary

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.

Diff Detail

Event Timeline

klausler created this revision.Dec 15 2020, 11:08 AM
klausler requested review of this revision.Dec 15 2020, 11:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 15 2020, 11:08 AM
tskeith accepted this revision.Dec 15 2020, 4:10 PM
This revision is now accepted and ready to land.Dec 15 2020, 4:10 PM
This revision was landed with ongoing or failed builds.Dec 15 2020, 5:26 PM
This revision was automatically updated to reflect the committed changes.