Fortran LLVM中的强制函数内联
我有一个用fortran编写的函数:Fortran LLVM中的强制函数内联,fortran,llvm,clang++,llvm-ir,flang,Fortran,Llvm,Clang++,Llvm Ir,Flang,我有一个用fortran编写的函数: !function.f90 subroutine ffunc(i, x) use iso_c_binding implicit none integer(c_int), value :: i integer(c_int) :: x(*) x(1) = i end 和c功能: extern "C" void cfunction(int i, long* x) { x[0] = i; } extern "C" void ffunc_(
!function.f90
subroutine ffunc(i, x)
use iso_c_binding
implicit none
integer(c_int), value :: i
integer(c_int) :: x(*)
x(1) = i
end
和c功能:
extern "C" void cfunction(int i, long* x) {
x[0] = i;
}
extern "C" void ffunc_(int i, long* x);
extern "C" void bigcall(int i, long* x) {
ffunc_(i, x);
}
我的生成文件:
all:
flang -O2 -S -emit-llvm ./function.f90
clang++ -O2 -S -emit-llvm ./cfunction.cpp
llvm-link -S function.ll cfunction.ll -o all.ll
opt -S --inline all.ll -o all_opt.ll
< >我想翻译生成LLVM IR,并将IR嵌入到C++函数中。
除了我必须将“alwaysinline”属性添加到fortran IR中,以使opt
步骤内联在其中之外,其他一切都可以正常工作
如何强制生成内联属性,或者如何在属性不存在的情况下强制opt
内联函数