[flang-commits] [PATCH] D141510: [flang][NFC] Remove CallBuilder class
Pete Steinfeld via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Jan 11 11:06:50 PST 2023
PeteSteinfeld accepted this revision.
PeteSteinfeld added a comment.
Things build and test correctly and look good.
================
Comment at: flang/lib/Lower/ConvertCall.cpp:660
-private:
- std::optional<hlfir::EntityWithAttributes>
- genUserCall(PreparedActualArguments &loweredActuals,
- Fortran::lower::CallerInterface &caller,
- std::optional<mlir::Type> resultType,
- mlir::FunctionType callSiteType) {
- mlir::Location loc = getLoc();
- fir::FirOpBuilder &builder = getBuilder();
- llvm::SmallVector<hlfir::AssociateOp> exprAssociations;
- for (auto [preparedActual, arg] :
- llvm::zip(loweredActuals, caller.getPassedArguments())) {
- mlir::Type argTy = callSiteType.getInput(arg.firArgument);
- if (!preparedActual) {
- // Optional dummy argument for which there is no actual argument.
- caller.placeInput(arg, builder.create<fir::AbsentOp>(loc, argTy));
- continue;
- }
- hlfir::Entity actual = preparedActual->actual;
- const auto *expr = arg.entity->UnwrapExpr();
- if (!expr)
- TODO(loc, "assumed type actual argument");
-
- if (preparedActual->handleDynamicOptional)
- TODO(loc, "passing optional arguments in HLFIR");
-
- const bool isSimplyContiguous =
- actual.isScalar() || Fortran::evaluate::IsSimplyContiguous(
- *expr, getConverter().getFoldingContext());
-
- switch (arg.passBy) {
- case PassBy::Value: {
- // True pass-by-value semantics.
- auto value = hlfir::loadTrivialScalar(loc, builder, actual);
- if (!value.isValue())
- TODO(loc, "Passing CPTR an CFUNCTPTR VALUE in HLFIR");
- caller.placeInput(arg, builder.createConvert(loc, argTy, value));
- } break;
- case PassBy::BaseAddressValueAttribute: {
- // VALUE attribute or pass-by-reference to a copy semantics. (byval*)
- TODO(loc, "HLFIR PassBy::BaseAddressValueAttribute");
- } break;
- case PassBy::BaseAddress:
- case PassBy::BoxChar: {
- hlfir::Entity entity = actual;
- if (entity.isVariable()) {
- entity = hlfir::derefPointersAndAllocatables(loc, builder, entity);
- // Copy-in non contiguous variable
- if (!isSimplyContiguous)
- TODO(loc, "HLFIR copy-in/copy-out");
- } else {
- hlfir::AssociateOp associate = hlfir::genAssociateExpr(
- loc, builder, entity, argTy, "adapt.valuebyref");
- exprAssociations.push_back(associate);
- entity = hlfir::Entity{associate.getBase()};
- }
- mlir::Value addr =
- arg.passBy == PassBy::BaseAddress
- ? hlfir::genVariableRawAddress(loc, builder, entity)
- : hlfir::genVariableBoxChar(loc, builder, entity);
- caller.placeInput(arg, builder.createConvert(loc, argTy, addr));
- } break;
- case PassBy::CharBoxValueAttribute: {
- TODO(loc, "HLFIR PassBy::CharBoxValueAttribute");
- } break;
- case PassBy::AddressAndLength:
- // PassBy::AddressAndLength is only used for character results. Results
- // are not handled here.
- fir::emitFatalError(
- loc, "unexpected PassBy::AddressAndLength for actual arguments");
- break;
- case PassBy::CharProcTuple: {
- TODO(loc, "HLFIR PassBy::CharProcTuple");
- } break;
- case PassBy::Box: {
- TODO(loc, "HLFIR PassBy::Box");
- } break;
- case PassBy::MutableBox: {
- TODO(loc, "HLFIR PassBy::MutableBox");
- } break;
+/// Lower calls to element user procedure with array actual arguments.
+static std::optional<hlfir::EntityWithAttributes>
----------------
Should this say "elemental"?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141510/new/
https://reviews.llvm.org/D141510
More information about the flang-commits
mailing list