[all-commits] [llvm/llvm-project] fe252f: [flang] Lower boxed procedure
Valentin Clement (バレンタイン クレメン) via All-commits
all-commits at lists.llvm.org
Tue Mar 22 07:41:34 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fe252f8ed6369acdb13d4e290d3b9dfe2ec4eb8e
https://github.com/llvm/llvm-project/commit/fe252f8ed6369acdb13d4e290d3b9dfe2ec4eb8e
Author: Valentin Clement <clementval at gmail.com>
Date: 2022-03-22 (Tue, 22 Mar 2022)
Changed paths:
M flang/include/flang/Lower/Bridge.h
M flang/include/flang/Lower/CallInterface.h
M flang/include/flang/Lower/ConvertExpr.h
M flang/include/flang/Lower/IntrinsicCall.h
M flang/include/flang/Optimizer/Builder/Character.h
M flang/include/flang/Optimizer/Builder/FIRBuilder.h
M flang/include/flang/Optimizer/Builder/LowLevelIntrinsics.h
M flang/include/flang/Optimizer/CodeGen/CGPasses.td
M flang/include/flang/Optimizer/CodeGen/CodeGen.h
M flang/include/flang/Optimizer/Dialect/FIROps.td
M flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
M flang/include/flang/Optimizer/Dialect/FIRType.h
M flang/include/flang/Optimizer/Dialect/FIRTypes.td
M flang/include/flang/Tools/CLOptions.inc
M flang/lib/Lower/Bridge.cpp
M flang/lib/Lower/CallInterface.cpp
M flang/lib/Lower/ConvertExpr.cpp
M flang/lib/Lower/ConvertVariable.cpp
M flang/lib/Lower/IntrinsicCall.cpp
M flang/lib/Optimizer/Builder/Character.cpp
M flang/lib/Optimizer/Builder/FIRBuilder.cpp
M flang/lib/Optimizer/Builder/LowLevelIntrinsics.cpp
M flang/lib/Optimizer/Builder/MutableBox.cpp
A flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp
M flang/lib/Optimizer/CodeGen/CMakeLists.txt
M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
M flang/lib/Optimizer/CodeGen/TypeConverter.h
M flang/lib/Optimizer/Dialect/FIROps.cpp
M flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
R flang/test/Fir/Todo/emboxproc.fir
M flang/test/Fir/external-mangling-emboxproc.fir
M flang/test/Fir/fir-ops.fir
M flang/test/Lower/Intrinsics/len.f90
M flang/test/Lower/allocatable-assignment.f90
M flang/test/Lower/allocatable-callee.f90
M flang/test/Lower/allocatable-runtime.f90
M flang/test/Lower/allocatables.f90
A flang/test/Lower/dummy-procedure-character.f90
A flang/test/Lower/dummy-procedure.f90
M flang/test/Lower/host-associated.f90
M flang/test/Lower/procedure-declarations.f90
Log Message:
-----------
[flang] Lower boxed procedure
In FIR, we want to wrap function pointers in a special box known as a
boxproc value. Fortran has a limited form of dynamic scoping
[https://tinyurl.com/2p8v2hw7] between "host procedures" and "internal
procedures". There are a number of implementations possible.
Boxproc typed values abstract away the implementation details of when a
function pointer can be passed directly (as a raw address) and when a
function pointer has to account for the presence of a dynamic scope.
When lowering Fortran syntax to FIR, all function pointers are emboxed
as boxproc values.
When creating LLVM IR, we must strip away the abstraction and produce
low-level LLVM "assembly" code. This patch implements that
transformation as converting the boxproc values to either raw function
pointers or executable trampolines on the stack as needed. The
trampoline then captures the dynamic scope context within an executable
thunk that can be passed instead of the function's raw address.
Some extra handling is required for Fortran functions that return a
character value to deal with LEN values here.
Some of the code in Bridge.cpp and ConvertExpr.cpp and be re-arranged to
faciliate the upstreaming effort.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D122223
Co-authored-by: mleair <leairmark at gmail.com>
Co-authored-by: Jean Perier <jperier at nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz at nvidia.com>
Co-authored-by: V Donaldson <vdonaldson at nvidia.com>
Co-authored-by: Kiran Chandramohan <kiran.chandramohan at arm.com>
More information about the All-commits
mailing list