Skip to content

Commit 87e5c48

Browse files
committed
review comments. add notes on to-do work items.
1 parent c8d759e commit 87e5c48

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5121,6 +5121,8 @@ class ArrayExprLowering {
51215121
if (auto eleTy = fir::dyn_cast_ptrEleTy(box.getType()))
51225122
if (!eleTy.isa<fir::BoxType>()) {
51235123
// `box` is not boxed. Embox it now.
5124+
// FIXME: createBox isn't correct here. We want to create a boxed
5125+
// POINTER instead.
51245126
box = builder.createBox(loc, box);
51255127
}
51265128
return arraySectionElementToExtendedValue(builder, loc, extMemref, box,
@@ -5826,7 +5828,7 @@ class ArrayExprLowering {
58265828
/// Array appears in a context where it must be boxed.
58275829
bool isBoxValue() { return semant == ConstituentSemantics::BoxValue; }
58285830

5829-
/// Data referemce is to a box or value to be boxed.
5831+
/// Data reference is to a box or value to be boxed.
58305832
bool isBoxValueEle() {
58315833
return semant == ConstituentSemantics::BoxValueElement;
58325834
}

flang/lib/Optimizer/Builder/FIRBuilder.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,20 @@ fir::factory::createExtents(fir::FirOpBuilder &builder, mlir::Location loc,
673673
return extents;
674674
}
675675

676+
// FIXME: This needs some work. To correctly determine the extended value of a
677+
// component, one needs the base object, its type, and its type parameters. (An
678+
// alternative would be to provide an already computed address of the final
679+
// component rather than the base object's address, the point being the result
680+
// will require the address of the final component to create the extended
681+
// value.) One further needs the full path of components being applied. One
682+
// needs to apply type-based expressions to type parameters along this said
683+
// path. (See applyPathToType for a type-only derivation.) Finally, one needs to
684+
// compose the extended value of the terminal component, including all of its
685+
// parameters: array lower bounds expressions, extents, type parameters, etc.
686+
// Any of these properties may be deferred until runtime in Fortran. This
687+
// operation may therefore generate a sizeable block of IR, including calls to
688+
// type-based helper functions, so caching the result of this operation in the
689+
// client would be advised as well.
676690
fir::ExtendedValue fir::factory::componentToExtendedValue(
677691
fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value component) {
678692
auto fieldTy = component.getType();

0 commit comments

Comments
 (0)