Reputation: 19
I have a function written in 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
and c function:
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);
}
my makefile:
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
I want to translate generate LLVM IR and inline that IR into a C++ function.
Everything works except I have to add "alwaysinline" attribute to the fortran IR in order for the opt
step to inline in it.
How do I force generation of inline attribute OR how do I force opt
to inline function without the attribute present?
Upvotes: 1
Views: 183