[flang-commits] [flang] [RFC][flang] Trampolines for internal procedures. (PR #66157)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Fri Sep 22 03:07:04 PDT 2023


================
@@ -0,0 +1,373 @@
+<!--===- docs/InternalProcedureTrampolines.md
+
+   Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+   See https://llvm.org/LICENSE.txt for license information.
+   SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+-->
+
+# Trampolines for pointers to internal procedures.
+
+## Overview
+
+```fortran
+subroutine host()
+  integer :: local = 10
+  call internal()
+  return
+
+  contains
+  subroutine internal()
+    print *, local
+  end subroutine internal
+end subroutine host
+```
+
+Procedure code generated for subprogram `inernal()` must have access to the scope of
+its host procedure, e.g. to access `local` variable. Flang achieves this by passing
+an extra argument to `internal()` that is a tuple of references to all variables
----------------
kiranchandramohan wrote:

Does the tuple include procedure pointers as well?

https://github.com/llvm/llvm-project/pull/66157


More information about the flang-commits mailing list