Skip to content

Commit

Permalink
Support Flang
Browse files Browse the repository at this point in the history
  • Loading branch information
eschnett committed Dec 28, 2023
1 parent ff2d332 commit a9d19dd
Show file tree
Hide file tree
Showing 4 changed files with 321 additions and 244 deletions.
86 changes: 79 additions & 7 deletions mpitrampoline/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,107 @@ endif()
check_fortran_source_compiles(
"
end
subroutine attr(buf)
subroutine sub(buf)
implicit none
!dir$ ignore_tkr(tkr) buf
integer buf
integer buf(*)
end
subroutine caller1(buf)
implicit none
integer buf(1)
interface
subroutine sub(buf)
implicit none
integer buf(*)
!dir$ ignore_tkr(tkr) buf
end subroutine sub
end interface
call sub(buf)
end subroutine caller1
subroutine caller2(buf)
implicit none
real buf(1)
interface
subroutine sub(buf)
implicit none
integer buf(*)
!dir$ ignore_tkr(tkr) buf
end subroutine sub
end interface
call sub(buf)
end subroutine caller2
subroutine caller3(buf)
implicit none
real buf
interface
subroutine sub(buf)
implicit none
integer buf(*)
!dir$ ignore_tkr(tkr) buf
end subroutine sub
end interface
call sub(buf)
end subroutine caller3
"
HAVE_Fortran_attribute_dir_ignore_tkr
SRC_EXT f90
)
if(HAVE_Fortran_attribute_dir_ignore_tkr)
set(DIR_IGNORE_TKR "")
else()
set(DIR_IGNORE_TKR "!")
set(DIR_IGNORE_TKR "!disabled ")
endif()
check_fortran_source_compiles(
"
end
subroutine attr(buf)
subroutine sub(buf)
implicit none
integer buf
!gcc$ attributes no_arg_check :: buf
integer buf(*)
end
subroutine caller1(buf)
implicit none
integer buf(1)
interface
subroutine sub(buf)
implicit none
integer buf(*)
!gcc$ attributes no_arg_check :: buf
end subroutine sub
end interface
call sub(buf)
end subroutine caller1
subroutine caller2(buf)
implicit none
real buf(1)
interface
subroutine sub(buf)
implicit none
integer buf(*)
!gcc$ attributes no_arg_check :: buf
end subroutine sub
end interface
call sub(buf)
end subroutine caller2
subroutine caller3(buf)
implicit none
real buf
interface
subroutine sub(buf)
implicit none
integer buf(*)
!gcc$ attributes no_arg_check :: buf
end subroutine sub
end interface
call sub(buf)
end subroutine caller3
"
HAVE_Fortran_attribute_gcc_attributes_no_arg_check
SRC_EXT f90
)
if(HAVE_Fortran_attribute_gcc_attributes_no_arg_check)
set(GCC_ATTRIBUTES_NO_ARG_CHECK "")
else()
set(GCC_ATTRIBUTES_NO_ARG_CHECK "!")
set(GCC_ATTRIBUTES_NO_ARG_CHECK "!disabled ")
endif()
add_compile_definitions(ENABLE_FORTRAN)

Expand Down Expand Up @@ -164,6 +235,7 @@ install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/mpi.mod DESTINATION ${CMAKE_INST
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/mpi_f08_types.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/mpi_f08_constants.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/mpi_f08_functions.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/mpi_f08_functions_internal.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/mpi_f08.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# Install pkgconfig files
Expand Down
2 changes: 1 addition & 1 deletion mpitrampoline/generate_trampoline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ function generate_mpif_functions_h(io::IO)
intent = fortran(arg.intent)
intent = isempty(intent) || arg.type === external ? "" : ", $intent"
if arg.type === buffer
println(io, "@DIR_IGNORE_TKR@!dir\$ $(indent)ignore_tkr(tkr) $(arg.name)")
println(io, "@DIR_IGNORE_TKR@!dir\$ ignore_tkr(tkr) $(arg.name)")
println(io, "@GCC_ATTRIBUTES_NO_ARG_CHECK@!gcc\$ $(indent)attributes no_arg_check :: $(arg.name)")
if arg.intent === out
intent = ""
Expand Down
Loading

0 comments on commit a9d19dd

Please sign in to comment.