1 //===- ConvertProcedureDesignator.h -- Procedure Designators ----*- 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 /// Lowering of evaluate::ProcedureDesignator to FIR and HLFIR. 14 /// 15 //===----------------------------------------------------------------------===// 16 17 #ifndef FORTRAN_LOWER_CONVERT_PROCEDURE_DESIGNATOR_H 18 #define FORTRAN_LOWER_CONVERT_PROCEDURE_DESIGNATOR_H 19 20 namespace mlir { 21 class Location; 22 class Value; 23 class Type; 24 } 25 namespace fir { 26 class ExtendedValue; 27 } 28 namespace hlfir { 29 class EntityWithAttributes; 30 } 31 namespace Fortran::evaluate { 32 struct ProcedureDesignator; 33 } 34 namespace Fortran::semantics { 35 class Symbol; 36 } 37 38 namespace Fortran::lower { 39 class AbstractConverter; 40 class StatementContext; 41 class SymMap; 42 43 /// Lower a procedure designator to a fir::ExtendedValue that can be a 44 /// fir::CharBoxValue for character procedure designator (the CharBoxValue 45 /// length carries the result length if it is known). 46 fir::ExtendedValue convertProcedureDesignator( 47 mlir::Location loc, Fortran::lower::AbstractConverter &converter, 48 const Fortran::evaluate::ProcedureDesignator &proc, 49 Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx); 50 51 /// Lower a procedure designator to a !fir.boxproc<()->() or 52 /// tuple<!fir.boxproc<()->(), len>. 53 hlfir::EntityWithAttributes convertProcedureDesignatorToHLFIR( 54 mlir::Location loc, Fortran::lower::AbstractConverter &converter, 55 const Fortran::evaluate::ProcedureDesignator &proc, 56 Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx); 57 58 /// Generate initialization for procedure pointer to procedure target. 59 mlir::Value 60 convertProcedureDesignatorInitialTarget(Fortran::lower::AbstractConverter &, 61 mlir::Location, 62 const Fortran::semantics::Symbol &sym); 63 64 /// Given the value of a "PASS" actual argument \p passedArg and the 65 /// evaluate::ProcedureDesignator for the call, address and dereference 66 /// the argument's procedure pointer component that must be called. 67 mlir::Value derefPassProcPointerComponent( 68 mlir::Location loc, Fortran::lower::AbstractConverter &converter, 69 const Fortran::evaluate::ProcedureDesignator &proc, mlir::Value passedArg, 70 Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx); 71 } // namespace Fortran::lower 72 #endif // FORTRAN_LOWER_CONVERT_PROCEDURE_DESIGNATOR_H 73