This is an archive of the discontinued LLVM Phabricator instance.

[flang] Handle EQUIVALENCE and COMMON in size and offset computations
ClosedPublic

Authored by klausler on May 4 2020, 11:59 AM.

Details

Summary

Objects in common blocks have offsets relative to the start of the
common block, independent of the enclosing scope, so they are processed
first. Add alignment to CommonBlockDetails to record the required
alignment of the common block.

For equivalence sets, each object depends on the one that is forced to
occur first in memory. The rest are recorded in the dependents_ map and
have offsets assigned after the other symbols are done.

Diff Detail

Event Timeline

klausler created this revision.May 4 2020, 11:59 AM
Herald added a project: Restricted Project. · View Herald Transcript
sscalpone accepted this revision.May 4 2020, 10:51 PM
sscalpone added inline comments.
flang/include/flang/Semantics/symbol.h
306

align is a verb, and someone might think this call is aligning something. how about g/align/s//alignment/?

flang/lib/Semantics/compute-offsets.cpp
74

InCommonBlock might be helpful for lowering, but i'm just guessing, because i'm not doing any lowering.

This revision is now accepted and ready to land.May 4 2020, 10:51 PM
tskeith added inline comments.May 5 2020, 9:26 AM
flang/include/flang/Semantics/symbol.h
306

Scope and ComputeOffsetsHelper already have data members named align_. Do you want those changed too?

flang/lib/Semantics/compute-offsets.cpp
74

Me neither. I think it should be made public if and when it is needed.

tskeith added inline comments.May 6 2020, 11:39 AM
flang/include/flang/Semantics/symbol.h
306

I'll do the renaming in a separate change.

This revision was automatically updated to reflect the committed changes.