Warning: This file is not a C or C++ file. It does not have highlighting.

1//===-- ConvertCall.h -- lowering of calls ----------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10//
11//===----------------------------------------------------------------------===//
12///
13/// Implements the conversion from evaluate::ProcedureRef to FIR.
14///
15//===----------------------------------------------------------------------===//
16
17#ifndef FORTRAN_LOWER_CONVERTCALL_H
18#define FORTRAN_LOWER_CONVERTCALL_H
19
20#include "flang/Lower/AbstractConverter.h"
21#include "flang/Lower/CallInterface.h"
22#include "flang/Optimizer/Builder/HLFIRTools.h"
23#include <optional>
24
25namespace Fortran::lower {
26
27/// Given a call site for which the arguments were already lowered, generate
28/// the call and return the result. This function deals with explicit result
29/// allocation and lowering if needed. It also deals with passing the host
30/// link to internal procedures.
31/// \p isElemental must be set to true if elemental call is being produced.
32/// It is only used for HLFIR.
33/// The returned boolean indicates if finalization has been emitted in
34/// \p stmtCtx for the result.
35std::pair<fir::ExtendedValue, bool> genCallOpAndResult(
36 mlir::Location loc, Fortran::lower::AbstractConverter &converter,
37 Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx,
38 Fortran::lower::CallerInterface &caller, mlir::FunctionType callSiteType,
39 std::optional<mlir::Type> resultType, bool isElemental = false);
40
41/// If \p arg is the address of a function with a denoted host-association tuple
42/// argument, then return the host-associations tuple value of the current
43/// procedure. Otherwise, return nullptr.
44mlir::Value argumentHostAssocs(Fortran::lower::AbstractConverter &converter,
45 mlir::Value arg);
46
47/// Is \p procRef an intrinsic module procedure that should be lowered as
48/// intrinsic procedures (with Optimizer/Builder/IntrinsicCall.h)?
49bool isIntrinsicModuleProcRef(const Fortran::evaluate::ProcedureRef &procRef);
50
51/// Lower a ProcedureRef to HLFIR. If this is a function call, return the
52/// lowered result value. Return nothing otherwise.
53std::optional<hlfir::EntityWithAttributes> convertCallToHLFIR(
54 mlir::Location loc, Fortran::lower::AbstractConverter &converter,
55 const evaluate::ProcedureRef &procRef, std::optional<mlir::Type> resultType,
56 Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx);
57
58void convertUserDefinedAssignmentToHLFIR(
59 mlir::Location loc, Fortran::lower::AbstractConverter &converter,
60 const evaluate::ProcedureRef &procRef, hlfir::Entity lhs, hlfir::Entity rhs,
61 Fortran::lower::SymMap &symMap);
62} // namespace Fortran::lower
63#endif // FORTRAN_LOWER_CONVERTCALL_H
64

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of flang/include/flang/Lower/ConvertCall.h